Files
ArduinoJson/srcs/JsonBuffer.cpp

36 lines
590 B
C++
Raw Normal View History

#include "JsonBuffer.h"
2014-10-09 14:17:09 +02:00
#include <new>
#include "JsonValue.h"
#include "Internals/JsonNode.h"
JsonValue JsonBuffer::createValue()
{
2014-10-09 14:17:09 +02:00
return JsonValue(createNode());
}
2014-10-09 14:17:09 +02:00
JsonNode* JsonBuffer::createNode()
{
2014-10-09 14:17:09 +02:00
void* node = allocateNode();
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 17:28:57 +02:00
JsonArray JsonBuffer::parseArray(const char* json)
2014-10-14 17:16:21 +02:00
{
2014-10-14 17:28:57 +02:00
JsonNode* root;
if (json[0] == '[')
{
root = createNode();
root->setAsArray(this);
}
else
{
root = 0;
}
return JsonArray(root);
}