diff options
| author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-07-23 12:16:42 +0200 |
|---|---|---|
| committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-07-26 18:47:01 +0200 |
| commit | 062bee3a2a93ea09b39affddb12172acd72851ae (patch) | |
| tree | 8a6853678bcf290162949df6f19143f5bef8ba95 /src/corelib/serialization/qjsonobject.cpp | |
| parent | bd3088ceb322381ac33bda11554667f1c9a421f8 (diff) | |
Improve the iterators of QJsonArray and QJsonObject
Remove the fake QJsonValuePtr and QJsonValueRefPtr required for
operator()-> of QJsonArray and QJsonObject iterators.
Task-number: QTBUG-85700
Change-Id: I622a5a426edb13b32f9d00a02c3c148320fbccba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qjsonobject.cpp')
| -rw-r--r-- | src/corelib/serialization/qjsonobject.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp index 6befa9d2eba..beeb3b5a549 100644 --- a/src/corelib/serialization/qjsonobject.cpp +++ b/src/corelib/serialization/qjsonobject.cpp @@ -700,12 +700,10 @@ bool QJsonObject::operator!=(const QJsonObject &other) const */ QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it) { - if (it.o != this || it.i < 0 || it.i >= o->elements.length()) + if (it.item.o != this || it.item.index < 0 || it.item.index >= o->elements.length()) return {this, int(o->elements.length())}; - int index = it.i; - - removeAt(index); + removeAt(it.item.index); // iterator hasn't changed return it; @@ -1233,14 +1231,14 @@ QJsonObject::const_iterator QJsonObject::constFindImpl(T key) const \sa value() */ -/*! \fn QJsonValue QJsonObject::const_iterator::value() const +/*! \fn QJsonValueRef QJsonObject::const_iterator::value() const Returns the current item's value. \sa key(), operator*() */ -/*! \fn QJsonValue QJsonObject::const_iterator::operator*() const +/*! \fn const QJsonValueRef QJsonObject::const_iterator::operator*() const Returns the current item's value. @@ -1249,7 +1247,7 @@ QJsonObject::const_iterator QJsonObject::constFindImpl(T key) const \sa key() */ -/*! \fn QJsonValue *QJsonObject::const_iterator::operator->() const +/*! \fn const QJsonValueRef *QJsonObject::const_iterator::operator->() const Returns a pointer to the current item. */ |
