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

Method resolve

lib/jsoncpp/src/lib_json/json_value.cpp:1672–1696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1670
1671
1672Value
1673Path::resolve( const Value &root,
1674 const Value &defaultValue ) const
1675{
1676 const Value *node = &root;
1677 for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
1678 {
1679 const PathArgument &arg = *it;
1680 if ( arg.kind_ == PathArgument::kindIndex )
1681 {
1682 if ( !node->isArray() || node->isValidIndex( arg.index_ ) )
1683 return defaultValue;
1684 node = &((*node)[arg.index_]);
1685 }
1686 else if ( arg.kind_ == PathArgument::kindKey )
1687 {
1688 if ( !node->isObject() )
1689 return defaultValue;
1690 node = &((*node)[arg.key_]);
1691 if ( node == &Value::null )
1692 return defaultValue;
1693 }
1694 }
1695 return *node;
1696}
1697
1698
1699Value &

Callers

nothing calls this directly

Calls 5

beginMethod · 0.80
endMethod · 0.80
isArrayMethod · 0.80
isValidIndexMethod · 0.80
isObjectMethod · 0.80

Tested by

no test coverage detected