MCPcopy Create free account
hub / github.com/cinder/Cinder / resolve

Method resolve

src/jsoncpp/jsoncpp.cpp:2972–2989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2970}
2971
2972Value Path::resolve(const Value& root, const Value& defaultValue) const {
2973 const Value* node = &root;
2974 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
2975 const PathArgument& arg = *it;
2976 if (arg.kind_ == PathArgument::kindIndex) {
2977 if (!node->isArray() || !node->isValidIndex(arg.index_))
2978 return defaultValue;
2979 node = &((*node)[arg.index_]);
2980 } else if (arg.kind_ == PathArgument::kindKey) {
2981 if (!node->isObject())
2982 return defaultValue;
2983 node = &((*node)[arg.key_]);
2984 if (node == &Value::null)
2985 return defaultValue;
2986 }
2987 }
2988 return *node;
2989}
2990
2991Value& Path::make(Value& root) const {
2992 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