Epic refactoring in progress

This commit is contained in:
Benoit Blanchon
2014-10-26 21:18:09 +01:00
parent cdf3777aa8
commit e0980292ef
29 changed files with 477 additions and 541 deletions

View File

@ -12,38 +12,16 @@ using namespace ArduinoJson;
using namespace ArduinoJson::Internals;
JsonValue JsonArray::operator[](int index) const {
for (const_iterator it = begin(); it != end(); ++it) {
if (!index) return *it;
index--;
}
return JsonValue();
}
JsonValue JsonArray::addNewValue() {
JsonNode *node = createNode();
if (node) addChild(node);
return JsonValueInternal(node);
if (!_impl) return JsonValue::null();
return JsonValue((*_impl)[index]);
}
JsonArray JsonArray::createNestedArray() {
JsonNode *node = createNode();
if (node) {
node->setAsArray(_node->getContainerBuffer());
addChild(node);
}
return JsonArray(node);
if (!_impl) return JsonArray::null();
return JsonArray(_impl->createNestedArray());
}
JsonObject JsonArray::createNestedObject() {
JsonNode *node = createNode();
if (node) {
node->setAsObject(_node->getContainerBuffer());
addChild(node);
}
return JsonObject(node);
}
if (!_impl) return JsonObject::null();
return JsonObject(_impl->createNestedObject()));
}