MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / resolve

Method resolve

common/json/jsoncpp.cpp:4026–4043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4024}
4025
4026Value Path::resolve(const Value& root, const Value& defaultValue) const {
4027 const Value* node = &root;
4028 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
4029 const PathArgument& arg = *it;
4030 if (arg.kind_ == PathArgument::kindIndex) {
4031 if (!node->isArray() || !node->isValidIndex(arg.index_))
4032 return defaultValue;
4033 node = &((*node)[arg.index_]);
4034 } else if (arg.kind_ == PathArgument::kindKey) {
4035 if (!node->isObject())
4036 return defaultValue;
4037 node = &((*node)[arg.key_]);
4038 if (node == &Value::nullSingleton())
4039 return defaultValue;
4040 }
4041 }
4042 return *node;
4043}
4044
4045Value& Path::make(Value& root) const {
4046 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