Files
ArduinoJson/include/ArduinoJson/JsonContainer.h

54 lines
1.4 KiB
C
Raw Normal View History

2014-10-16 00:11:23 +02:00
#pragma once
2014-10-18 23:05:54 +02:00
#include "Arduino/Printable.h"
#include "Internals/JsonNodeIterator.h"
#include "Internals/JsonNode.h"
#include "Internals/IndentedPrint.h"
#include "Internals/JsonNodeWrapper.h"
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
namespace ArduinoJson
2014-10-16 00:11:23 +02:00
{
2014-10-18 23:05:54 +02:00
class JsonArray;
class JsonObject;
class JsonValue;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
class JsonContainer : public Printable, public Internals::JsonNodeWrapper
{
friend class JsonArray;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
public:
JsonContainer() {}
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
explicit JsonContainer(Internals::JsonNode* node)
2014-10-16 00:11:23 +02:00
: JsonNodeWrapper(node)
2014-10-18 23:05:54 +02:00
{
}
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
size_t size() const;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
bool operator==(JsonContainer const& other) const;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
size_t printTo(char* buffer, size_t bufferSize) const;
virtual size_t printTo(Print& print) const;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
size_t prettyPrintTo(char* buffer, size_t bufferSize) const;
size_t prettyPrintTo(ArduinoJson::Internals::IndentedPrint& print) const;
size_t prettyPrintTo(Print& print) const;
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
protected:
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
Internals::JsonNodeIterator beginChildren() const
{
return Internals::JsonNodeIterator(_node ? _node->getContainerChild() : 0);
}
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
Internals::JsonNodeIterator endChildren() const
{
return Internals::JsonNodeIterator(0);
}
2014-10-16 00:11:23 +02:00
2014-10-18 23:05:54 +02:00
void addChild(Internals::JsonNode*);
void removeChild(Internals::JsonNode*);
Internals::JsonNode* createNode();
};
}