MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / resize

Method resize

Sources/Dependencies/jsoncpp/value.cpp:1003–1019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001 }
1002
1003 void Value::resize(ArrayIndex newSize) {
1004 JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue, "in Json::Value::resize(): requires arrayValue");
1005 if (type() == nullValue)
1006 *this = Value(arrayValue);
1007 ArrayIndex oldSize = size();
1008 if (newSize == 0)
1009 clear();
1010 else if (newSize > oldSize)
1011 for (ArrayIndex i = oldSize; i < newSize; ++i)
1012 (*this)[i];
1013 else {
1014 for (ArrayIndex index = newSize; index < oldSize; ++index) {
1015 value_.map_->erase(index);
1016 }
1017 JSON_ASSERT(size() == newSize);
1018 }
1019 }
1020
1021 Value& Value::operator[](ArrayIndex index) {
1022 JSON_ASSERT_MESSAGE(

Callers 9

valueToStringFunction · 0.45
unindentMethod · 0.45
recoverFromErrorMethod · 0.45
codePointToUTF8Function · 0.45
genRandomStringMethod · 0.45
DecodeMethod · 0.45
compressDataMethod · 0.45
loadFunction · 0.45
WebSocketTransportMethod · 0.45

Calls 4

typeClass · 0.85
sizeFunction · 0.85
ValueFunction · 0.70
eraseMethod · 0.45

Tested by

no test coverage detected