MCPcopy Create free account
hub / github.com/cinder/Cinder / size

Method size

src/jsoncpp/jsoncpp.cpp:2247–2275  ·  view source on GitHub ↗

Number of values in array or object

Source from the content-addressed store, hash-verified

2245
2246/// Number of values in array or object
2247ArrayIndex Value::size() const {
2248 switch (type_) {
2249 case nullValue:
2250 case intValue:
2251 case uintValue:
2252 case realValue:
2253 case booleanValue:
2254 case stringValue:
2255 return 0;
2256#ifndef JSON_VALUE_USE_INTERNAL_MAP
2257 case arrayValue: // size of the array is highest index + 1
2258 if (!value_.map_->empty()) {
2259 ObjectValues::const_iterator itLast = value_.map_->end();
2260 --itLast;
2261 return (*itLast).first.index() + 1;
2262 }
2263 return 0;
2264 case objectValue:
2265 return ArrayIndex(value_.map_->size());
2266#else
2267 case arrayValue:
2268 return Int(value_.array_->size());
2269 case objectValue:
2270 return Int(value_.map_->size());
2271#endif
2272 }
2273 JSON_ASSERT_UNREACHABLE;
2274 return 0; // unreachable;
2275}
2276
2277bool Value::empty() const {
2278 if (isNull() || isArray() || isObject())

Callers 11

readValueMethod · 0.45
recoverFromErrorMethod · 0.45
goodMethod · 0.45
operator<Method · 0.45
operator==Method · 0.45
isConvertibleToMethod · 0.45
getMemberNamesMethod · 0.45
writeValueMethod · 0.45
writeArrayValueMethod · 0.45
isMultineArrayMethod · 0.45
unindentMethod · 0.45

Calls 3

emptyMethod · 0.45
endMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected