2014-10-23 23:39:22 +02:00
|
|
|
// Copyright Benoit Blanchon 2014
|
|
|
|
// MIT License
|
|
|
|
//
|
|
|
|
// Arduino JSON library
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
|
2014-10-19 15:46:36 +02:00
|
|
|
#include "ArduinoJson/JsonBuffer.hpp"
|
2014-10-16 16:25:42 +02:00
|
|
|
|
2014-10-27 22:50:50 +01:00
|
|
|
#include "ArduinoJson/JsonArray.hpp"
|
|
|
|
#include "ArduinoJson/Internals/JsonArrayImpl.hpp"
|
|
|
|
#include "ArduinoJson/JsonObject.hpp"
|
|
|
|
#include "ArduinoJson/Internals/JsonObjectImpl.hpp"
|
|
|
|
#include "ArduinoJson/JsonValue.hpp"
|
|
|
|
#include "ArduinoJson/Internals/JsonValueImpl.hpp"
|
2014-10-19 15:46:36 +02:00
|
|
|
#include "ArduinoJson/Internals/JsonParser.hpp"
|
2014-10-16 16:25:42 +02:00
|
|
|
|
2014-10-18 23:05:54 +02:00
|
|
|
using namespace ArduinoJson;
|
|
|
|
using namespace ArduinoJson::Internals;
|
|
|
|
|
2014-10-27 13:34:54 +01:00
|
|
|
// TODO: what happens if alloc returns NULL
|
|
|
|
void* operator new(size_t size, ArduinoJson::JsonBuffer* buffer) {
|
2014-10-27 22:50:50 +01:00
|
|
|
return buffer->alloc(size);
|
2014-10-23 23:45:36 +02:00
|
|
|
}
|
2014-10-27 22:50:50 +01:00
|
|
|
|
|
|
|
JsonArray JsonBuffer::createArray() {
|
|
|
|
return JsonArray(new (this) JsonArrayImpl(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonObject JsonBuffer::createObject() {
|
|
|
|
return JsonObject(new (this) JsonObjectImpl(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonValue JsonBuffer::createValue() {
|
|
|
|
return JsonValue(new (this) JsonValueImpl());
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonArray JsonBuffer::parseArray(char* json) {
|
|
|
|
JsonParser parser(this, json);
|
|
|
|
return JsonArray(parser.parseArray());
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonObject JsonBuffer::parseObject(char* json) {
|
|
|
|
JsonParser parser(this, json);
|
|
|
|
return JsonObject(parser.parseObject());
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonValue JsonBuffer::parseValue(char* json) {
|
|
|
|
JsonParser parser(this, json);
|
|
|
|
return JsonValue(parser.parseValue());
|
|
|
|
}
|