MCPcopy Index your code
hub / github.com/Kitware/CMake / resolve

Method resolve

Utilities/cmjsoncpp/src/lib_json/json_value.cpp:1600–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1598}
1599
1600Value Path::resolve(const Value& root, const Value& defaultValue) const {
1601 const Value* node = &root;
1602 for (const auto& arg : args_) {
1603 if (arg.kind_ == PathArgument::kindIndex) {
1604 if (!node->isArray() || !node->isValidIndex(arg.index_))
1605 return defaultValue;
1606 node = &((*node)[arg.index_]);
1607 } else if (arg.kind_ == PathArgument::kindKey) {
1608 if (!node->isObject())
1609 return defaultValue;
1610 node = &((*node)[arg.key_]);
1611 if (node == &Value::nullSingleton())
1612 return defaultValue;
1613 }
1614 }
1615 return *node;
1616}
1617
1618Value& Path::make(Value& root) const {
1619 Value* node = &root;

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80

Tested by

no test coverage detected