MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / resolve

Method resolve

vrclient_x64/jsoncpp.cpp:3988–4005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3986}
3987
3988Value Path::resolve(const Value& root, const Value& defaultValue) const {
3989 const Value* node = &root;
3990 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
3991 const PathArgument& arg = *it;
3992 if (arg.kind_ == PathArgument::kindIndex) {
3993 if (!node->isArray() || !node->isValidIndex(arg.index_))
3994 return defaultValue;
3995 node = &((*node)[arg.index_]);
3996 } else if (arg.kind_ == PathArgument::kindKey) {
3997 if (!node->isObject())
3998 return defaultValue;
3999 node = &((*node)[arg.key_]);
4000 if (node == &Value::nullRef)
4001 return defaultValue;
4002 }
4003 }
4004 return *node;
4005}
4006
4007Value& Path::make(Value& root) const {
4008 Value* node = &root;

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected