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

Function ParseRoot

Source/cmCxxModuleMetadata.cxx:226–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226bool ParseRoot(Json::Value& root, cmCxxModuleMetadata& meta,
227 cmJSONState* state)
228{
229 if (!root.isMember("version") || !root["version"].isInt()) {
230 state->AddErrorAtValue(
231 "Top-level member 'version' is required and must be an integer", &root);
232 return false;
233 }
234 meta.Version = root["version"].asInt();
235
236 if (root.isMember("revision")) {
237 if (!root["revision"].isInt()) {
238 state->AddErrorAtValue("'revision' must be an integer",
239 &root["revision"]);
240 return false;
241 }
242 meta.Revision = root["revision"].asInt();
243 }
244
245 if (meta.Version != 1) {
246 state->AddErrorAtValue(cmStrCat("Module manifest version number, '",
247 meta.Version, '.', meta.Revision,
248 "' is newer than max supported (1.1)"),
249 &root);
250 return false;
251 }
252
253 if (root.isMember("modules")) {
254 if (!root["modules"].isArray()) {
255 state->AddErrorAtValue("'modules' must be an array", &root["modules"]);
256 return false;
257 }
258 for (Json::Value& mval : root["modules"]) {
259 meta.Modules.emplace_back();
260 if (!ParseModule(mval, meta.Modules.back(), state)) {
261 return false;
262 }
263 }
264 }
265
266 return true;
267}
268
269} // namespace
270

Callers 1

LoadFromFileMethod · 0.85

Calls 9

ParseModuleFunction · 0.85
isMemberMethod · 0.80
isIntMethod · 0.80
AddErrorAtValueMethod · 0.80
asIntMethod · 0.80
isArrayMethod · 0.80
emplace_backMethod · 0.80
cmStrCatFunction · 0.70
backMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…