Member Function Documentation
QJsonObject::QJsonObject()
Constructs an empty JSON object
See also isEmpty().
QJsonObject::QJsonObject(const QJsonObject & other)
Creates a copy of other.
Since QJsonObject is implicitly shared, the copy is shallow as long as the object does not get modified.
QJsonObject::~QJsonObject()
Destroys the object.
iterator QJsonObject::begin()
Returns an STL-style iterator pointing to the first item in the object.
See also constBegin() and end().
This is an overloaded function.
const_iterator QJsonObject::constBegin() const
Returns a const STL-style iterator pointing to the first item in the object.
See also begin() and constEnd().
const_iterator QJsonObject::constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the object.
See also constBegin() and end().
const_iterator QJsonObject::constFind(const QString & key) const
Returns an const iterator pointing to the item with key key in the map.
If the map contains no item with key key, the function returns constEnd().
bool QJsonObject::contains(const QString & key) const
Returns true if the object contains key key.
See also insert(), remove(), and take().
int QJsonObject::count() const
This is an overloaded function.
Same as size().
bool QJsonObject::empty() const
This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the object is empty; otherwise returning false.
iterator QJsonObject::end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the object.
See also begin() and constEnd().
This is an overloaded function.
Removes the (key, value) pair pointed to by the iterator it from the map, and returns an iterator to the next item in the map.
See also remove().
iterator QJsonObject::find(const QString & key)
Returns an iterator pointing to the item with key key in the map.
If the map contains no item with key key, the function returns end().
This is an overloaded function.
QJsonObject QJsonObject::fromVariantMap(const QVariantMap & map) [static]
Converts the variant map map to a QJsonObject.
The keys in map will be used as the keys in the JSON object, and the QVariant values will be converted to JSON values.
See also toVariantMap() and QJsonValue::fromVariant().
Inserts a new item with the key key and a value of value.
If there is already an item with the key key then that item's value is replaced with value.
Returns an iterator pointing to the inserted item.
If the value is QJsonValue::Undefined, it will cause the key to get removed from the object. The returned iterator will then point to end()
See also remove(), take(), QJsonObject::iterator, and end().
bool QJsonObject::isEmpty() const
Returns true if the object is empty. This is the same as size() == 0.
See also size().
QStringList QJsonObject::keys() const
Returns a list of all keys in this object.
int QJsonObject::length() const
This is an overloaded function.
Same as size().
void QJsonObject::remove(const QString & key)
Removes key from the object.
See also insert() and take().
int QJsonObject::size() const
Returns the the number of (key, value) pairs stored in the object.
Removes key from the object.
Returns a QJsonValue containing the value referenced by key. If key was not contained in the object, the returned QJsonValue is Undefined.
See also insert(), remove(), and QJsonValue.
QVariantMap QJsonObject::toVariantMap() const
Converts this object to a QVariantMap.
Returns the created map.
QJsonValue QJsonObject::value(const QString & key) const
Returns a QJsonValue representing the value for the key key.
The returned QJsonValue is Undefined, if the key does not exist.
See also QJsonValue and QJsonValue::isUndefined().
bool QJsonObject::operator!=(const QJsonObject & other) const
Returns true if other is not equal to this object
QJsonObject & QJsonObject::operator=(const QJsonObject & other)
Assigns other to this object.
bool QJsonObject::operator==(const QJsonObject & other) const
Returns true if other is equal to this object
QJsonValue QJsonObject::operator[](const QString & key) const
Returns a QJsonValue representing the value for the key key.
This does the same as value().
The returned QJsonValue is Undefined, if the key does not exist.
See also value(), QJsonValue, and QJsonValue::isUndefined().
QJsonValueRef QJsonObject::operator[](const QString & key)
Returns a reference to the value for key.
The return value is of type QJsonValueRef, a helper class for QJsonArray and QJsonObject. When you get an object of type QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference.
See also value().