| 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( |
no test coverage detected