-
Notifications
You must be signed in to change notification settings - Fork 0
/
List.cpp
executable file
·34 lines (28 loc) · 869 Bytes
/
List.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright Benoit Blanchon 2014
// MIT License
//
// Arduino JSON library
// https://github.com/bblanchon/ArduinoJson
#include "List.h"
#include "JsonPair.h"
#include "JsonVariant.h"
using namespace ArduinoJson;
using namespace ArduinoJson::Internals;
template <typename T>
int List<T>::size() const {
int nodeCount = 0;
for (node_type *node = _firstNode; node; node = node->next) nodeCount++;
return nodeCount;
}
template <typename T>
void List<T>::removeNode(node_type *nodeToRemove) {
if (!nodeToRemove) return;
if (nodeToRemove == _firstNode) {
_firstNode = nodeToRemove->next;
} else {
for (node_type *node = _firstNode; node; node = node->next)
if (node->next == nodeToRemove) node->next = nodeToRemove->next;
}
}
template class ArduinoJson::Internals::List<JsonPair>;
template class ArduinoJson::Internals::List<JsonVariant>;