MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / resolve

Method resolve

Sources/Dependencies/jsoncpp/value.cpp:1823–1839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1821 }
1822
1823 Value Path::resolve(const Value& root, const Value& defaultValue) const {
1824 const Value* node = &root;
1825 for (const auto& arg : args_) {
1826 if (arg.kind_ == PathArgument::kindIndex) {
1827 if (!node->isArray() || !node->isValidIndex(arg.index_))
1828 return defaultValue;
1829 node = &((*node)[arg.index_]);
1830 } else if (arg.kind_ == PathArgument::kindKey) {
1831 if (!node->isObject())
1832 return defaultValue;
1833 node = &((*node)[arg.key_]);
1834 if (node == &Value::nullSingleton())
1835 return defaultValue;
1836 }
1837 }
1838 return *node;
1839 }
1840
1841 Value& Path::make(Value& root) const {
1842 Value* node = &root;

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80

Tested by

no test coverage detected