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

@ -8,29 +8,6 @@
using namespace ArduinoJson::Parser;
/*
* Returns the token for the value at the specified index
*/
JsonValue JsonArray::operator[](int index)
{
// sanity check
if (!success() || index < 0 || index >= tokens[0].size)
return JsonValue();
// skip first token, it's the whole object
jsmntok_t* currentToken = tokens + 1;
// skip all tokens before the specified index
for (int i = 0; i < index; i++)
{
// move forward: current + nested tokens
currentToken += 1 + getNestedTokenCount(currentToken);
}
return JsonValue(json, currentToken);
}
DEPRECATED JsonHashTable JsonArray::getHashTable(int index)
{
return (JsonHashTable) (*this)[index];