Added comments

This commit is contained in:
Benoit Blanchon
2014-07-21 15:20:02 +02:00
parent d3d0da2d7f
commit df72419f09
3 changed files with 36 additions and 20 deletions

View File

@ -14,73 +14,89 @@ namespace ArduinoJson
{
class JsonArray;
// A JSON Object (ie hash-table/dictionary)
class JsonObject : JsonValue
{
public:
// Create an invalid JsonObject
JsonObject()
{
}
// Convert a JsonValue into a JsonObject
JsonObject(JsonValue value)
: JsonValue(value)
{
}
// Tell if the object is valid
bool success()
{
return isObject();
}
// Get the value associated with the specified key.
JsonValue operator[](const char* key)
{
return JsonValue::operator[](key);
}
// Tell if the specified key exists in the object.
bool containsKey(const char* key)
{
return operator[](key).success();
}
// Get an iterator pointing at the beginning of the object
JsonObjectIterator begin()
{
return isObject() ? firstChild() : null();
}
// Get an iterator pointing at the end of the object
JsonObjectIterator end()
{
return isObject() ? nextSibling() : null();
}
// Obsolete: Use operator[] instead
DEPRECATED JsonArray getArray(const char* key);
// Obsolete: Use operator[] instead
DEPRECATED bool getBool(const char* key)
{
return operator[](key);
}
// Obsolete: Use operator[] instead
DEPRECATED double getDouble(const char* key)
{
return operator[](key);
}
// Obsolete: Use operator[] instead
DEPRECATED JsonObject getHashTable(const char* key)
{
return operator[](key);
}
// Obsolete: Use operator[] instead
DEPRECATED long getLong(const char* key)
{
return operator[](key);
}
// Obsolete: Use operator[] instead
DEPRECATED char* getString(const char* key)
{
return operator[](key);
}
};
// Obsolete: Use JsonObject instead
typedef JsonObject JsonHashTable;
}
}