forked from bblanchon/ArduinoJson
Removed usages of JsonNodeIterator
This commit is contained in:
@ -12,8 +12,8 @@ using namespace ArduinoJson;
|
||||
using namespace ArduinoJson::Internals;
|
||||
|
||||
JsonValue JsonArray::operator[](int index) const {
|
||||
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) {
|
||||
if (!index) return JsonValue(*it);
|
||||
for (const_iterator it = begin(); it != end(); ++it) {
|
||||
if (!index) return *it;
|
||||
index--;
|
||||
}
|
||||
|
||||
@ -82,9 +82,3 @@ JsonObject JsonArray::createNestedObject() {
|
||||
|
||||
return JsonObject(node);
|
||||
}
|
||||
|
||||
JsonArrayIterator JsonArray::begin() {
|
||||
if (!_node) return end();
|
||||
|
||||
return JsonArrayIterator(_node->getContainerChild());
|
||||
}
|
||||
|
@ -73,3 +73,8 @@ size_t JsonContainer::size() const {
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
JsonNode* JsonContainer::firstChild() const
|
||||
{
|
||||
return _node ? _node->getContainerChild() : 0;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user