MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / resolve

Method resolve

AgentBench.old/src/tasks/card_game/logic/src/jsoncpp/jsoncpp.cpp:4108–4125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4106}
4107
4108Value Path::resolve(const Value& root, const Value& defaultValue) const {
4109 const Value* node = &root;
4110 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
4111 const PathArgument& arg = *it;
4112 if (arg.kind_ == PathArgument::kindIndex) {
4113 if (!node->isArray() || !node->isValidIndex(arg.index_))
4114 return defaultValue;
4115 node = &((*node)[arg.index_]);
4116 } else if (arg.kind_ == PathArgument::kindKey) {
4117 if (!node->isObject())
4118 return defaultValue;
4119 node = &((*node)[arg.key_]);
4120 if (node == &Value::nullSingleton())
4121 return defaultValue;
4122 }
4123 }
4124 return *node;
4125}
4126
4127Value& Path::make(Value& root) const {
4128 Value* node = &root;

Callers 4

ulFunction · 0.45
setup.pyFile · 0.45
jquery-ui.min.jsFile · 0.45
jquery-ui.min.jsFile · 0.45

Calls 5

beginMethod · 0.45
endMethod · 0.45
isArrayMethod · 0.45
isValidIndexMethod · 0.45
isObjectMethod · 0.45

Tested by

no test coverage detected