summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjsonobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/json/qjsonobject.h')
-rw-r--r--src/corelib/json/qjsonobject.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h
index ad3184b1f2..92dd19af5e 100644
--- a/src/corelib/json/qjsonobject.h
+++ b/src/corelib/json/qjsonobject.h
@@ -44,6 +44,10 @@
#include <QtCore/qjsonvalue.h>
#include <QtCore/qiterator.h>
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+#include <QtCore/qpair.h>
+#include <initializer_list>
+#endif
QT_BEGIN_NAMESPACE
@@ -55,6 +59,16 @@ class Q_CORE_EXPORT QJsonObject
{
public:
QJsonObject();
+
+#if defined(Q_COMPILER_INITIALIZER_LISTS) || defined(Q_QDOC)
+ QJsonObject(std::initializer_list<QPair<QString, QJsonValue> > args)
+ {
+ initialize();
+ for (std::initializer_list<QPair<QString, QJsonValue> >::const_iterator i = args.begin(); i != args.end(); ++i)
+ insert(i->first, i->second);
+ }
+#endif
+
~QJsonObject();
QJsonObject(const QJsonObject &other);
@@ -195,6 +209,7 @@ private:
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &);
QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object);
+ void initialize();
void detach(uint reserve = 0);
void compact();