Unified JsonArrayNode and JsonObjectNode

This commit is contained in:
Benoit Blanchon
2014-11-05 09:24:15 +01:00
parent c6d11294e4
commit bafec6f1a3
7 changed files with 18 additions and 18 deletions

View File

@ -14,8 +14,8 @@ namespace Internals {
struct JsonArrayNode {
JsonArrayNode() : next(NULL) {}
JsonVariant content;
JsonArrayNode* next;
JsonVariant value;
};
}
}

View File

@ -14,8 +14,8 @@ class JsonIterator {
public:
explicit JsonIterator(TNode *node) : _node(node) {}
TValue &operator*() const { return _node->value; }
TValue *operator->() { return &_node->value; }
TValue &operator*() const { return _node->content; }
TValue *operator->() { return &_node->content; }
bool operator==(const JsonIterator<TNode, TValue> &other) const {
return _node == other._node;

View File

@ -12,9 +12,9 @@ namespace ArduinoJson {
namespace Internals {
struct JsonObjectNode {
JsonObjectNode(const char* k) : pair(k), next(NULL) {}
JsonObjectNode(const char* key) : content(key), next(NULL) {}
JsonPair pair;
JsonPair content;
JsonObjectNode* next;
};
}

View File

@ -15,8 +15,8 @@ class JsonObjectConstIterator {
explicit JsonObjectConstIterator(Internals::JsonObjectNode *node)
: _node(node) {}
const JsonPair &operator*() { return _node->pair; }
const JsonPair *operator->() { return &_node->pair; }
const JsonPair &operator*() { return _node->content; }
const JsonPair *operator->() { return &_node->content; }
bool operator==(const JsonObjectConstIterator &other) const {
return _node == other._node;

View File

@ -14,8 +14,8 @@ class JsonObjectIterator {
public:
explicit JsonObjectIterator(Internals::JsonObjectNode *node) : _node(node) {}
JsonPair &operator*() { return _node->pair; }
JsonPair *operator->() { return &_node->pair; }
JsonPair &operator*() { return _node->content; }
JsonPair *operator->() { return &_node->content; }
bool operator==(const JsonObjectIterator &other) const {
return _node == other._node;