MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / resize

Method resize

Libraries/jsoncpp-0.y.z/src/lib_json/json_value.cpp:884–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882}
883
884void Value::resize(ArrayIndex newSize) {
885 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
886 "in Json::Value::resize(): requires arrayValue");
887 if (type_ == nullValue)
888 *this = Value(arrayValue);
889 ArrayIndex oldSize = size();
890 if (newSize == 0)
891 clear();
892 else if (newSize > oldSize)
893 (*this)[newSize - 1];
894 else {
895 for (ArrayIndex index = newSize; index < oldSize; ++index) {
896 value_.map_->erase(index);
897 }
898 assert(size() == newSize);
899 }
900}
901
902Value& Value::operator[](ArrayIndex index) {
903 JSON_ASSERT_MESSAGE(

Callers 4

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

Calls 4

ValueClass · 0.50
sizeFunction · 0.50
clearFunction · 0.50
eraseMethod · 0.45

Tested by

no test coverage detected