mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-14 09:57:56 +08:00
drop this-> (team preference)
This commit is contained in:
parent
e893625e88
commit
05c1b8344d
@ -1019,7 +1019,7 @@ Value Value::removeMember(const std::string& key) {
|
||||
}
|
||||
|
||||
bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
||||
if (this->type_ != arrayValue) {
|
||||
if (type_ != arrayValue) {
|
||||
return false;
|
||||
}
|
||||
#ifdef JSON_VALUE_USE_INTERNAL_MAP
|
||||
@ -1027,21 +1027,21 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
||||
return false;
|
||||
#else
|
||||
CZString key(index);
|
||||
ObjectValues::iterator it = this->value_.map_->find(key);
|
||||
if (it == this->value_.map_->end()) {
|
||||
ObjectValues::iterator it = value_.map_->find(key);
|
||||
if (it == value_.map_->end()) {
|
||||
return false;
|
||||
}
|
||||
*removed = it->second;
|
||||
ArrayIndex oldSize = this->size();
|
||||
ArrayIndex oldSize = size();
|
||||
// shift left all items left, into the place of the "removed"
|
||||
for (ArrayIndex i=index; i<oldSize-1; i++){
|
||||
CZString key(i);
|
||||
(*this->value_.map_)[key] = (*this)[i+1];
|
||||
(*value_.map_)[key] = (*this)[i+1];
|
||||
}
|
||||
// erase the last one ("leftover")
|
||||
CZString keyLast(oldSize-1);
|
||||
ObjectValues::iterator itLast = this->value_.map_->find(keyLast);
|
||||
this->value_.map_->erase(itLast);
|
||||
ObjectValues::iterator itLast = value_.map_->find(keyLast);
|
||||
value_.map_->erase(itLast);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user