mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02:00
Merged JsonArrayNode and JsonObjectNode into a single template
This commit is contained in:
@ -6,13 +6,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Internals/JsonArrayNode.hpp"
|
||||
#include "Internals/JsonIterator.hpp"
|
||||
#include "Internals/JsonPrintable.hpp"
|
||||
#include "Internals/Node.hpp"
|
||||
#include "Internals/ReferenceType.hpp"
|
||||
#include "JsonVariant.hpp"
|
||||
|
||||
#define JSON_ARRAY_SIZE(NUMBER_OF_ELEMENTS) \
|
||||
(sizeof(JsonArray) + (NUMBER_OF_ELEMENTS) * sizeof(Internals::JsonArrayNode))
|
||||
(sizeof(JsonArray) + (NUMBER_OF_ELEMENTS) * sizeof(JsonArray::node_type))
|
||||
|
||||
namespace ArduinoJson {
|
||||
|
||||
@ -25,10 +26,9 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>,
|
||||
|
||||
public:
|
||||
typedef JsonVariant value_type;
|
||||
typedef Internals::JsonIterator<Internals::JsonArrayNode, JsonVariant>
|
||||
iterator;
|
||||
typedef Internals::JsonIterator<Internals::JsonArrayNode, const JsonVariant>
|
||||
const_iterator;
|
||||
typedef Internals::Node<JsonVariant> node_type;
|
||||
typedef Internals::JsonIterator<node_type, JsonVariant> iterator;
|
||||
typedef Internals::JsonIterator<node_type, const JsonVariant> const_iterator;
|
||||
|
||||
int size() const;
|
||||
|
||||
@ -65,11 +65,11 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>,
|
||||
// constructor is private: instance must be created via a JsonBuffer
|
||||
JsonArray(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
||||
|
||||
Internals::JsonArrayNode *createNode();
|
||||
inline void addNode(Internals::JsonArrayNode *node);
|
||||
node_type *createNode();
|
||||
inline void addNode(node_type *node);
|
||||
|
||||
JsonBuffer *_buffer;
|
||||
Internals::JsonArrayNode *_firstNode;
|
||||
node_type *_firstNode;
|
||||
static JsonArray _invalid;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user