Moved implemntation of operator[] into JsonObject

This commit is contained in:
Benoit Blanchon
2014-07-21 10:52:35 +02:00
parent f565a9b1b7
commit 3e8861b1a0
5 changed files with 69 additions and 73 deletions

View File

@ -11,26 +11,4 @@ using namespace ArduinoJson::Parser;
DEPRECATED JsonObject JsonArray::getHashTable(int index)
{
return operator[](index);
}
/*
* Returns the token for the value at the specified index
*/
JsonValue JsonArray::operator[](int index)
{
// sanity check
if (index < 0 || !isArray() || index >= size())
return null();
// skip first token, it's the whole object
JsonToken runningToken = firstChild();
// skip all tokens before the specified index
for (int i = 0; i < index; i++)
{
// move forward: current + nested tokens
runningToken = runningToken.nextSibling();
}
return runningToken;
}