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

Method size

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

Number of values in array or object

Source from the content-addressed store, hash-verified

879
880/// Number of values in array or object
881Value::UInt
882Value::size() const
883{
884 switch ( type_ )
885 {
886 case nullValue:
887 case intValue:
888 case uintValue:
889 case realValue:
890 case booleanValue:
891 case stringValue:
892 return 0;
893#ifndef JSON_VALUE_USE_INTERNAL_MAP
894 case arrayValue: // size of the array is highest index + 1
895 if ( !value_.map_->empty() )
896 {
897 ObjectValues::const_iterator itLast = value_.map_->end();
898 --itLast;
899 return (*itLast).first.index()+1;
900 }
901 return 0;
902 case objectValue:
903 return Int( value_.map_->size() );
904#else
905 case arrayValue:
906 return Int( value_.array_->size() );
907 case objectValue:
908 return Int( value_.map_->size() );
909#endif
910 default:
911 JSON_ASSERT_UNREACHABLE;
912 }
913 return 0; // unreachable;
914}
915
916
917bool

Callers 15

runMethod · 0.80
doInBackgroundMethod · 0.80
recoverFromErrorMethod · 0.80
writeValueMethod · 0.80
writeArrayValueMethod · 0.80
isMultineArrayMethod · 0.80
unindentMethod · 0.80
operator <Method · 0.80
operator ==Method · 0.80
asBoolMethod · 0.80
isConvertibleToMethod · 0.80

Calls 3

emptyMethod · 0.80
endMethod · 0.80
indexMethod · 0.80

Tested by 6

TestParser1Method · 0.64
TestParser2Method · 0.64
TestParser3Method · 0.64
TestParser4Method · 0.64
TestParser5Method · 0.64
TestWriteMethod · 0.64