MCPcopy Create free account
hub / github.com/Illumina/paragraph / removeIndex

Method removeIndex

external/jsoncpp/jsoncpp.cpp:3674–3695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3672}
3673
3674bool Value::removeIndex(ArrayIndex index, Value* removed) {
3675 if (type_ != arrayValue) {
3676 return false;
3677 }
3678 CZString key(index);
3679 ObjectValues::iterator it = value_.map_->find(key);
3680 if (it == value_.map_->end()) {
3681 return false;
3682 }
3683 *removed = it->second;
3684 ArrayIndex oldSize = size();
3685 // shift left all items left, into the place of the "removed"
3686 for (ArrayIndex i = index; i < (oldSize - 1); ++i){
3687 CZString keey(i);
3688 (*value_.map_)[keey] = (*this)[i + 1];
3689 }
3690 // erase the last one ("leftover")
3691 CZString keyLast(oldSize - 1);
3692 ObjectValues::iterator itLast = value_.map_->find(keyLast);
3693 value_.map_->erase(itLast);
3694 return true;
3695}
3696
3697#ifdef JSON_USE_CPPTL
3698Value Value::get(const CppTL::ConstString& key,

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected