diff options
Diffstat (limited to 'src/corelib/json/qjsonobject.cpp')
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index 27e51cf4ac..00cc2ddbd3 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -116,6 +116,20 @@ QJsonObject::QJsonObject() } /*! + \fn QJsonObject::QJsonObject(std::initializer_list<QPair<QString, QJsonValue> > args) + \since 5.4 + Constructs a QJsonObject instance initialized from \a args initialization list. + For example: + \code + QJsonObject object + { + {"property1", 1}, + {"property2", 2} + }; + \endcode +*/ + +/*! \internal */ QJsonObject::QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object) @@ -126,6 +140,19 @@ QJsonObject::QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object) d->ref.ref(); } +/*! + This method replaces part of the QJsonObject(std::initializer_list<QPair<QString, QJsonValue>> args) body. + The constructor needs to be inline, but we do not want to leak implementation details + of this class. + \note this method is called for an uninitialized object + \internal + */ + +void QJsonObject::initialize() +{ + d = 0; + o = 0; +} /*! Destroys the object. @@ -254,7 +281,7 @@ bool QJsonObject::isEmpty() const QJsonValue QJsonObject::value(const QString &key) const { if (!d) - return QJsonValue(); + return QJsonValue(QJsonValue::Undefined); bool keyExists; int i = o->indexOf(key, &keyExists); @@ -687,6 +714,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const \sa key() */ +/*! \fn QJsonValueRef *QJsonObject::iterator::operator->() const + + Returns a pointer to a modifiable reference to the current item. +*/ + /*! \fn bool QJsonObject::iterator::operator==(const iterator &other) const \fn bool QJsonObject::iterator::operator==(const const_iterator &other) const @@ -870,6 +902,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const \sa key() */ +/*! \fn QJsonValue *QJsonObject::const_iterator::operator->() const + + Returns a pointer to the current item. +*/ + /*! \fn bool QJsonObject::const_iterator::operator==(const const_iterator &other) const \fn bool QJsonObject::const_iterator::operator==(const iterator &other) const |