MCPcopy Create free account
hub / github.com/Kitware/VTK / resolve

Method resolve

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:4038–4054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4036}
4037
4038Value Path::resolve(const Value& root, const Value& defaultValue) const {
4039 const Value* node = &root;
4040 for (const auto& arg : args_) {
4041 if (arg.kind_ == PathArgument::kindIndex) {
4042 if (!node->isArray() || !node->isValidIndex(arg.index_))
4043 return defaultValue;
4044 node = &((*node)[arg.index_]);
4045 } else if (arg.kind_ == PathArgument::kindKey) {
4046 if (!node->isObject())
4047 return defaultValue;
4048 node = &((*node)[arg.key_]);
4049 if (node == &Value::nullSingleton())
4050 return defaultValue;
4051 }
4052 }
4053 return *node;
4054}
4055
4056Value& Path::make(Value& root) const {
4057 Value* node = &root;

Callers 3

openDirectoryFunction · 0.80
__init__Method · 0.80

Calls 3

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80

Tested by 1

__init__Method · 0.64