MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / SplitVersionString

Method SplitVersionString

_fervor/fvversioncomparator.cpp:39–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39std::vector<std::string> FvVersionComparator::SplitVersionString(std::string version)
40{
41 std::string character;
42 std::string s;
43 unsigned long i = 0, n = 0;
44 CharacterType oldType, newType;
45 std::vector<std::string> parts;
46
47 if (version.length() == 0) {
48 // Nothing to do here
49 return parts;
50 }
51
52 s = version.substr(0, 1);
53 oldType = TypeOfCharacter(s);
54 n = version.length() - 1;
55 for (i = 1; i <= n; ++i) {
56 character = version.substr(i, 1)[0];
57 newType = TypeOfCharacter(character);
58 if (oldType != newType || oldType == kSeparatorType) {
59 // We've reached a new segment
60 std::string aPart = s;
61 parts.push_back(aPart);
62 s = character;
63 } else {
64 // Add character to string and continue
65 s.append(character);
66 }
67 oldType = newType;
68 }
69
70 // Add the last part onto the array
71 parts.push_back(s);
72 return parts;
73}
74
75
76FvVersionComparator::ComparatorResult FvVersionComparator::CompareVersions(std::string versionA,

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.80
substrMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected