Removed usages of JsonNodeIterator

This commit is contained in:
Benoit Blanchon
2014-10-24 18:31:50 +02:00
parent 68fb03577c
commit 1f6cd8e56e
16 changed files with 84 additions and 40 deletions

View File

@ -22,11 +22,9 @@ JsonValue JsonObject::operator[](char const *key) {
}
void JsonObject::remove(char const *key) {
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) {
const char *childKey = it->getAsObjectKey();
if (!strcmp(childKey, key)) {
removeChild(*it);
for (JsonObjectIterator it = begin(); it != end(); ++it) {
if (!strcmp(it->key(), key)) {
removeChild(it->_node);
}
}
}
@ -48,10 +46,8 @@ JsonObject JsonObject::createNestedObject(char const *key) {
}
JsonNode *JsonObject::getOrCreateNodeAt(const char *key) {
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) {
const char *childKey = it->getAsObjectKey();
if (!strcmp(childKey, key)) return it->getAsObjectValue();
for (JsonObjectIterator it = begin(); it != end(); ++it) {
if (!strcmp(it->key(), key)) return it->value()._node;
}
JsonNode *newValueNode = createNode();
@ -66,7 +62,3 @@ JsonNode *JsonObject::getOrCreateNodeAt(const char *key) {
return newValueNode;
}
JsonObjectIterator JsonObject::begin() {
return JsonObjectIterator(_node->getContainerChild());
}