MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / resize

Method resize

edrav2/eprj/jsoncpp/src/lib_json/json_value.cpp:968–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968void Value::resize(ArrayIndex newSize) {
969 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
970 "in Json::Value::resize(): requires arrayValue");
971 if (type_ == nullValue)
972 *this = Value(arrayValue);
973 ArrayIndex oldSize = size();
974 if (newSize == 0)
975 clear();
976 else if (newSize > oldSize)
977 this->operator[](newSize - 1);
978 else {
979 for (ArrayIndex index = newSize; index < oldSize; ++index) {
980 value_.map_->erase(index);
981 }
982 JSON_ASSERT(size() == newSize);
983 }
984}
985
986Value& Value::operator[](ArrayIndex index) {
987 JSON_ASSERT_MESSAGE(

Callers 5

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

Calls 5

ValueClass · 0.50
sizeClass · 0.50
clearClass · 0.50
operator[]Method · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected