2014-09-27 12:16:20 +02:00
|
|
|
#pragma once
|
|
|
|
|
2014-10-05 14:40:03 +02:00
|
|
|
#include "JsonArray.h"
|
|
|
|
#include "JsonObject.h"
|
2014-09-27 12:16:20 +02:00
|
|
|
|
2014-10-14 21:24:26 +02:00
|
|
|
class JsonParser;
|
|
|
|
|
2014-09-27 12:16:20 +02:00
|
|
|
class JsonBuffer
|
|
|
|
{
|
2014-10-01 16:56:22 +02:00
|
|
|
friend class JsonContainer;
|
2014-10-09 18:20:40 +02:00
|
|
|
friend class JsonNode;
|
2014-10-14 21:24:26 +02:00
|
|
|
friend class JsonParser;
|
2014-09-27 12:16:20 +02:00
|
|
|
|
|
|
|
public:
|
2014-10-05 14:40:03 +02:00
|
|
|
virtual ~JsonBuffer() {};
|
|
|
|
|
|
|
|
JsonArray createArray()
|
|
|
|
{
|
2014-10-15 14:54:31 +02:00
|
|
|
return JsonArray(createArrayNode());
|
2014-10-05 14:40:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
JsonObject createObject()
|
|
|
|
{
|
2014-10-15 14:54:31 +02:00
|
|
|
return JsonObject(createObjectNode());
|
2014-10-05 14:40:03 +02:00
|
|
|
}
|
2014-09-27 12:16:20 +02:00
|
|
|
|
2014-09-27 16:18:40 +02:00
|
|
|
JsonValue createValue();
|
|
|
|
|
2014-10-14 21:24:26 +02:00
|
|
|
JsonArray parseArray(char* string);
|
2014-10-14 17:16:21 +02:00
|
|
|
|
2014-09-27 12:16:20 +02:00
|
|
|
protected:
|
2014-10-09 14:17:09 +02:00
|
|
|
virtual void* allocateNode() = 0;
|
2014-09-27 14:43:19 +02:00
|
|
|
|
|
|
|
private:
|
2014-10-09 14:17:09 +02:00
|
|
|
JsonNode* createNode();
|
2014-10-15 14:54:31 +02:00
|
|
|
|
|
|
|
JsonNode* createArrayNode();
|
|
|
|
JsonNode* createObjectNode();
|
|
|
|
JsonNode* createLongNode(long value);
|
|
|
|
JsonNode *createDoubleNode(double value, int decimals);
|
2014-10-15 23:10:52 +02:00
|
|
|
|
|
|
|
JsonNode *createBoolNode(bool value);
|
2014-09-27 12:16:20 +02:00
|
|
|
};
|
|
|
|
|