MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / split_semver

Function split_semver

src/include/update.hpp:33–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33static std::vector<int> split_semver(const std::string& v) {
34 std::vector<int> out; out.reserve(3);
35 size_t start = 0;
36 while (start < v.size()) {
37 size_t dot = v.find('.', start);
38 std::string part = v.substr(start, (dot == std::string::npos) ? std::string::npos : (dot - start));
39 size_t i = 0; while (i < part.size() && std::isdigit(static_cast<unsigned char>(part[i]))) ++i;
40 int n = 0; if (i) n = std::stoi(part.substr(0, i));
41 out.push_back(n);
42 if (dot == std::string::npos) break;
43 start = dot + 1;
44 }
45 while (out.size() < 3) out.push_back(0);
46 return out;
47}
48
49static int compare_semver(std::string a, std::string b) {
50 a = strip_v_prefix(a);

Callers 1

compare_semverFunction · 0.85

Calls 3

push_backMethod · 0.80
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected