Extracted class JsonValue

This commit is contained in:
Benoît Blanchon
2014-06-27 13:42:26 +02:00
parent dd8baea373
commit 0240270492
8 changed files with 133 additions and 94 deletions

View File

@ -5,7 +5,7 @@
#pragma once
#include "StringBuilder.h"
#include "JsonValue.h"
class JsonObjectBase
{
@ -17,32 +17,6 @@ public:
writeTo(sb);
}
protected:
enum JsonValueType
{
JSON_STRING,
JSON_NUMBER,
JSON_BOOLEAN,
JSON_OBJECT,
};
union JsonValueContent
{
const char* string;
double number;
bool boolean;
JsonObjectBase* object;
};
struct JsonValue
{
JsonValueType type;
JsonValueContent content;
};
void writeValueTo(JsonValue& obj, StringBuilder& sb);
virtual void writeTo(StringBuilder& sb) = 0;
};