MCPcopy Create free account
hub / github.com/Samsung/UTopia / resolve

Method resolve

external/jsoncpp/jsoncpp.cpp:4030–4046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4028}
4029
4030Value Path::resolve(const Value &root, const Value &defaultValue) const {
4031 const Value *node = &root;
4032 for (const auto &arg : args_) {
4033 if (arg.kind_ == PathArgument::kindIndex) {
4034 if (!node->isArray() || !node->isValidIndex(arg.index_))
4035 return defaultValue;
4036 node = &((*node)[arg.index_]);
4037 } else if (arg.kind_ == PathArgument::kindKey) {
4038 if (!node->isObject())
4039 return defaultValue;
4040 node = &((*node)[arg.key_]);
4041 if (node == &Value::nullSingleton())
4042 return defaultValue;
4043 }
4044 }
4045 return *node;
4046}
4047
4048Value &Path::make(Value &root) const {
4049 Value *node = &root;

Callers 4

abspathMethod · 0.80
__init__Method · 0.80
prepare_gitFunction · 0.80
__init__Method · 0.80

Calls 3

isValidIndexMethod · 0.80
isObjectMethod · 0.80
isArrayMethod · 0.45

Tested by

no test coverage detected