2014-09-27 11:42:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class JsonBuffer;
|
|
|
|
class JsonValue;
|
2014-09-27 11:53:26 +02:00
|
|
|
struct JsonNode;
|
2014-09-27 11:42:27 +02:00
|
|
|
|
|
|
|
class JsonObject
|
|
|
|
{
|
2014-09-27 11:53:26 +02:00
|
|
|
// friend class JsonValue;
|
|
|
|
//
|
|
|
|
//public:
|
|
|
|
// JsonObject(JsonBuffer& buffer, JsonNode& node)
|
|
|
|
// : _buffer(buffer), _node(node)
|
|
|
|
// {
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// JsonObject createObject(const char* key)
|
|
|
|
// {
|
|
|
|
// JsonObject innerObject = _buffer.createObject();
|
|
|
|
// addNodeAt(key, innerObject._node);
|
|
|
|
// return innerObject;
|
|
|
|
// }
|
|
|
|
//
|
2014-09-27 11:42:27 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-09-27 12:16:20 +02:00
|
|
|
JsonObject(JsonBuffer* buffer)
|
|
|
|
: _size(0), _buffer(buffer)
|
2014-09-27 11:53:26 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-09-27 11:42:27 +02:00
|
|
|
int size()
|
|
|
|
{
|
2014-09-27 11:53:26 +02:00
|
|
|
return _size;
|
2014-09-27 11:42:27 +02:00
|
|
|
}
|
|
|
|
|
2014-09-27 11:53:26 +02:00
|
|
|
JsonValue operator[](const char* key);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
int _size;
|
|
|
|
|
2014-09-27 12:16:20 +02:00
|
|
|
JsonBuffer* _buffer;
|
|
|
|
//JsonNode* _node;
|
2014-09-27 11:53:26 +02:00
|
|
|
//
|
|
|
|
// void addNodeAt(char const* key, JsonNode& node);
|
|
|
|
// JsonNode& getNodeAt(const char* key);
|
|
|
|
//
|
|
|
|
// // TODO: pull up
|
|
|
|
// void appendChild(JsonNode& newChild);
|
2014-09-27 11:42:27 +02:00
|
|
|
};
|