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