forked from bblanchon/ArduinoJson
Test that CreateObject() returns an empty JsonObject
This commit is contained in:
42
srcs/JsonObject.h
Normal file
42
srcs/JsonObject.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
class JsonBuffer;
|
||||
struct JsonNode;
|
||||
class JsonValue;
|
||||
|
||||
class JsonObject
|
||||
{
|
||||
// friend class JsonValue;
|
||||
//
|
||||
//public:
|
||||
// JsonObject(JsonBuffer& buffer, JsonNode& node)
|
||||
// : _buffer(buffer), _node(node)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// JsonObject createObject(const char* key)
|
||||
// {
|
||||
// JsonObject innerObject = _buffer.createObject();
|
||||
// addNodeAt(key, innerObject._node);
|
||||
// return innerObject;
|
||||
// }
|
||||
//
|
||||
// JsonValue& operator[](const char* key);
|
||||
|
||||
public:
|
||||
|
||||
int size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//private:
|
||||
// JsonBuffer& _buffer;
|
||||
// JsonNode& _node;
|
||||
//
|
||||
// void addNodeAt(char const* key, JsonNode& node);
|
||||
// JsonNode& getNodeAt(const char* key);
|
||||
//
|
||||
// // TODO: pull up
|
||||
// void appendChild(JsonNode& newChild);
|
||||
};
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "JsonBuffer.h"
|
||||
#include "JsonObject.h"
|
||||
|
||||
template<int CAPACITY>
|
||||
class StaticJsonBuffer //: public JsonBuffer
|
||||
@ -14,11 +15,12 @@ public:
|
||||
|
||||
virtual ~StaticJsonBuffer() {}
|
||||
|
||||
/*JsonObject*/
|
||||
void createObject()
|
||||
JsonObject createObject()
|
||||
{
|
||||
if (_size < CAPACITY)
|
||||
_size++;
|
||||
|
||||
return JsonObject();
|
||||
}
|
||||
|
||||
int capacity()
|
||||
|
@ -65,6 +65,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="JsonObject.h" />
|
||||
<ClInclude Include="StaticJsonBuffer.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
@ -18,5 +18,8 @@
|
||||
<ClInclude Include="StaticJsonBuffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="JsonObject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user