forked from bblanchon/ArduinoJson
Removed JsonPair constructor
This commit is contained in:
@ -12,7 +12,7 @@ namespace ArduinoJson {
|
|||||||
namespace Internals {
|
namespace Internals {
|
||||||
|
|
||||||
struct JsonObjectNode {
|
struct JsonObjectNode {
|
||||||
JsonObjectNode(const char* key) : content(key), next(NULL) {}
|
JsonObjectNode() : next(NULL) {}
|
||||||
|
|
||||||
JsonPair content;
|
JsonPair content;
|
||||||
JsonObjectNode* next;
|
JsonObjectNode* next;
|
||||||
|
@ -67,7 +67,7 @@ class JsonObject : public Internals::JsonPrintable<JsonObject>,
|
|||||||
JsonObject(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
JsonObject(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
||||||
|
|
||||||
JsonVariant &add(key_type key) { return (*this)[key]; }
|
JsonVariant &add(key_type key) { return (*this)[key]; }
|
||||||
Internals::JsonObjectNode *createNode(key_type key);
|
Internals::JsonObjectNode *createNode();
|
||||||
void addNode(Internals::JsonObjectNode *nodeToAdd);
|
void addNode(Internals::JsonObjectNode *nodeToAdd);
|
||||||
void removeNode(Internals::JsonObjectNode *nodeToRemove);
|
void removeNode(Internals::JsonObjectNode *nodeToRemove);
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
namespace ArduinoJson {
|
namespace ArduinoJson {
|
||||||
|
|
||||||
struct JsonPair {
|
struct JsonPair {
|
||||||
JsonPair(const char* k) : key(k) {}
|
|
||||||
|
|
||||||
const char* key;
|
const char* key;
|
||||||
JsonVariant value;
|
JsonVariant value;
|
||||||
};
|
};
|
||||||
|
@ -67,17 +67,18 @@ JsonObjectNode *JsonObject::getOrCreateNodeAt(const char *key) {
|
|||||||
JsonObjectNode *existingNode = getNodeAt(key);
|
JsonObjectNode *existingNode = getNodeAt(key);
|
||||||
if (existingNode) return existingNode;
|
if (existingNode) return existingNode;
|
||||||
|
|
||||||
JsonObjectNode *newNode = createNode(key);
|
JsonObjectNode *newNode = createNode();
|
||||||
|
if (!newNode) return NULL;
|
||||||
if (newNode) addNode(newNode);
|
|
||||||
|
|
||||||
|
newNode->content.key = key;
|
||||||
|
addNode(newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObjectNode *JsonObject::createNode(const char *key) {
|
JsonObjectNode *JsonObject::createNode() {
|
||||||
if (!_buffer) return NULL;
|
if (!_buffer) return NULL;
|
||||||
void *ptr = _buffer->alloc(sizeof(JsonObjectNode));
|
void *ptr = _buffer->alloc(sizeof(JsonObjectNode));
|
||||||
return ptr ? new (ptr) JsonObjectNode(key) : NULL;
|
return ptr ? new (ptr) JsonObjectNode() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonObject::addNode(JsonObjectNode *nodeToAdd) {
|
void JsonObject::addNode(JsonObjectNode *nodeToAdd) {
|
||||||
|
Reference in New Issue
Block a user