MCPcopy Create free account
hub / github.com/Samsung/ONE / resolve

Method resolve

runtime/3rdparty/jsoncpp/jsoncpp.cpp:4349–4370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4347}
4348
4349Value Path::resolve(const Value &root, const Value &defaultValue) const
4350{
4351 const Value *node = &root;
4352 for (const auto &arg : args_)
4353 {
4354 if (arg.kind_ == PathArgument::kindIndex)
4355 {
4356 if (!node->isArray() || !node->isValidIndex(arg.index_))
4357 return defaultValue;
4358 node = &((*node)[arg.index_]);
4359 }
4360 else if (arg.kind_ == PathArgument::kindKey)
4361 {
4362 if (!node->isObject())
4363 return defaultValue;
4364 node = &((*node)[arg.key_]);
4365 if (node == &Value::nullSingleton())
4366 return defaultValue;
4367 }
4368 }
4369 return *node;
4370}
4371
4372Value &Path::make(Value &root) const
4373{

Callers 3

__init__Method · 0.45
__init__Method · 0.45
add_configMethod · 0.45

Calls 3

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80

Tested by

no test coverage detected