JsonArray is now a simple wrapper on top of JsonValue

This commit is contained in:
Benoît Blanchon
2014-07-17 13:12:12 +02:00
parent f2579397d6
commit 5e1697f47b
9 changed files with 93 additions and 132 deletions

View File

@ -5,7 +5,6 @@
#pragma once
#include "JsonObjectBase.h"
#include "JsonValue.h"
namespace ArduinoJson
@ -14,26 +13,32 @@ namespace ArduinoJson
{
class JsonHashTable;
class JsonArray : public JsonObjectBase
class JsonArray
{
friend class JsonParserBase;
friend class JsonValue;
public:
JsonArray() {}
JsonArray(JsonValue& value)
: value(value)
{
}
bool success()
{
return JsonObjectBase::success() && tokens->type == JSMN_ARRAY;
return value.success();
}
int size()
{
return success() ? tokens[0].size : 0;
return value.size();
}
JsonValue operator[](int index);
JsonValue operator[](int index)
{
return value[index];
}
DEPRECATED int getLength()
{
@ -69,11 +74,7 @@ namespace ArduinoJson
private:
JsonArray(char* json, jsmntok_t* tokens)
: JsonObjectBase(json, tokens)
{
}
JsonValue value;
};
}
}