diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2013-09-16 21:00:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 09:05:56 +0200 |
commit | 4c83183e711fb61d10f7c2475cbdbb04c4c36802 (patch) | |
tree | 076f90700a8428b386c225a0864fd08a499383da /src/corelib/kernel | |
parent | 09f9c6e1b9b5f0c2e8066444600106d41301bc6b (diff) |
MetaType: Add assignment operator to the container iterators.
Change-Id: Ib4f2197a0ab6bd41c91de667cd3087fb40e44097
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 20 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index c3ccc74a20..ec90c4ceef 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3508,6 +3508,10 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p) Creates a copy of \a other. */ +/*! \fn QSequentialIterable::const_iterator::const_iterator& QSequentialIterable::const_iterator::operator=(const const_iterator &other) + Assigns \a other to this. +*/ + /*! \fn QVariant QSequentialIterable::const_iterator::operator*() const Returns the current item, converted to a QVariant. @@ -3684,6 +3688,10 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p) Creates a copy of \a other. */ +/*! \fn QAssociativeIterable::const_iterator::const_iterator& QAssociativeIterable::const_iterator::operator=(const const_iterator &other) + Assigns \a other to this. +*/ + /*! \fn QVariant QAssociativeIterable::const_iterator::operator*() const Returns the current value, converted to a QVariant. diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 1f35850043..b6d5c1aebd 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -602,6 +602,16 @@ public: ref->ref(); } + inline const_iterator& operator=(const const_iterator &other) + { + if (!m_impl.equal(other.m_impl)) { + m_impl = other.m_impl; + ref = other.ref; + } + ref->ref(); + return *this; + } + inline const QVariant operator*() const { const QtMetaTypePrivate::VariantData d = m_impl.getCurrent(); if (d.metaTypeId == qMetaTypeId<QVariant>()) @@ -671,6 +681,16 @@ public: ref->ref(); } + inline const_iterator& operator=(const const_iterator &other) + { + if (!m_impl.equal(other.m_impl)) { + m_impl = other.m_impl; + ref = other.ref; + } + ref->ref(); + return *this; + } + inline const QVariant key() const { const QtMetaTypePrivate::VariantData d = m_impl.getCurrentKey(); QVariant v(d.metaTypeId, d.data, d.flags); |