Epic refactoring int progress...

This commit is contained in:
Benoit Blanchon
2014-10-27 22:50:50 +01:00
parent 8988cb4761
commit 852256c1af
34 changed files with 334 additions and 256 deletions

View File

@ -6,6 +6,12 @@
#include "ArduinoJson/JsonBuffer.hpp"
#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"
#include "ArduinoJson/Internals/JsonParser.hpp"
using namespace ArduinoJson;
@ -13,5 +19,32 @@ using namespace ArduinoJson::Internals;
// TODO: what happens if alloc returns NULL
void* operator new(size_t size, ArduinoJson::JsonBuffer* buffer) {
return _buffer->alloc(size);
return buffer->alloc(size);
}
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());
}