summaryrefslogtreecommitdiffstats
path: root/src/corelib/json
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/json')
-rw-r--r--src/corelib/json/qjsonarray.cpp25
-rw-r--r--src/corelib/json/qjsonarray.h8
2 files changed, 33 insertions, 0 deletions
diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp
index d81de89628..61bb158ff5 100644
--- a/src/corelib/json/qjsonarray.cpp
+++ b/src/corelib/json/qjsonarray.cpp
@@ -188,6 +188,31 @@ QJsonArray &QJsonArray::operator =(const QJsonArray &other)
return *this;
}
+/*! \fn QJsonArray &QJsonArray::operator+=(const QJsonValue &value)
+
+ Appends \a value to the array, and returns a reference to the array itself.
+
+ \since 5.3
+ \sa append(), operator<<()
+*/
+
+/*! \fn QJsonArray QJsonArray::operator+(const QJsonValue &value) const
+
+ Returns an array that contains all the items in this array followed
+ by the provided \a value.
+
+ \since 5.3
+ \sa operator+=()
+*/
+
+/*! \fn QJsonArray &QJsonArray::operator<<(const QJsonValue &value)
+
+ Appends \a value to the array, and returns a reference to the array itself.
+
+ \since 5.3
+ \sa operator+=(), append()
+*/
+
/*!
Converts the string list \a list to a QJsonArray.
diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h
index 562e6accd7..84c162f0a0 100644
--- a/src/corelib/json/qjsonarray.h
+++ b/src/corelib/json/qjsonarray.h
@@ -183,6 +183,14 @@ public:
typedef iterator Iterator;
typedef const_iterator ConstIterator;
+ // convenience
+ inline QJsonArray operator+(const QJsonValue &v) const
+ { QJsonArray n = *this; n += v; return n; }
+ inline QJsonArray &operator+=(const QJsonValue &v)
+ { append(v); return *this; }
+ inline QJsonArray &operator<< (const QJsonValue &v)
+ { append(v); return *this; }
+
// stl compatibility
inline void push_back(const QJsonValue &t) { append(t); }
inline void push_front(const QJsonValue &t) { prepend(t); }