mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
Don't use JsonBuffer to create or parse objects and arrays.
* Added DynamicJsonArray and StaticJsonArray * Added DynamicJsonObject and StaticJsonObject * Added DynamicJsonVariant and StaticJsonVariant * Added deserializeJson() * Removed JsonBuffer::parseArray(), parseObject() and parse() * Removed JsonBuffer::createArray() and createObject()
This commit is contained in:
27
src/ArduinoJson/DynamicJsonArray.hpp
Normal file
27
src/ArduinoJson/DynamicJsonArray.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
// ArduinoJson - arduinojson.org
|
||||
// Copyright Benoit Blanchon 2014-2018
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DynamicJsonBuffer.hpp"
|
||||
#include "JsonArray.hpp"
|
||||
|
||||
namespace ArduinoJson {
|
||||
class DynamicJsonArray : public JsonArray {
|
||||
DynamicJsonBuffer _buffer;
|
||||
|
||||
public:
|
||||
DynamicJsonArray() : JsonArray(&_buffer) {}
|
||||
DynamicJsonArray(size_t capacity)
|
||||
: JsonArray(&_buffer), _buffer(capacity - sizeof(JsonArray)) {}
|
||||
|
||||
size_t memoryUsage() const {
|
||||
return _buffer.size() + sizeof(JsonArray);
|
||||
}
|
||||
|
||||
DynamicJsonBuffer& buffer() {
|
||||
return _buffer;
|
||||
}
|
||||
};
|
||||
} // namespace ArduinoJson
|
||||
Reference in New Issue
Block a user