MCPcopy Create free account
hub / github.com/Kitware/CMake / validateDataVersion

Function validateDataVersion

Source/cmInstrumentationCommand.cxx:52–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52bool validateDataVersion(std::string const& versionString, Version& version,
53 cmExecutionStatus& status)
54{
55 char const* vStart = versionString.c_str();
56 if (!std::all_of(versionString.begin(), versionString.end(), [](char c) {
57 return cmsysString_isdigit(c) || c == '.';
58 })) {
59 status.SetError(
60 cmStrCat("given a malformed DATA_VERSION \"", versionString,
61 "\". A numeric major or major.minor version is required."));
62
63 return false;
64 }
65
66 version.Major = std::atoi(vStart);
67 version.Minor = 0;
68 std::string::size_type pos = versionString.find('.');
69 if (pos != std::string::npos) {
70 vStart += pos + 1;
71 version.Minor = std::atoi(vStart);
72 }
73
74 if (version.Major < 1 || version.Minor < 0) {
75 status.SetError(
76 cmStrCat("given a malformed DATA_VERSION \"", versionString,
77 "\". A numeric major or major.minor version is required."));
78 return false;
79 }
80
81 if (!cmInstrumentationQuery::ValidDataVersion(version)) {
82 status.SetError(
83 cmStrCat("given an unsupported DATA_VERSION \"", versionString,
84 "\" (the only currently supported version is 1.0)."));
85 return false;
86 }
87
88 return true;
89}
90
91template <typename E>
92std::function<bool(std::string const&, E&)> EnumParser(

Callers 1

cmInstrumentationCommandFunction · 0.85

Calls 6

c_strMethod · 0.80
cmStrCatFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
SetErrorMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…