Files
ArduinoJson/srcs/Internals/JsonNode.h

60 lines
1021 B
C
Raw Normal View History

#pragma once
class JsonBuffer;
enum JsonNodeType
{
JSON_UNDEFINED,
2014-09-28 21:04:59 +02:00
JSON_PROXY,
JSON_NULL,
JSON_ARRAY,
JSON_OBJECT,
JSON_KEY,
JSON_BOOLEAN,
JSON_STRING,
JSON_INTEGER,
JSON_DOUBLE_0_DECIMALS,
JSON_DOUBLE_1_DECIMAL,
JSON_DOUBLE_2_DECIMALS,
// etc.
};
2014-10-05 16:25:49 +02:00
class JsonWriter;
struct JsonNode
{
2014-10-05 16:25:49 +02:00
JsonNode* next;
JsonNodeType type; // <- TODO: hide
void writeTo(JsonWriter&);
union
{
bool asBoolean;
double asDouble;
2014-09-30 17:24:14 +02:00
long asInteger;
const char* asString;
struct
{
const char* key;
JsonNode* value;
} asKey;
struct
{
JsonNode* child;
JsonBuffer* buffer;
2014-10-01 16:13:36 +02:00
} asContainer;
2014-09-28 21:04:59 +02:00
struct
{
JsonNode* target;
} asProxy;
} content;
2014-10-05 16:25:49 +02:00
private:
inline void writeArrayTo(JsonWriter&);
inline void writeObjectTo(JsonWriter&);
};