MCPcopy Create free account
hub / github.com/PlayFab/gsdk / removeIndex

Method removeIndex

cpp/cppsdk/jsoncpp.cpp:3698–3720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3696}
3697
3698bool Value::removeIndex(ArrayIndex index, Value* removed) {
3699 if (type_ != arrayValue) {
3700 return false;
3701 }
3702 CZString key(index);
3703 ObjectValues::iterator it = value_.map_->find(key);
3704 if (it == value_.map_->end()) {
3705 return false;
3706 }
3707 if (removed)
3708 *removed = it->second;
3709 ArrayIndex oldSize = size();
3710 // shift left all items left, into the place of the "removed"
3711 for (ArrayIndex i = index; i < (oldSize - 1); ++i) {
3712 CZString keey(i);
3713 (*value_.map_)[keey] = (*this)[i + 1];
3714 }
3715 // erase the last one ("leftover")
3716 CZString keyLast(oldSize - 1);
3717 ObjectValues::iterator itLast = value_.map_->find(keyLast);
3718 value_.map_->erase(itLast);
3719 return true;
3720}
3721
3722#ifdef JSON_USE_CPPTL
3723Value 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