mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Redesigned JsonVariant to leverage converting constructors instead of assignment operators
This commit is contained in:
@@ -39,7 +39,7 @@ class List {
|
||||
|
||||
// Returns the numbers of elements in the list.
|
||||
// For a JsonObject, it would return the number of key-value pairs
|
||||
int size() const;
|
||||
size_t size() const;
|
||||
|
||||
iterator begin() { return iterator(_firstNode); }
|
||||
iterator end() { return iterator(NULL); }
|
||||
@@ -48,19 +48,20 @@ class List {
|
||||
const_iterator end() const { return const_iterator(NULL); }
|
||||
|
||||
protected:
|
||||
node_type *createNode() {
|
||||
node_type *addNewNode() {
|
||||
if (!_buffer) return NULL;
|
||||
return new (_buffer) node_type();
|
||||
}
|
||||
|
||||
void addNode(node_type *nodeToAdd) {
|
||||
node_type *newNode = new (_buffer) node_type();
|
||||
|
||||
if (_firstNode) {
|
||||
node_type *lastNode = _firstNode;
|
||||
while (lastNode->next) lastNode = lastNode->next;
|
||||
lastNode->next = nodeToAdd;
|
||||
lastNode->next = newNode;
|
||||
} else {
|
||||
_firstNode = nodeToAdd;
|
||||
_firstNode = newNode;
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
void removeNode(node_type *nodeToRemove);
|
||||
|
||||
Reference in New Issue
Block a user