QCborArray: add const_iterator overloads for insert/erase/extract
They return regular iterators, since the container has been modified. Change-Id: Id59bdd8f1a804b809e22fffd153f92d4460f9b76 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
f4950cb6e1
commit
e92e46348a
@ -327,6 +327,9 @@ void QCborArray::insert(qsizetype i, QCborValue &&value)
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QCborValue QCborArray::extract(iterator it)
|
||||
\fn QCborValue QCborArray::extract(const_iterator it)
|
||||
|
||||
Extracts a value from the array at the position indicated by iterator \a it
|
||||
and returns the value so extracted.
|
||||
|
||||
@ -576,6 +579,7 @@ bool QCborArray::contains(const QCborValue &value) const
|
||||
|
||||
/*!
|
||||
\fn QCborArray::iterator QCborArray::insert(iterator before, const QCborValue &value)
|
||||
\fn QCborArray::iterator QCborArray::insert(const_iterator before, const QCborValue &value)
|
||||
\overload
|
||||
|
||||
Inserts \a value into this array before element \a before and returns an
|
||||
@ -586,6 +590,7 @@ bool QCborArray::contains(const QCborValue &value) const
|
||||
|
||||
/*!
|
||||
\fn QCborArray::iterator QCborArray::erase(iterator it)
|
||||
\fn QCborArray::iterator QCborArray::erase(const_iterator it)
|
||||
|
||||
Removes the element pointed to by the array iterator \a it from this array,
|
||||
then returns an iterator to the next element (the one that took the same
|
||||
|
@ -195,6 +195,7 @@ public:
|
||||
void prepend(QCborValue &&value) { insert(0, std::move(value)); }
|
||||
void append(const QCborValue &value) { insert(-1, value); }
|
||||
void append(QCborValue &&value) { insert(-1, std::move(value)); }
|
||||
QCborValue extract(ConstIterator it) { return extract(Iterator{ it.item.d, it.item.i }); }
|
||||
QCborValue extract(Iterator it);
|
||||
void removeAt(qsizetype i);
|
||||
QCborValue takeAt(qsizetype i) { Q_ASSERT(i < size()); return extract(begin() + i); }
|
||||
@ -235,7 +236,10 @@ public:
|
||||
const_iterator cend() const { return constEnd(); }
|
||||
iterator insert(iterator before, const QCborValue &value)
|
||||
{ insert(before.item.i, value); return iterator{d.data(), before.item.i}; }
|
||||
iterator insert(const_iterator before, const QCborValue &value)
|
||||
{ insert(before.item.i, value); return iterator{d.data(), before.item.i}; }
|
||||
iterator erase(iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; }
|
||||
iterator erase(const_iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; }
|
||||
|
||||
void push_back(const QCborValue &t) { append(t); }
|
||||
void push_front(const QCborValue &t) { prepend(t); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user