MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / resolve

Method resolve

Source/JSON/jsoncpp.cpp:3618–3634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3616}
3617
3618Value Path::resolve(const Value& root, const Value& defaultValue) const {
3619 const Value* node = &root;
3620 for (const auto& arg : args_) {
3621 if (arg.kind_ == PathArgument::kindIndex) {
3622 if (!node->isArray() || !node->isValidIndex(arg.index_))
3623 return defaultValue;
3624 node = &((*node)[arg.index_]);
3625 } else if (arg.kind_ == PathArgument::kindKey) {
3626 if (!node->isObject())
3627 return defaultValue;
3628 node = &((*node)[arg.key_]);
3629 if (node == &Value::nullRef)
3630 return defaultValue;
3631 }
3632 }
3633 return *node;
3634}
3635
3636Value& Path::make(Value& root) const {
3637 Value* node = &root;

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.45
isValidIndexMethod · 0.45
isObjectMethod · 0.45

Tested by

no test coverage detected