Made JsonValue inherit from JsonObjectBase

This commit is contained in:
Benoît Blanchon
2014-07-16 13:41:00 +02:00
parent d189bd7140
commit 6a868e46bd
7 changed files with 61 additions and 73 deletions

View File

@ -10,20 +10,13 @@
using namespace ArduinoJson::Parser;
JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
: JsonObjectBase(json, tokens)
{
if (tokens == 0 || tokens[0].type != JSMN_OBJECT)
makeInvalid();
}
/*
* Returns the token for the value associated with the specified key
*/
JsonValue JsonHashTable::operator [](const char* desiredKey)
{
// sanity check
if (json == 0 || tokens == 0 || desiredKey == 0)
if (!success() || desiredKey == 0)
return JsonValue();
// skip first token, it's the whole object