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

Method resize

src/jsoncpp/jsoncpp.cpp:2311–2331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2309}
2310
2311void Value::resize(ArrayIndex newSize) {
2312 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
2313 "in Json::Value::resize(): requires arrayValue");
2314 if (type_ == nullValue)
2315 *this = Value(arrayValue);
2316#ifndef JSON_VALUE_USE_INTERNAL_MAP
2317 ArrayIndex oldSize = size();
2318 if (newSize == 0)
2319 clear();
2320 else if (newSize > oldSize)
2321 (*this)[newSize - 1];
2322 else {
2323 for (ArrayIndex index = newSize; index < oldSize; ++index) {
2324 value_.map_->erase(index);
2325 }
2326 assert(size() == newSize);
2327 }
2328#else
2329 value_.array_->resize(newSize);
2330#endif
2331}
2332
2333Value& Value::operator[](ArrayIndex index) {
2334 JSON_ASSERT_MESSAGE(

Callers 4

codePointToUTF8Function · 0.45
readValueMethod · 0.45
recoverFromErrorMethod · 0.45
unindentMethod · 0.45

Calls 5

assertFunction · 0.85
ValueClass · 0.50
sizeFunction · 0.50
clearFunction · 0.50
eraseMethod · 0.45

Tested by

no test coverage detected