MCPcopy Create free account
hub / github.com/Illumina/hap.py / resize

Method resize

external/jsoncpp/jsoncpp.cpp:2391–2411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2389}
2390
2391void Value::resize(ArrayIndex newSize) {
2392 JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
2393 "in Json::Value::resize(): requires arrayValue");
2394 if (type_ == nullValue)
2395 *this = Value(arrayValue);
2396#ifndef JSON_VALUE_USE_INTERNAL_MAP
2397 ArrayIndex oldSize = size();
2398 if (newSize == 0)
2399 clear();
2400 else if (newSize > oldSize)
2401 (*this)[newSize - 1];
2402 else {
2403 for (ArrayIndex index = newSize; index < oldSize; ++index) {
2404 value_.map_->erase(index);
2405 }
2406 assert(size() == newSize);
2407 }
2408#else
2409 value_.array_->resize(newSize);
2410#endif
2411}
2412
2413Value &Value::operator[](ArrayIndex index) {
2414 JSON_ASSERT_MESSAGE(

Callers 3

codePointToUTF8Function · 0.45
recoverFromErrorMethod · 0.45
unindentMethod · 0.45

Calls 1

ValueClass · 0.50

Tested by

no test coverage detected