MCPcopy Create free account
hub / github.com/Illumina/paragraph / resolve

Method resolve

external/jsoncpp/jsoncpp.cpp:4092–4109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4090}
4091
4092Value Path::resolve(const Value& root, const Value& defaultValue) const {
4093 const Value* node = &root;
4094 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
4095 const PathArgument& arg = *it;
4096 if (arg.kind_ == PathArgument::kindIndex) {
4097 if (!node->isArray() || !node->isValidIndex(arg.index_))
4098 return defaultValue;
4099 node = &((*node)[arg.index_]);
4100 } else if (arg.kind_ == PathArgument::kindKey) {
4101 if (!node->isObject())
4102 return defaultValue;
4103 node = &((*node)[arg.key_]);
4104 if (node == &Value::nullSingleton())
4105 return defaultValue;
4106 }
4107 }
4108 return *node;
4109}
4110
4111Value& Path::make(Value& root) const {
4112 Value* node = &root;

Callers

nothing calls this directly

Calls 5

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected