Epic refactoring in progress

This commit is contained in:
Benoit Blanchon
2014-10-28 17:58:46 +01:00
parent 61218f12fd
commit 10ab95522d
10 changed files with 38 additions and 30 deletions

View File

@ -11,6 +11,7 @@
namespace ArduinoJson {
namespace Internals {
// TODO: copy from JsonArrayIterator
class JsonArrayConstIterator {
public:
explicit JsonArrayConstIterator(JsonArrayNode *node) : _node(node) {}

View File

@ -39,6 +39,8 @@ class JsonArrayImpl {
private:
JsonArrayImpl(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
inline void addNode(JsonArrayNode *node);
JsonBuffer *_buffer;
Internals::JsonArrayNode *_firstNode;
};

View File

@ -29,8 +29,10 @@ class JsonArrayIterator {
}
JsonArrayIterator &operator++() {
_node = _node->next;
updateValue();
if (_node) {
_node = _node->next;
updateValue();
}
return *this;
}

View File

@ -25,7 +25,7 @@ class JsonObjectIterator {
}
JsonObjectIterator &operator++() {
_pair._node = _pair._node->next;
if (_pair._node) _pair._node = _pair._node->next;
return *this;
}

View File

@ -24,7 +24,7 @@ class JsonObjectNode {
JsonObjectNode* next;
private:
JsonObjectNode(const char* k) : key(k) {}
JsonObjectNode(const char* k) : key(k), next(NULL) {}
};
}
}

View File

@ -17,9 +17,11 @@ class StaticJsonBuffer : public JsonBuffer {
virtual ~StaticJsonBuffer() {}
int capacity() { return CAPACITY; }
int capacity() const { return CAPACITY; }
int size() { return _size; }
int size() const { return _size; }
void clear() { _size = 0; }
protected:
virtual void* alloc(size_t size) {