MCPcopy Create free account
hub / github.com/SOUI2/soui / resize

Method resize

third-part/jsoncpp/src/lib_json/json_value.cpp:983–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

981}
982
983void Value::resize(ArrayIndex newSize) {
984 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
985 "in Json::Value::resize(): requires arrayValue");
986 if (type_ == nullValue)
987 *this = Value(arrayValue);
988 ArrayIndex oldSize = size();
989 if (newSize == 0)
990 clear();
991 else if (newSize > oldSize)
992 (*this)[newSize - 1];
993 else {
994 for (ArrayIndex index = newSize; index < oldSize; ++index) {
995 value_.map_->erase(index);
996 }
997 JSON_ASSERT(size() == newSize);
998 }
999}
1000
1001Value& Value::operator[](ArrayIndex index) {
1002 JSON_ASSERT_MESSAGE(

Callers 4

recoverFromErrorMethod · 0.45
codePointToUTF8Function · 0.45
unindentMethod · 0.45
JSONTEST_FIXTUREFunction · 0.45

Calls 3

ValueClass · 0.50
sizeFunction · 0.50
clearFunction · 0.50

Tested by

no test coverage detected