Line | |
---|
1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #include "../include/ArduinoJson/JsonArray.hpp"
|
---|
9 |
|
---|
10 | #include "../include/ArduinoJson/JsonBuffer.hpp"
|
---|
11 | #include "../include/ArduinoJson/JsonObject.hpp"
|
---|
12 |
|
---|
13 | using namespace ArduinoJson;
|
---|
14 | using namespace ArduinoJson::Internals;
|
---|
15 |
|
---|
16 | JsonArray JsonArray::_invalid(NULL);
|
---|
17 |
|
---|
18 | JsonArray::node_type *JsonArray::getNodeAt(size_t index) const {
|
---|
19 | node_type *node = _firstNode;
|
---|
20 | while (node && index--) node = node->next;
|
---|
21 | return node;
|
---|
22 | }
|
---|
23 |
|
---|
24 | void JsonArray::removeAt(size_t index) { removeNode(getNodeAt(index)); }
|
---|
25 |
|
---|
26 | void JsonArray::writeTo(JsonWriter &writer) const {
|
---|
27 | writer.beginArray();
|
---|
28 |
|
---|
29 | const node_type *child = _firstNode;
|
---|
30 | while (child) {
|
---|
31 | child->content.writeTo(writer);
|
---|
32 |
|
---|
33 | child = child->next;
|
---|
34 | if (!child) break;
|
---|
35 |
|
---|
36 | writer.writeComma();
|
---|
37 | }
|
---|
38 |
|
---|
39 | writer.endArray();
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.