2014-10-05 14:40:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "JsonContainer.h"
|
|
|
|
|
|
|
|
class JsonArray : public JsonContainer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
JsonArray()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit JsonArray(JsonNode* node)
|
|
|
|
: JsonContainer(node)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-10-05 14:55:14 +02:00
|
|
|
JsonValue operator[](int index) const;
|
2014-10-05 14:40:03 +02:00
|
|
|
|
2014-10-05 14:48:19 +02:00
|
|
|
template<typename T>
|
|
|
|
void add(T value)
|
|
|
|
{
|
2014-10-05 14:55:14 +02:00
|
|
|
JsonNode* node = createNode(JSON_UNDEFINED);
|
|
|
|
if (!node) return;
|
|
|
|
|
|
|
|
JsonValue jsonValue(node);
|
|
|
|
jsonValue = value;
|
|
|
|
|
|
|
|
addChild(node);
|
2014-10-05 14:48:19 +02:00
|
|
|
}
|
2014-10-05 14:40:03 +02:00
|
|
|
};
|
|
|
|
|