MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / Version

Method Version

src/Version.cpp:38–60  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

36
37////////////////////////////////////////////////////////////////////////////////
38Version::Version(std::string version) {
39 std::vector<int> parts;
40 std::string part;
41 std::istringstream input(version);
42
43 while (std::getline(input, part, '.')) {
44 int value;
45 // Try converting string to integer
46 if (std::stringstream(part) >> value && value >= 0) {
47 parts.push_back(value);
48 } else {
49 return;
50 }
51 }
52
53 if (parts.size() != 3) {
54 return;
55 }
56
57 major = parts[0];
58 minor = parts[1];
59 patch = parts[2];
60}
61
62////////////////////////////////////////////////////////////////////////////////
63Version Version::Current() { return Version(PACKAGE_VERSION); }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected