MCPcopy Create free account
hub / github.com/Kitware/CMake / resize

Method resize

Utilities/cmjsoncpp/src/lib_json/json_value.cpp:906–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904}
905
906void Value::resize(ArrayIndex newSize) {
907 JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue,
908 "in Json::Value::resize(): requires arrayValue");
909 if (type() == nullValue)
910 *this = Value(arrayValue);
911 ArrayIndex oldSize = size();
912 if (newSize == 0)
913 clear();
914 else if (newSize > oldSize)
915 for (ArrayIndex i = oldSize; i < newSize; ++i)
916 (*this)[i];
917 else {
918 for (ArrayIndex index = newSize; index < oldSize; ++index) {
919 value_.map_->erase(index);
920 }
921 JSON_ASSERT(size() == newSize);
922 }
923}
924
925Value& Value::operator[](ArrayIndex index) {
926 JSON_ASSERT_MESSAGE(

Callers 5

recoverFromErrorMethod · 0.45
codePointToUTF8Function · 0.45
valueToStringFunction · 0.45
unindentMethod · 0.45
deserializeMethod · 0.45

Calls 4

clearFunction · 0.85
eraseMethod · 0.80
typeClass · 0.50
ValueFunction · 0.50

Tested by

no test coverage detected