summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborarray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/serialization/qcborarray.cpp')
-rw-r--r--src/corelib/serialization/qcborarray.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/serialization/qcborarray.cpp b/src/corelib/serialization/qcborarray.cpp
index a1b0d1573c..e35738adcc 100644
--- a/src/corelib/serialization/qcborarray.cpp
+++ b/src/corelib/serialization/qcborarray.cpp
@@ -298,6 +298,9 @@ QCborValue QCborArray::at(qsizetype i) const
*/
/*!
+ \fn void QCborArray::insert(qsizetype i, const QCborValue &value)
+ \fn void QCborArray::insert(qsizetype i, QCborValue &&value)
+
Inserts \a value into the array at position \a i in this array. The array
must have at least \a i elements before the insertion.
@@ -313,6 +316,16 @@ void QCborArray::insert(qsizetype i, const QCborValue &value)
d->insertAt(i, value);
}
+void QCborArray::insert(qsizetype i, QCborValue &&value)
+{
+ Q_ASSERT(size_t(i) <= size_t(size()) || i == -1);
+ if (i < 0)
+ i = size();
+ detach(qMax(i + 1, size()));
+ d->insertAt(i, value, QCborContainerPrivate::MoveContainer);
+ QCborContainerPrivate::resetValue(value);
+}
+
/*!
Extracts a value from the array at the position indicated by iterator \a it
and returns the value so extracted.
@@ -330,6 +343,7 @@ QCborValue QCborArray::extract(iterator it)
/*!
\fn void QCborArray::prepend(const QCborValue &value)
+ \fn void QCborArray::prepend(QCborValue &&value)
Prepends \a value into the array before any other elements it may already
contain.
@@ -340,6 +354,7 @@ QCborValue QCborArray::extract(iterator it)
/*!
\fn void QCborArray::append(const QCborValue &value)
+ \fn void QCborArray::append(QCborValue &&value)
Appends \a value into the array after all other elements it may already
contain.