2014-09-27 12:16:20 +02:00
|
|
|
#include "JsonBuffer.h"
|
2014-09-27 16:18:40 +02:00
|
|
|
|
2014-10-09 14:17:09 +02:00
|
|
|
#include <new>
|
2014-09-27 12:16:20 +02:00
|
|
|
|
2014-09-27 16:18:40 +02:00
|
|
|
#include "JsonValue.h"
|
2014-10-14 21:24:26 +02:00
|
|
|
#include "Internals/JsonParser.h"
|
2014-10-01 16:08:32 +02:00
|
|
|
#include "Internals/JsonNode.h"
|
2014-09-27 12:16:20 +02:00
|
|
|
|
2014-09-27 16:18:40 +02:00
|
|
|
JsonValue JsonBuffer::createValue()
|
|
|
|
{
|
2014-10-09 14:17:09 +02:00
|
|
|
return JsonValue(createNode());
|
2014-09-27 16:18:40 +02:00
|
|
|
}
|
|
|
|
|
2014-10-09 14:17:09 +02:00
|
|
|
JsonNode* JsonBuffer::createNode()
|
2014-09-27 12:16:20 +02:00
|
|
|
{
|
2014-10-09 14:17:09 +02:00
|
|
|
void* node = allocateNode();
|
2014-09-27 14:43:19 +02:00
|
|
|
if (!node) return 0;
|
2014-10-09 14:17:09 +02:00
|
|
|
|
|
|
|
return new (node) JsonNode();
|
2014-10-14 17:16:21 +02:00
|
|
|
}
|
|
|
|
|
2014-10-14 21:24:26 +02:00
|
|
|
JsonArray JsonBuffer::parseArray(char* json)
|
2014-10-14 17:16:21 +02:00
|
|
|
{
|
2014-10-14 21:24:26 +02:00
|
|
|
JsonParser parser(this, json);
|
2014-10-14 21:48:22 +02:00
|
|
|
return JsonArray(parser.parseAnything());
|
2014-09-27 12:16:20 +02:00
|
|
|
}
|