#include <qmjsonobject.h>
Signals | |
void | itemAdded (const QString &key, const QMPointer< QMJsonValue > &value) |
void | itemRemoved (const QString &key, const QMPointer< QMJsonValue > &value) |
Public Member Functions | |
QMJsonObject () | |
QMJsonObject (const QHash< QString, QMPointer< QMJsonValue > > &hash) | |
virtual | ~QMJsonObject () |
virtual void | reserve (int32_t alloc) |
virtual int32_t | capacity (void) const |
virtual void | squeeze (void) |
virtual void | clear (void) |
virtual int32_t | count (void) const |
virtual int32_t | size (void) const |
virtual bool | isEmpty (void) const |
virtual bool | empty (void) const |
virtual bool | contains (const QString &key) const |
virtual void | insert (const QString &key, const QMPointer< QMJsonValue > &value, QMJsonReplacementPolicy policy=QMJsonReplacementPolicy_Replace) |
template<class T > | |
void | insert (const QString &key, const T &value, QMJsonReplacementPolicy policy=QMJsonReplacementPolicy_Replace) |
virtual void | unite (const QMPointer< QMJsonObject > &object, QMJsonReplacementPolicy replacementPolicy=QMJsonReplacementPolicy_Replace, QMJsonArrayUnitePolicy unitePolicy=QMJsonArrayUnitePolicy_Append) |
virtual void | remove (const QString &key) |
virtual QMPointer< QMJsonValue > | take (const QString &key) |
virtual QMPointer< QMJsonValue > | take (const QString &key, const QMPointer< QMJsonValue > &defaultValue) |
template<class T > | |
QMPointer< QMJsonValue > | take (const QString &key, const T &defaultValue) |
virtual const QString | key (const QMPointer< QMJsonValue > &value) const |
virtual const QString | key (const QMPointer< QMJsonValue > &value, const QString &defaultValue) const |
virtual QHash< QString, QMPointer< QMJsonValue > >::iterator | begin (void) |
virtual QHash< QString, QMPointer< QMJsonValue > >::iterator | end (void) |
virtual QHash< QString, QMPointer< QMJsonValue > >::const_iterator | cbegin (void) const |
virtual QHash< QString, QMPointer< QMJsonValue > >::const_iterator | cend (void) const |
virtual const QHash< QString, QMPointer< QMJsonValue > >::iterator | erase (const QHash< QString, QMPointer< QMJsonValue > >::iterator &iter) |
virtual QHash< QString, QMPointer< QMJsonValue > >::iterator | find (const QString &key) |
virtual const QHash< QString, QMPointer< QMJsonValue > >::const_iterator | cfind (const QString &key) const |
virtual const QMPointer< QMJsonValue > & | value (const QString &key) const |
virtual const QMPointer< QMJsonValue > & | value (const QString &key, const QMPointer< QMJsonValue > &defaultValue) const |
template<class T > | |
QMPointer< QMJsonValue > | value (const QString &key, const T &defaultValue) const |
virtual QList< QString > | keys (void) const |
virtual QList< QMPointer< QMJsonValue > > | values (void) const |
virtual QHash< QString, QMPointer< QMJsonValue > > | hash (void) const |
virtual bool | isNull (const QString &key) const |
virtual bool | isBool (const QString &key) const |
virtual bool | isDouble (const QString &key) const |
virtual bool | isString (const QString &key) const |
virtual bool | isArray (const QString &key) const |
virtual bool | isObject (const QString &key) const |
template<class T > | |
bool | is (const QString &key) const |
virtual bool | toBool (const QString &key) const |
virtual double | toDouble (const QString &key) const |
virtual QString | toString (const QString &key) const |
virtual const QMPointer< QMJsonArray > & | toArray (const QString &key) const |
virtual const QMPointer< QMJsonObject > & | toObject (const QString &key) const |
virtual bool | toBool (const QString &key, bool defaultValue) const |
virtual double | toDouble (const QString &key, double defaultValue) const |
virtual const QString & | toString (const QString &key, const QString &defaultValue) const |
virtual const QMPointer< QMJsonArray > & | toArray (const QString &key, const QMPointer< QMJsonArray > &defaultValue) const |
virtual const QMPointer< QMJsonObject > & | toObject (const QString &key, const QMPointer< QMJsonObject > &defaultValue) const |
template<class T > | |
const T & | to (const QString &key, const T &defaultValue) const |
virtual bool | fromBool (const QString &key, bool value) |
virtual bool | fromDouble (const QString &key, double value) |
virtual bool | fromString (const QString &key, const QString &value) |
virtual bool | fromArray (const QString &key, const QMPointer< QMJsonArray > &value) |
virtual bool | fromObject (const QString &key, const QMPointer< QMJsonObject > &value) |
virtual bool | from (const QString &key, const QMPointer< QMJsonValue > &value) |
template<class T > | |
bool | from (const QString &key, const T &value) |
Definition at line 35 of file qmjsonobject.h.
QMJsonObject::QMJsonObject | ( | ) |
Default constructor, creates an empty QMJsonObject
Definition at line 33 of file qmjsonobject.cpp.
|
explicit |
Overloaded constructor, create a QMJsonObject and fills it with the QMJsonValues provided in hash
Definition at line 41 of file qmjsonobject.cpp.
|
virtual |
Definition at line 37 of file qmjsonobject.cpp.
|
virtual |
Definition at line 46 of file qmjsonobject.cpp.
|
virtual |
Definition at line 51 of file qmjsonobject.cpp.
|
virtual |
Definition at line 56 of file qmjsonobject.cpp.
|
virtual |
Clears the QMJsonObject
Definition at line 61 of file qmjsonobject.cpp.
|
virtual |
Returns the number of QMJsonValues in the QMJsonObject
Definition at line 80 of file qmjsonobject.cpp.
|
virtual |
Returns the number of QMJsonValues in the QMJsonObject
Definition at line 85 of file qmjsonobject.cpp.
|
virtual |
Returns true if the QMJsonObject is empty
Definition at line 90 of file qmjsonobject.cpp.
|
virtual |
Returns true if the QMJsonObject is empty
Definition at line 95 of file qmjsonobject.cpp.
|
virtual |
Returns true if the QMJsonObject contains an item with the key. Otherwise returns false.
Definition at line 100 of file qmjsonobject.cpp.
|
virtual |
Inserts value into the QMJsonObject with key. If the QMJsonObject alreday contains key, and policy is set to QMJsonReplacementPolicy_Replace, the existing QMJsonValue is replaced. If policy is set to QMJsonReplacementPolicy_Ignore, this operation is ignored.
Wraps value in a QMJsonValue and inserts it into the QMJsonObject with key. If the QMJsonObject alreday contains key, and policy is set to QMJsonReplacementPolicy_Replace, the existing QMJsonValue is replaced. If policy is set to QMJsonReplacementPolicy_Ignore, this operation is ignored.
Definition at line 105 of file qmjsonobject.cpp.
void QMJsonObject::insert | ( | const QString & | key, |
const T & | value, | ||
QMJsonReplacementPolicy | policy = QMJsonReplacementPolicy_Replace |
||
) |
Definition at line 138 of file qmjsonobject.h.
|
virtual |
Unites this QMJsonObject with object by inserting all the QMJsonValues in object into this QMJsonObject. If the QMJsonObject alreday contains a QMJsonValue with the same key and replacementPolicy is set to QMJsonReplacementPolicy_Replace, the existing QMJsonValue is replaced. If replacementPolicy is set to QMJsonReplacementPolicy_Ignore, the insertion is ignored. If a QMJsonArray is encountered in both objects with the same key, QMJsonArray::unite is called, and unitePolicy is passed as the unite policy.
Definition at line 139 of file qmjsonobject.cpp.
|
virtual |
Removes the QMJsonValue at key. If the QMJsonObject does not contain a QMJsonValue with key, this operation is ignored.
Definition at line 179 of file qmjsonobject.cpp.
|
virtual |
Removes the QMJsonValue at key and returns the removed QMJsonValue. If the QMJsonObject does not contain a QMJsonValue with key, this operation returns a newly constructed, default QMJsonValue
Definition at line 189 of file qmjsonobject.cpp.
|
virtual |
Removes the QMJsonValue at key and returns the removed QMJsonValue. If the QMJsonObject does not contain a QMJsonValue with key, this operation returns defaultValue
Definition at line 201 of file qmjsonobject.cpp.
template< class T > QMPointer< QMJsonValue > QMJsonObject::take | ( | const QString & | key, |
const T & | defaultValue | ||
) |
Removes the QMJsonValue at key and returns the removed QMJsonValue. If the QMJsonObject does not contain a QMJsonValue with key, this operation returns defaultValue wrapped in a QMJsonValue
Definition at line 144 of file qmjsonobject.h.
|
virtual |
Returns the key associated with value. If the QMJsonObject does not contain value, a default constructed QString is returned.
Definition at line 213 of file qmjsonobject.cpp.
|
virtual |
Returns the key associated with value. If the QMJsonObject does not contain value, defaultValue is returned.
Definition at line 218 of file qmjsonobject.cpp.
|
virtual |
Returns an STL-style iterator pointing to the first QMJsonValue in the QMJsonObject.
Definition at line 223 of file qmjsonobject.cpp.
|
virtual |
Returns an STL-style iterator pointing to the last QMJsonValue in the QMJsonObject.
Definition at line 228 of file qmjsonobject.cpp.
|
virtual |
Returns an STL-style const iterator pointing to the first QMJsonValue in the QMJsonObject.
Definition at line 233 of file qmjsonobject.cpp.
|
virtual |
Returns an STL-style const iterator pointing to the last QMJsonValue in the QMJsonObject.
Definition at line 238 of file qmjsonobject.cpp.
|
virtual |
Removes the QMJsonValue associated with iter from the QMJsonObject, and returns an iterator to the next item in the QMJsonObject.
Definition at line 243 of file qmjsonobject.cpp.
|
virtual |
Returns the interator associated with key in the QMJsonObject. If no iterator is found, QMJsonObject::end is returned.
Definition at line 257 of file qmjsonobject.cpp.
|
virtual |
Returns the const interator associated with key in the QMJsonObject. If no iterator is found, QMJsonObject::cend is returned.
Definition at line 262 of file qmjsonobject.cpp.
|
virtual |
Returns the value associated with key. If the QMJsonObject does not contain key, a default constructed QMJsonValue is returned.
Definition at line 267 of file qmjsonobject.cpp.
|
virtual |
Returns the value associated with key. If the QMJsonObject does not contain key, defaultValue is returned.
Definition at line 278 of file qmjsonobject.cpp.
template< class T > QMPointer< QMJsonValue > QMJsonObject::value | ( | const QString & | key, |
const T & | defaultValue | ||
) | const |
Returns the value associated with key. If the QMJsonObject does not contain key, defaultValue is wrapped in a QMJsonValue and returned.
Definition at line 157 of file qmjsonobject.h.
|
virtual |
Returns a QList containing all of the keys in the QMJsonObject
Definition at line 288 of file qmjsonobject.cpp.
|
virtual |
Returns a QList containing all of the QMJsonValues in the QMJsonObject
Definition at line 293 of file qmjsonobject.cpp.
|
virtual |
Returns the internal QHash of QMJsonObject
Definition at line 298 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a "null".
Definition at line 303 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a boolean
Definition at line 313 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a double.
Definition at line 323 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a string.
Definition at line 333 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a JSON array
Definition at line 343 of file qmjsonobject.cpp.
|
virtual |
Returns true if the wrapped JSON value at key is a JSON object
Definition at line 353 of file qmjsonobject.cpp.
bool QMJsonObject::is | ( | const QString & | key | ) | const |
Returns true if the wrapped JSON value at key is of type T. This function is ment to be used with custom, complex types as show below:
Definition at line 168 of file qmjsonobject.h.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. Depending on what type the JSON value is, will dictate what is returned:
Definition at line 363 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. Depending on what type the JSON value is, will dictate what is returned:
Definition at line 368 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. Depending on what type the JSON value is, will dictate what is returned:
Definition at line 373 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns a QMJsonArray. If the internal type is not a QMJsonArray, an empty QMJsonArray is returned.
Definition at line 378 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns a QMJsonObject. If the internal type is not a QMJsonObject, an empty QMJsonObject is returned.
Definition at line 383 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not a boolean, the default value is returned instead.
Definition at line 388 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not a double, the default value is returned instead.
Definition at line 393 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not a string, the default value is returned instead.
Definition at line 398 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not an array, the default value is returned instead.
Definition at line 403 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not an object, the default value is returned instead.
Definition at line 408 of file qmjsonobject.cpp.
const T & QMJsonObject::to | ( | const QString & | key, |
const T & | defaultValue | ||
) | const |
Unwraps the JSON value at key and returns the interanl type. If the interal type is not of type T, the default value is returned instead. This function is ment to be used with custom, complex types as show below:
Definition at line 179 of file qmjsonobject.h.
|
virtual |
Unwraps the JSON value at key and sets the interanl type. Depending on what type the JSON value is, will dictate what the internal type is set to:
Definition at line 413 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and sets the interanl type. Depending on what type the JSON value is, will dictate what the internal type is set to:
Definition at line 418 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and sets the interanl type. Depending on what type the JSON value is, will dictate what the internal type is set to:
Definition at line 423 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and sets the internal type to a QMJsonArray. If the internal type is not a QMJsonArray, the request is ignored
Definition at line 428 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and sets the internal type to a QMJsonObject. If the internal type is not a QMJsonObject, the request is ignored
Definition at line 433 of file qmjsonobject.cpp.
|
virtual |
Unwraps the JSON value at key and sets the interanl type. Depending on what type the JSON value is, will dictate what the internal type is set to:
Definition at line 438 of file qmjsonobject.cpp.
bool QMJsonObject::from | ( | const QString & | key, |
const T & | value | ||
) |
Unwraps the JSON value at key and sets the interanl type. If the interal type is not of type T, the request is ignored. This function is ment to be used with custom, complex types as show below:
Definition at line 185 of file qmjsonobject.h.
|
signal |
|
signal |