MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / resolve

Method resolve

edrav2/eprj/jsoncpp/src/lib_json/json_value.cpp:1681–1697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1679}
1680
1681Value Path::resolve(const Value& root, const Value& defaultValue) const {
1682 const Value* node = &root;
1683 for (const auto & arg : args_) {
1684 if (arg.kind_ == PathArgument::kindIndex) {
1685 if (!node->isArray() || !node->isValidIndex(arg.index_))
1686 return defaultValue;
1687 node = &((*node)[arg.index_]);
1688 } else if (arg.kind_ == PathArgument::kindKey) {
1689 if (!node->isObject())
1690 return defaultValue;
1691 node = &((*node)[arg.key_]);
1692 if (node == &Value::nullSingleton())
1693 return defaultValue;
1694 }
1695 }
1696 return *node;
1697}
1698
1699Value& Path::make(Value& root) const {
1700 Value* node = &root;

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.45

Tested by

no test coverage detected