Open Lighting Architecture
0.9.4
|
A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python.
If the same key is added more than once, the latest value wins.
Public Member Functions | |
JsonObject () | |
Create a new JsonObject. | |
JsonValue * | LookupElementWithIter (JsonPointer::Iterator *iter) |
Lookup the Value referred to by the Iterator. | |
bool | operator== (const JsonValue &other) const |
Equality operator. | |
bool | Equals (const JsonObject &other) const |
Check if this JsonValue equals a JsonObject. | |
void | Add (const std::string &key, const std::string &value) |
Add a key to string mapping. | |
void | Add (const std::string &key, const char *value) |
Set the given key to a string value. | |
void | Add (const std::string &key, unsigned int i) |
Set the given key to a unsigned int value. | |
void | Add (const std::string &key, int i) |
Set the given key to a int value. | |
void | Add (const std::string &key, double d) |
Set the given key to a double value. | |
void | Add (const std::string &key, bool value) |
Set the given key to a bool value. | |
void | Add (const std::string &key) |
Set the given key to a null value. | |
JsonObject * | AddObject (const std::string &key) |
Set the given key to a JsonObject. | |
class JsonArray * | AddArray (const std::string &key) |
Set the given key to a JsonArray. | |
void | AddValue (const std::string &key, JsonValue *value) |
Set the key to the supplied JsonValue. | |
void | AddRaw (const std::string &key, const std::string &value) |
Set the given key to a raw value. | |
bool | Remove (const std::string &key) |
Remove the JsonValue with the specified key. | |
bool | ReplaceValue (const std::string &key, JsonValue *value) |
Replace the key with the supplied JsonValue. | |
void | Accept (JsonValueVisitorInterface *visitor) |
The Accept method for the visitor pattern. | |
void | Accept (JsonValueConstVisitorInterface *visitor) const |
The Accept (const) method for the visitor pattern. | |
JsonValue * | Clone () const |
Make a copy of this JsonValue. | |
bool | IsEmpty () const |
Check if there are properties within the object. | |
unsigned int | Size () const |
void | VisitProperties (JsonObjectPropertyVisitor *visitor) const |
Visit each of the properties in this object. | |
Public Member Functions inherited from ola::web::JsonValue | |
virtual JsonValue * | LookupElement (const JsonPointer &pointer) |
Locate the JsonValue referred to by the JSON Pointer. | |
virtual bool | operator!= (const JsonValue &other) const |
Not-equals operator. |
|
inlinevirtual |
The Accept method for the visitor pattern.
This can be used to traverse the Json Tree in a type-safe manner.
Implements ola::web::JsonValue.
|
inlinevirtual |
The Accept (const) method for the visitor pattern.
This can be used to traverse the Json Tree in a type-safe manner.
Implements ola::web::JsonValue.
void ola::web::JsonObject::Add | ( | const std::string & | key, |
const std::string & | value | ||
) |
Add a key to string mapping.
key | the key to set. |
value | the value to add. |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
const char * | value | ||
) |
Set the given key to a string value.
key | the key to set. |
value | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
unsigned int | i | ||
) |
Set the given key to a unsigned int value.
key | the key to set. |
i | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
int | i | ||
) |
Set the given key to a int value.
key | the key to set. |
i | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
double | d | ||
) |
Set the given key to a double value.
key | the key to set. |
d | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
bool | value | ||
) |
Set the given key to a bool value.
key | the key to set. |
value | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key | ) |
Set the given key to a null value.
key | the key to set. |
JsonArray * ola::web::JsonObject::AddArray | ( | const std::string & | key | ) |
JsonObject * ola::web::JsonObject::AddObject | ( | const std::string & | key | ) |
void ola::web::JsonObject::AddRaw | ( | const std::string & | key, |
const std::string & | value | ||
) |
Set the given key to a raw value.
key | the key to add |
value | the raw value to append. |
void ola::web::JsonObject::AddValue | ( | const std::string & | key, |
JsonValue * | value | ||
) |
|
virtual |
Check if this JsonValue equals a JsonObject.
Reimplemented from ola::web::JsonValue.
|
inline |
Check if there are properties within the object.
|
virtual |
Lookup the Value referred to by the Iterator.
This is used by recursively by JsonValue classes. You should call LookupElement() instead.
Implements ola::web::JsonValue.
|
inlinevirtual |
Equality operator.
This implements equality as defined in section 3.6 of the JSON Schema Core document.
Implements ola::web::JsonValue.
bool ola::web::JsonObject::Remove | ( | const std::string & | key | ) |
Remove the JsonValue with the specified key.
key | the key to remove |
bool ola::web::JsonObject::ReplaceValue | ( | const std::string & | key, |
JsonValue * | value | ||
) |
void ola::web::JsonObject::VisitProperties | ( | JsonObjectPropertyVisitor * | visitor | ) | const |
Visit each of the properties in this object.
For each property : value, the visitor is called.