MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / removeIndex

Method removeIndex

src/jsoncpp.cpp:3604–3625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3602}
3603
3604bool Value::removeIndex(ArrayIndex index, Value* removed) {
3605 if (type_ != arrayValue) {
3606 return false;
3607 }
3608 CZString key(index);
3609 ObjectValues::iterator it = value_.map_->find(key);
3610 if (it == value_.map_->end()) {
3611 return false;
3612 }
3613 *removed = it->second;
3614 ArrayIndex oldSize = size();
3615 // shift left all items left, into the place of the "removed"
3616 for (ArrayIndex i = index; i < (oldSize - 1); ++i){
3617 CZString keey(i);
3618 (*value_.map_)[keey] = (*this)[i + 1];
3619 }
3620 // erase the last one ("leftover")
3621 CZString keyLast(oldSize - 1);
3622 ObjectValues::iterator itLast = value_.map_->find(keyLast);
3623 value_.map_->erase(itLast);
3624 return true;
3625}
3626
3627#ifdef JSON_USE_CPPTL
3628Value Value::get(const CppTL::ConstString& key,

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected