JSON::Iter::remove() now resets the internal state back to the beginning of the iteration on the root JSON::Value object.

This commit is contained in:
Thulinma 2021-07-27 03:09:42 +02:00
parent 55c03fd886
commit 2ffd320316

View file

@ -66,15 +66,17 @@ uint32_t JSON::Iter::num() const{
}
/// Delete the current indice from the parent JSON::Value.
/// Resets the iterator to restart from the beginning
void JSON::Iter::remove(){
if (*this){
i = 0;
if (myType == JSON::ARRAY){
r->removeMember(aIt);
return;
aIt = r->arrVal.begin();
}
if (myType == JSON::OBJECT){
r->removeMember(oIt);
return;
oIt = r->objVal.begin();
}
}
}