MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / resolve

Method resolve

Source/ThirdParty/jsoncpp/src/lib_json/json_value.cpp:1623–1640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1621}
1622
1623Value Path::resolve(const Value& root, const Value& defaultValue) const {
1624 const Value* node = &root;
1625 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
1626 const PathArgument& arg = *it;
1627 if (arg.kind_ == PathArgument::kindIndex) {
1628 if (!node->isArray() || !node->isValidIndex(arg.index_))
1629 return defaultValue;
1630 node = &((*node)[arg.index_]);
1631 } else if (arg.kind_ == PathArgument::kindKey) {
1632 if (!node->isObject())
1633 return defaultValue;
1634 node = &((*node)[arg.key_]);
1635 if (node == &Value::nullSingleton())
1636 return defaultValue;
1637 }
1638 }
1639 return *node;
1640}
1641
1642Value& Path::make(Value& root) const {
1643 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