MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / resize

Method resize

vrclient_x64/jsoncpp.cpp:3365–3381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3363}
3364
3365void Value::resize(ArrayIndex newSize) {
3366 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
3367 "in Json::Value::resize(): requires arrayValue");
3368 if (type_ == nullValue)
3369 *this = Value(arrayValue);
3370 ArrayIndex oldSize = size();
3371 if (newSize == 0)
3372 clear();
3373 else if (newSize > oldSize)
3374 (*this)[newSize - 1];
3375 else {
3376 for (ArrayIndex index = newSize; index < oldSize; ++index) {
3377 value_.map_->erase(index);
3378 }
3379 assert(size() == newSize);
3380 }
3381}
3382
3383Value& Value::operator[](ArrayIndex index) {
3384 JSON_ASSERT_MESSAGE(

Callers 3

codePointToUTF8Function · 0.80
recoverFromErrorMethod · 0.80
unindentMethod · 0.80

Calls 1

ValueClass · 0.50

Tested by

no test coverage detected