Files
ArduinoJson/srcs/StaticJsonBuffer.h

42 lines
630 B
C
Raw Normal View History

2014-09-27 09:56:53 +02:00
#pragma once
#include "JsonBuffer.h"
#include "JsonObject.h"
2014-09-27 09:56:53 +02:00
template<int CAPACITY>
class StaticJsonBuffer //: public JsonBuffer
{
public:
2014-09-27 09:58:34 +02:00
explicit StaticJsonBuffer()
: _size(0)
{
}
2014-09-27 09:56:53 +02:00
virtual ~StaticJsonBuffer() {}
JsonObject createObject()
2014-09-27 11:33:18 +02:00
{
if (_size < CAPACITY)
_size++;
return JsonObject();
2014-09-27 11:33:18 +02:00
}
2014-09-27 10:16:30 +02:00
2014-09-27 09:56:53 +02:00
int capacity()
{
return CAPACITY;
}
int size()
{
return _size;
}
protected:
//virtual JsonNode& allocateNode();
private:
//JsonNode _buffer[CAPACITY];
int _size;
};