MCPcopy Create free account
hub / github.com/PlayFab/gsdk / resolve

Method resolve

cpp/cppsdk/jsoncpp.cpp:4120–4137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4118}
4119
4120Value Path::resolve(const Value& root, const Value& defaultValue) const {
4121 const Value* node = &root;
4122 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
4123 const PathArgument& arg = *it;
4124 if (arg.kind_ == PathArgument::kindIndex) {
4125 if (!node->isArray() || !node->isValidIndex(arg.index_))
4126 return defaultValue;
4127 node = &((*node)[arg.index_]);
4128 } else if (arg.kind_ == PathArgument::kindKey) {
4129 if (!node->isObject())
4130 return defaultValue;
4131 node = &((*node)[arg.key_]);
4132 if (node == &Value::nullSingleton())
4133 return defaultValue;
4134 }
4135 }
4136 return *node;
4137}
4138
4139Value& Path::make(Value& root) const {
4140 Value* node = &root;

Callers 1

LoggerMethod · 0.95

Calls 5

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

Tested by

no test coverage detected