Test that adding values to the JsonObject increase the size of the buffer

This commit is contained in:
Benoit Blanchon
2014-09-27 12:16:20 +02:00
parent 4d4119e589
commit 166bdd6919
8 changed files with 74 additions and 17 deletions

View File

@ -4,8 +4,10 @@
#include "JsonObject.h"
template<int CAPACITY>
class StaticJsonBuffer //: public JsonBuffer
class StaticJsonBuffer : public JsonBuffer
{
friend JsonObject;
public:
explicit StaticJsonBuffer()
@ -15,14 +17,6 @@ public:
virtual ~StaticJsonBuffer() {}
JsonObject createObject()
{
if (_size < CAPACITY)
_size++;
return JsonObject();
}
int capacity()
{
return CAPACITY;
@ -34,7 +28,11 @@ public:
}
protected:
//virtual JsonNode& allocateNode();
virtual /*JsonNode&*/void allocateNode()
{
if (_size < CAPACITY)
_size++;
}
private:
//JsonNode _buffer[CAPACITY];