mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
42 lines
630 B
C++
42 lines
630 B
C++
#pragma once
|
|
|
|
#include "JsonBuffer.h"
|
|
#include "JsonObject.h"
|
|
|
|
template<int CAPACITY>
|
|
class StaticJsonBuffer //: public JsonBuffer
|
|
{
|
|
public:
|
|
|
|
explicit StaticJsonBuffer()
|
|
: _size(0)
|
|
{
|
|
}
|
|
|
|
virtual ~StaticJsonBuffer() {}
|
|
|
|
JsonObject createObject()
|
|
{
|
|
if (_size < CAPACITY)
|
|
_size++;
|
|
|
|
return JsonObject();
|
|
}
|
|
|
|
int capacity()
|
|
{
|
|
return CAPACITY;
|
|
}
|
|
|
|
int size()
|
|
{
|
|
return _size;
|
|
}
|
|
|
|
protected:
|
|
//virtual JsonNode& allocateNode();
|
|
|
|
private:
|
|
//JsonNode _buffer[CAPACITY];
|
|
int _size;
|
|
}; |