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

Method ReadJSON

Source/cmInstrumentationQuery.cxx:127–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 .Bind("version"_s, &QueryRoot::version, VersionHelper, true);
126
127bool cmInstrumentationQuery::ReadJSON(std::string const& filename,
128 std::string& errorMessage,
129 std::set<Option>& options,
130 std::set<Hook>& hooks,
131 std::vector<Callback>& callbacks)
132{
133 Json::Value root;
134 this->parseState = cmJSONState(filename, &root);
135 if (!this->parseState.errors.empty()) {
136 errorMessage = this->parseState.GetErrorMessage(true);
137 return false;
138 }
139 if (!QueryRootVersionOnlyHelper(this->queryRoot, &root, &this->parseState)) {
140 errorMessage = this->parseState.GetErrorMessage(true);
141 return false;
142 }
143 if (!ValidDataVersion(this->queryRoot.version)) {
144 // Ignore invalid data versions
145 return true;
146 }
147 if (!QueryRootHelper(this->queryRoot, &root, &this->parseState)) {
148 errorMessage = this->parseState.GetErrorMessage(true);
149 return false;
150 }
151 std::move(this->queryRoot.options.begin(), this->queryRoot.options.end(),
152 std::inserter(options, options.end()));
153 std::move(this->queryRoot.hooks.begin(), this->queryRoot.hooks.end(),
154 std::inserter(hooks, hooks.end()));
155 for (auto const& callback : this->queryRoot.callbacks) {
156 callbacks.push_back({ callback, this->queryRoot.version });
157 }
158 return true;
159}
160
161bool cmInstrumentationQuery::ValidDataVersion(Version version)
162{

Callers 1

ReadJSONQueryMethod · 0.80

Calls 7

moveFunction · 0.85
push_backMethod · 0.80
cmJSONStateClass · 0.70
emptyMethod · 0.45
GetErrorMessageMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected