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

Method resolve

src/jsoncpp.cpp:3989–4006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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