diff options
Diffstat (limited to 'src/corelib/tools/qmap.cpp')
-rw-r--r-- | src/corelib/tools/qmap.cpp | 335 |
1 files changed, 207 insertions, 128 deletions
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 29534bdeee..d7844f3128 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -509,7 +509,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMapIterator, QMutableMapIterator, QHash, QSet */ -/*! \fn QMap::QMap() +/*! \fn template <class Key, class T> QMap<Key, T>::QMap() Constructs an empty map. @@ -517,7 +517,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn QMap::QMap(QMap<Key, T> &&other) + \fn template <class Key, class T> QMap<Key, T>::QMap(QMap<Key, T> &&other) Move-constructs a QMap instance, making it point at the same object that \a other was pointing to. @@ -525,7 +525,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \since 5.2 */ -/*! \fn QMap::QMap(const QMap<Key, T> &other) +/*! \fn template <class Key, class T> QMap<Key, T>::QMap(const QMap<Key, T> &other) Constructs a copy of \a other. @@ -537,14 +537,14 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator=() */ -/*! \fn QMap::QMap(const std::map<Key, T> & other) +/*! \fn template <class Key, class T> QMap<Key, T>::QMap(const std::map<Key, T> & other) Constructs a copy of \a other. \sa toStdMap() */ -/*! \fn QMap::QMap(std::initializer_list<std::pair<Key,T> > list) +/*! \fn template <class Key, class T> QMap<Key, T>::QMap(std::initializer_list<std::pair<Key,T> > list) \since 5.1 Constructs a map with a copy of each of the elements in the @@ -554,45 +554,45 @@ void QMapDataBase::freeData(QMapDataBase *d) compiled in C++11 mode. */ -/*! \fn std::map<Key, T> QMap::toStdMap() const +/*! \fn template <class Key, class T> std::map<Key, T> QMap<Key, T>::toStdMap() const Returns an STL map equivalent to this QMap. */ -/*! \fn QMap::~QMap() +/*! \fn template <class Key, class T> QMap<Key, T>::~QMap() Destroys the map. References to the values in the map, and all iterators over this map, become invalid. */ -/*! \fn QMap<Key, T> &QMap::operator=(const QMap<Key, T> &other) +/*! \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other) Assigns \a other to this map and returns a reference to this map. */ /*! - \fn QMap<Key, T> &QMap::operator=(QMap<Key, T> &&other) + \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::operator=(QMap<Key, T> &&other) Move-assigns \a other to this QMap instance. \since 5.2 */ -/*! \fn void QMap::swap(QMap<Key, T> &other) +/*! \fn template <class Key, class T> void QMap<Key, T>::swap(QMap<Key, T> &other) \since 4.8 Swaps map \a other with this map. This operation is very fast and never fails. */ -/*! \fn void QMultiMap::swap(QMultiMap<Key, T> &other) +/*! \fn template <class Key, class T> void QMultiMap<Key, T>::swap(QMultiMap<Key, T> &other) \since 4.8 Swaps map \a other with this map. This operation is very fast and never fails. */ -/*! \fn bool QMap::operator==(const QMap<Key, T> &other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const Returns \c true if \a other is equal to this map; otherwise returns false. @@ -606,7 +606,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator!=() */ -/*! \fn bool QMap::operator!=(const QMap<Key, T> &other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::operator!=(const QMap<Key, T> &other) const Returns \c true if \a other is not equal to this map; otherwise returns \c false. @@ -620,7 +620,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator==() */ -/*! \fn int QMap::size() const +/*! \fn template <class Key, class T> int QMap<Key, T>::size() const Returns the number of (key, value) pairs in the map. @@ -628,7 +628,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn bool QMap::isEmpty() const + \fn template <class Key, class T> bool QMap<Key, T>::isEmpty() const Returns \c true if the map contains no items; otherwise returns false. @@ -636,7 +636,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa size() */ -/*! \fn void QMap::detach() +/*! \fn template <class Key, class T> void QMap<Key, T>::detach() \internal @@ -646,7 +646,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa isDetached() */ -/*! \fn bool QMap::isDetached() const +/*! \fn template <class Key, class T> bool QMap<Key, T>::isDetached() const \internal @@ -656,24 +656,24 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa detach() */ -/*! \fn void QMap::setSharable(bool sharable) +/*! \fn template <class Key, class T> void QMap<Key, T>::setSharable(bool sharable) \internal */ -/*! \fn bool QMap::isSharedWith(const QMap<Key, T> &other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::isSharedWith(const QMap<Key, T> &other) const \internal */ -/*! \fn void QMap::clear() +/*! \fn template <class Key, class T> void QMap<Key, T>::clear() Removes all items from the map. \sa remove() */ -/*! \fn int QMap::remove(const Key &key) +/*! \fn template <class Key, class T> int QMap<Key, T>::remove(const Key &key) Removes all the items that have the key \a key from the map. Returns the number of items removed which is usually 1 but will be @@ -683,7 +683,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa clear(), take(), QMultiMap::remove() */ -/*! \fn T QMap::take(const Key &key) +/*! \fn template <class Key, class T> T QMap<Key, T>::take(const Key &key) Removes the item with the key \a key from the map and returns the value associated with it. @@ -698,7 +698,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa remove() */ -/*! \fn bool QMap::contains(const Key &key) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::contains(const Key &key) const Returns \c true if the map contains an item with key \a key; otherwise returns \c false. @@ -706,7 +706,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa count(), QMultiMap::contains() */ -/*! \fn const T QMap::value(const Key &key, const T &defaultValue) const +/*! \fn template <class Key, class T> const T QMap<Key, T>::value(const Key &key, const T &defaultValue) const Returns the value associated with the key \a key. @@ -719,7 +719,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa key(), values(), contains(), operator[]() */ -/*! \fn T &QMap::operator[](const Key &key) +/*! \fn template <class Key, class T> T &QMap<Key, T>::operator[](const Key &key) Returns the value associated with the key \a key as a modifiable reference. @@ -733,14 +733,14 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insert(), value() */ -/*! \fn const T QMap::operator[](const Key &key) const +/*! \fn template <class Key, class T> const T QMap<Key, T>::operator[](const Key &key) const \overload Same as value(). */ -/*! \fn QList<Key> QMap::uniqueKeys() const +/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::uniqueKeys() const \since 4.2 Returns a list containing all the keys in the map in ascending @@ -751,7 +751,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa keys(), values() */ -/*! \fn QList<Key> QMap::keys() const +/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys() const Returns a list containing all the keys in the map in ascending order. Keys that occur multiple times in the map (because items @@ -766,7 +766,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa uniqueKeys(), values(), key() */ -/*! \fn QList<Key> QMap::keys(const T &value) const +/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys(const T &value) const \overload @@ -779,7 +779,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn Key QMap::key(const T &value, const Key &defaultKey) const + \fn template <class Key, class T> Key QMap<Key, T>::key(const T &value, const Key &defaultKey) const \since 4.3 \overload @@ -795,7 +795,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa value(), keys() */ -/*! \fn QList<T> QMap::values() const +/*! \fn template <class Key, class T> QList<T> QMap<Key, T>::values() const Returns a list containing all the values in the map, in ascending order of their keys. If a key is associated with multiple values, @@ -805,7 +805,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa keys(), value() */ -/*! \fn QList<T> QMap::values(const Key &key) const +/*! \fn template <class Key, class T> QList<T> QMap<Key, T>::values(const Key &key) const \overload @@ -816,21 +816,21 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa count(), insertMulti() */ -/*! \fn int QMap::count(const Key &key) const +/*! \fn template <class Key, class T> int QMap<Key, T>::count(const Key &key) const Returns the number of items associated with key \a key. \sa contains(), insertMulti(), QMultiMap::count() */ -/*! \fn int QMap::count() const +/*! \fn template <class Key, class T> int QMap<Key, T>::count() const \overload Same as size(). */ -/*! \fn QMap::iterator QMap::begin() +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::begin() Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the map. @@ -838,12 +838,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa constBegin(), end() */ -/*! \fn QMap::const_iterator QMap::begin() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::begin() const \overload */ -/*! \fn QMap::const_iterator QMap::cbegin() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::cbegin() const \since 5.0 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item @@ -852,7 +852,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa begin(), cend() */ -/*! \fn QMap::const_iterator QMap::constBegin() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constBegin() const Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the map. @@ -860,7 +860,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa begin(), constEnd() */ -/*! \fn QMap::key_iterator QMap::keyBegin() const +/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::keyBegin() const \since 5.6 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first key @@ -869,7 +869,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa keyEnd(), firstKey() */ -/*! \fn QMap::iterator QMap::end() +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::end() Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the map. @@ -877,12 +877,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa begin(), constEnd() */ -/*! \fn QMap::const_iterator QMap::end() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::end() const \overload */ -/*! \fn QMap::const_iterator QMap::cend() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::cend() const \since 5.0 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary @@ -891,7 +891,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa cbegin(), end() */ -/*! \fn QMap::const_iterator QMap::constEnd() const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constEnd() const Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the map. @@ -899,7 +899,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa constBegin(), end() */ -/*! \fn QMap::key_iterator QMap::keyEnd() const +/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::keyEnd() const \since 5.6 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary @@ -908,7 +908,62 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa keyBegin(), lastKey() */ -/*! \fn const Key &QMap::firstKey() const + +/*! \fn template <class Key, class T> QMap<Key, T>::key_value_iterator QMap<Key, T>::keyValueBegin() + \since 5.10 + + Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first entry + in the map. + + \sa keyValueEnd() +*/ + +/*! \fn template <class Key, class T> QMap<Key, T>::key_value_iterator QMap<Key, T>::keyValueEnd() + \since 5.10 + + Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + entry after the last entry in the map. + + \sa keyValueBegin() +*/ + +/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::keyValueBegin() const + \since 5.10 + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry + in the map. + + \sa keyValueEnd() +*/ + +/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::constKeyValueBegin() const + \since 5.10 + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry + in the map. + + \sa keyValueBegin() +*/ + +/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::keyValueEnd() const + \since 5.10 + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + entry after the last entry in the map. + + \sa keyValueBegin() +*/ + +/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::constKeyValueEnd() const + \since 5.10 + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + entry after the last entry in the map. + + \sa constKeyValueBegin() +*/ + +/*! \fn template <class Key, class T> const Key &QMap<Key, T>::firstKey() const \since 5.2 Returns a reference to the smallest key in the map. @@ -919,7 +974,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa lastKey(), first(), keyBegin(), isEmpty() */ -/*! \fn const Key &QMap::lastKey() const +/*! \fn template <class Key, class T> const Key &QMap<Key, T>::lastKey() const \since 5.2 Returns a reference to the largest key in the map. @@ -930,7 +985,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa firstKey(), last(), keyEnd(), isEmpty() */ -/*! \fn T &QMap::first() +/*! \fn template <class Key, class T> T &QMap<Key, T>::first() \since 5.2 Returns a reference to the first value in the map, that is the value mapped @@ -941,13 +996,13 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa last(), firstKey(), isEmpty() */ -/*! \fn const T &QMap::first() const +/*! \fn template <class Key, class T> const T &QMap<Key, T>::first() const \since 5.2 \overload */ -/*! \fn T &QMap::last() +/*! \fn template <class Key, class T> T &QMap<Key, T>::last() \since 5.2 Returns a reference to the last value in the map, that is the value mapped @@ -958,13 +1013,13 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa first(), lastKey(), isEmpty() */ -/*! \fn const T &QMap::last() const +/*! \fn template <class Key, class T> const T &QMap<Key, T>::last() const \since 5.2 \overload */ -/*! \fn QMap::iterator QMap::erase(iterator pos) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::erase(iterator pos) Removes the (key, value) pair pointed to by the iterator \a pos from the map, and returns an iterator to the next item in the @@ -973,7 +1028,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa remove() */ -/*! \fn QMap::iterator QMap::find(const Key &key) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::find(const Key &key) Returns an iterator pointing to the item with key \a key in the map. @@ -992,12 +1047,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa constFind(), value(), values(), lowerBound(), upperBound(), QMultiMap::find() */ -/*! \fn QMap::const_iterator QMap::find(const Key &key) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::find(const Key &key) const \overload */ -/*! \fn QMap::const_iterator QMap::constFind(const Key &key) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &key) const \since 4.1 Returns an const iterator pointing to the item with key \a key in the @@ -1009,7 +1064,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa find(), QMultiMap::constFind() */ -/*! \fn QMap::iterator QMap::lowerBound(const Key &key) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &key) Returns an iterator pointing to the first item with key \a key in the map. If the map contains no item with key \a key, the @@ -1030,12 +1085,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa upperBound(), find() */ -/*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &key) const \overload */ -/*! \fn QMap::iterator QMap::upperBound(const Key &key) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &key) Returns an iterator pointing to the item that immediately follows the last item with key \a key in the map. If the map contains no @@ -1048,12 +1103,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa lowerBound(), find() */ -/*! \fn QMap::const_iterator QMap::upperBound(const Key &key) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::upperBound(const Key &key) const \overload */ -/*! \fn QMap::iterator QMap::insert(const Key &key, const T &value) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &key, const T &value) Inserts a new item with the key \a key and a value of \a value. @@ -1066,7 +1121,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insertMulti() */ -/*! \fn QMap::iterator QMap::insert(const_iterator pos, const Key &key, const T &value) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const Key &key, const T &value) \overload \since 5.1 Inserts a new item with the key \a key and value \a value and with hint \a pos @@ -1095,7 +1150,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insertMulti() */ -/*! \fn QMap::iterator QMap::insertMulti(const Key &key, const T &value) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &key, const T &value) Inserts a new item with the key \a key and a value of \a value. @@ -1107,7 +1162,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insert(), values() */ -/*! \fn QMap::iterator QMap::insertMulti(const_iterator pos, const Key &key, const T &value) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &key, const T &value) \overload \since 5.1 Inserts a new item with the key \a key and value \a value and with hint \a pos @@ -1127,7 +1182,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ -/*! \fn QMap<Key, T> &QMap::unite(const QMap<Key, T> &other) +/*! \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other) Inserts all the items in the \a other map into this map. If a key is common to both maps, the resulting map will contain the @@ -1138,12 +1193,12 @@ void QMapDataBase::freeData(QMapDataBase *d) /*! \typedef QMap::Iterator - Qt-style synonym for QMap::iterator. + Qt-style synonym for QMap<Key, T>::iterator. */ /*! \typedef QMap::ConstIterator - Qt-style synonym for QMap::const_iterator. + Qt-style synonym for QMap<Key, T>::const_iterator. */ /*! \typedef QMap::difference_type @@ -1167,7 +1222,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn bool QMap::empty() const + \fn template <class Key, class T> bool QMap<Key, T>::empty() const This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the map is empty; otherwise @@ -1175,14 +1230,14 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn QPair<iterator, iterator> QMap::equal_range(const Key &key) + \fn template <class Key, class T> QPair<typename QMap<Key, T>::iterator, typename QMap<Key, T>::iterator> QMap<Key, T>::equal_range(const Key &key) Returns a pair of iterators delimiting the range of values \c{[first, second)}, that are stored under \a key. */ /*! - \fn QPair<const_iterator, const_iterator> QMap::equal_range(const Key &key) const + \fn template <class Key, class T> QPair<typename QMap<Key, T>::const_iterator, typename QMap<Key, T>::const_iterator> QMap<Key, T>::equal_range(const Key &key) const \overload \since 5.6 */ @@ -1284,7 +1339,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \internal */ -/*! \fn QMap::iterator::iterator() +/*! \fn template <class Key, class T> QMap<Key, T>::iterator::iterator() Constructs an uninitialized iterator. @@ -1295,12 +1350,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::begin(), QMap::end() */ -/*! \fn QMap::iterator::iterator(Node *) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator::iterator(Node *) \internal */ -/*! \fn const Key &QMap::iterator::key() const +/*! \fn template <class Key, class T> const Key &QMap<Key, T>::iterator::key() const Returns the current item's key as a const reference. @@ -1311,7 +1366,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa value() */ -/*! \fn T &QMap::iterator::value() const +/*! \fn template <class Key, class T> T &QMap<Key, T>::iterator::value() const Returns a modifiable reference to the current item's value. @@ -1323,7 +1378,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa key(), operator*() */ -/*! \fn T &QMap::iterator::operator*() const +/*! \fn template <class Key, class T> T &QMap<Key, T>::iterator::operator*() const Returns a modifiable reference to the current item's value. @@ -1332,7 +1387,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa key() */ -/*! \fn T *QMap::iterator::operator->() const +/*! \fn template <class Key, class T> T *QMap<Key, T>::iterator::operator->() const Returns a pointer to the current item's value. @@ -1340,8 +1395,8 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn bool QMap::iterator::operator==(const iterator &other) const - \fn bool QMap::iterator::operator==(const const_iterator &other) const + \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &other) const + \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. @@ -1350,8 +1405,8 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn bool QMap::iterator::operator!=(const iterator &other) const - \fn bool QMap::iterator::operator!=(const const_iterator &other) const + \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator!=(const iterator &other) const + \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator!=(const const_iterator &other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. @@ -1359,7 +1414,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator==() */ -/*! \fn QMap::iterator QMap::iterator::operator++() +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator++() The prefix ++ operator (\c{++i}) advances the iterator to the next item in the map and returns an iterator to the new current @@ -1370,7 +1425,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator--() */ -/*! \fn QMap::iterator QMap::iterator::operator++(int) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator++(int) \overload @@ -1379,7 +1434,7 @@ void QMapDataBase::freeData(QMapDataBase *d) current item. */ -/*! \fn QMap::iterator QMap::iterator::operator--() +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator--() The prefix -- operator (\c{--i}) makes the preceding item current and returns an iterator pointing to the new current item. @@ -1390,7 +1445,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator++() */ -/*! \fn QMap::iterator QMap::iterator::operator--(int) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator--(int) \overload @@ -1399,7 +1454,7 @@ void QMapDataBase::freeData(QMapDataBase *d) current item. */ -/*! \fn QMap::iterator QMap::iterator::operator+(int j) const +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator+(int j) const Returns an iterator to the item at \a j positions forward from this iterator. (If \a j is negative, the iterator goes backward.) @@ -1410,7 +1465,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ -/*! \fn QMap::iterator QMap::iterator::operator-(int j) const +/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator-(int j) const Returns an iterator to the item at \a j positions backward from this iterator. (If \a j is negative, the iterator goes forward.) @@ -1420,7 +1475,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator+() */ -/*! \fn QMap::iterator &QMap::iterator::operator+=(int j) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator &QMap<Key, T>::iterator::operator+=(int j) Advances the iterator by \a j items. (If \a j is negative, the iterator goes backward.) @@ -1428,7 +1483,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator-=(), operator+() */ -/*! \fn QMap::iterator &QMap::iterator::operator-=(int j) +/*! \fn template <class Key, class T> QMap<Key, T>::iterator &QMap<Key, T>::iterator::operator-=(int j) Makes the iterator go back by \a j items. (If \a j is negative, the iterator goes forward.) @@ -1507,7 +1562,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \internal */ -/*! \fn QMap::const_iterator::const_iterator() +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator() Constructs an uninitialized iterator. @@ -1518,31 +1573,31 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::constBegin(), QMap::constEnd() */ -/*! \fn QMap::const_iterator::const_iterator(const Node *) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator(const Node *) \internal */ -/*! \fn QMap::const_iterator::const_iterator(const iterator &other) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator(const iterator &other) Constructs a copy of \a other. */ -/*! \fn const Key &QMap::const_iterator::key() const +/*! \fn template <class Key, class T> const Key &QMap<Key, T>::const_iterator::key() const Returns the current item's key. \sa value() */ -/*! \fn const T &QMap::const_iterator::value() const +/*! \fn template <class Key, class T> const T &QMap<Key, T>::const_iterator::value() const Returns the current item's value. \sa key(), operator*() */ -/*! \fn const T &QMap::const_iterator::operator*() const +/*! \fn template <class Key, class T> const T &QMap<Key, T>::const_iterator::operator*() const Returns the current item's value. @@ -1551,14 +1606,14 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa key() */ -/*! \fn const T *QMap::const_iterator::operator->() const +/*! \fn template <class Key, class T> const T *QMap<Key, T>::const_iterator::operator->() const Returns a pointer to the current item's value. \sa value() */ -/*! \fn bool QMap::const_iterator::operator==(const const_iterator &other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::const_iterator::operator==(const const_iterator &other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. @@ -1566,7 +1621,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator!=() */ -/*! \fn bool QMap::const_iterator::operator!=(const const_iterator &other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::const_iterator::operator!=(const const_iterator &other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. @@ -1574,7 +1629,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator==() */ -/*! \fn QMap::const_iterator QMap::const_iterator::operator++() +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator++() The prefix ++ operator (\c{++i}) advances the iterator to the next item in the map and returns an iterator to the new current @@ -1585,7 +1640,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator--() */ -/*! \fn QMap::const_iterator QMap::const_iterator::operator++(int) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator++(int) \overload @@ -1594,7 +1649,7 @@ void QMapDataBase::freeData(QMapDataBase *d) current item. */ -/*! \fn QMap::const_iterator &QMap::const_iterator::operator--() +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator--() The prefix -- operator (\c{--i}) makes the preceding item current and returns an iterator pointing to the new current item. @@ -1605,7 +1660,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator++() */ -/*! \fn QMap::const_iterator QMap::const_iterator::operator--(int) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator--(int) \overload @@ -1614,7 +1669,7 @@ void QMapDataBase::freeData(QMapDataBase *d) current item. */ -/*! \fn QMap::const_iterator QMap::const_iterator::operator+(int j) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator+(int j) const Returns an iterator to the item at \a j positions forward from this iterator. (If \a j is negative, the iterator goes backward.) @@ -1624,7 +1679,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator-() */ -/*! \fn QMap::const_iterator QMap::const_iterator::operator-(int j) const +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator-(int j) const Returns an iterator to the item at \a j positions backward from this iterator. (If \a j is negative, the iterator goes forward.) @@ -1634,7 +1689,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator+() */ -/*! \fn QMap::const_iterator &QMap::const_iterator::operator+=(int j) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator+=(int j) Advances the iterator by \a j items. (If \a j is negative, the iterator goes backward.) @@ -1644,7 +1699,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator-=(), operator+() */ -/*! \fn QMap::const_iterator &QMap::const_iterator::operator-=(int j) +/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator-=(int j) Makes the iterator go back by \a j items. (If \a j is negative, the iterator goes forward.) @@ -1711,17 +1766,17 @@ void QMapDataBase::freeData(QMapDataBase *d) \internal */ -/*! \fn const T &QMap::key_iterator::operator*() const +/*! \fn template <class Key, class T> const T &QMap<Key, T>::key_iterator::operator*() const Returns the current item's key. */ -/*! \fn const T *QMap::key_iterator::operator->() const +/*! \fn template <class Key, class T> const T *QMap<Key, T>::key_iterator::operator->() const Returns a pointer to the current item's key. */ -/*! \fn bool QMap::key_iterator::operator==(key_iterator other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::key_iterator::operator==(key_iterator other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. @@ -1729,7 +1784,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator!=() */ -/*! \fn bool QMap::key_iterator::operator!=(key_iterator other) const +/*! \fn template <class Key, class T> bool QMap<Key, T>::key_iterator::operator!=(key_iterator other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. @@ -1738,7 +1793,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn QMap::key_iterator &QMap::key_iterator::operator++() + \fn template <class Key, class T> QMap<Key, T>::key_iterator &QMap<Key, T>::key_iterator::operator++() The prefix ++ operator (\c{++i}) advances the iterator to the next item in the hash and returns an iterator to the new current @@ -1749,7 +1804,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator--() */ -/*! \fn QMap::key_iterator QMap::key_iterator::operator++(int) +/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::key_iterator::operator++(int) \overload @@ -1758,7 +1813,7 @@ void QMapDataBase::freeData(QMapDataBase *d) item. */ -/*! \fn QMap::key_iterator &QMap::key_iterator::operator--() +/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator &QMap<Key, T>::key_iterator::operator--() The prefix -- operator (\c{--i}) makes the preceding item current and returns an iterator pointing to the new current item. @@ -1769,7 +1824,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator++() */ -/*! \fn QMap::key_iterator QMap::key_iterator::operator--(int) +/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::key_iterator::operator--(int) \overload @@ -1778,11 +1833,35 @@ void QMapDataBase::freeData(QMapDataBase *d) item. */ -/*! \fn const_iterator QMap::key_iterator::base() const +/*! \fn template <class Key, class T> const_iterator QMap<Key, T>::key_iterator::base() const Returns the underlying const_iterator this key_iterator is based on. */ -/*! \fn QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map) +/*! \typedef QMap::const_key_value_iterator + \inmodule QtCore + \since 5.10 + \brief The QMap::const_key_value_iterator typedef provides an STL-style iterator for QMap and QMultiMap. + + QMap::const_key_value_iterator is essentially the same as QMap::const_iterator + with the difference that operator*() returns a key/value pair instead of a + value. + + \sa QKeyValueIterator +*/ + +/*! \typedef QMap::key_value_iterator + \inmodule QtCore + \since 5.10 + \brief The QMap::key_value_iterator typedef provides an STL-style iterator for QMap and QMultiMap. + + QMap::key_value_iterator is essentially the same as QMap::iterator + with the difference that operator*() returns a key/value pair instead of a + value. + + \sa QKeyValueIterator +*/ + +/*! \fn template <class Key, class T> QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map) \relates QMap Writes the map \a map to stream \a out. @@ -1793,7 +1872,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa{Serializing Qt Data Types}{Format of the QDataStream operators} */ -/*! \fn QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map) +/*! \fn template <class Key, class T> QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map) \relates QMap Reads a map from stream \a in into \a map. @@ -1859,12 +1938,12 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap, QMapIterator, QMutableMapIterator, QMultiHash */ -/*! \fn QMultiMap::QMultiMap() +/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap() Constructs an empty map. */ -/*! \fn QMultiMap::QMultiMap(std::initializer_list<std::pair<Key,T> > list) +/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap(std::initializer_list<std::pair<Key,T> > list) \since 5.1 Constructs a multi-map with a copy of each of the elements in the @@ -1874,7 +1953,7 @@ void QMapDataBase::freeData(QMapDataBase *d) compiled in C++11 mode. */ -/*! \fn QMultiMap::QMultiMap(const QMap<Key, T> &other) +/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap(const QMap<Key, T> &other) Constructs a copy of \a other (which can be a QMap or a QMultiMap). @@ -1882,7 +1961,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator=() */ -/*! \fn QMultiMap::iterator QMultiMap::replace(const Key &key, const T &value) +/*! \fn template <class Key, class T> QMultiMap<Key, T>::iterator QMultiMap<Key, T>::replace(const Key &key, const T &value) Inserts a new item with the key \a key and a value of \a value. @@ -1895,7 +1974,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insert() */ -/*! \fn QMultiMap::iterator QMultiMap::insert(const Key &key, const T &value) +/*! \fn template <class Key, class T> QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const Key &key, const T &value) Inserts a new item with the key \a key and a value of \a value. @@ -1907,7 +1986,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa replace() */ -/*! \fn QMultiMap::iterator QMultiMap::insert(QMap<Key, T>::const_iterator pos, const Key &key, const T &value) +/*! \fn template <class Key, class T> typename QMap<Key, T>::iterator QMultiMap<Key, T>::insert(typename QMap<Key, T>::const_iterator pos, const Key &key, const T &value) \since 5.1 Inserts a new item with the key \a key and value \a value and with hint \a pos @@ -1924,7 +2003,7 @@ void QMapDataBase::freeData(QMapDataBase *d) crash but there is also a risk that it will silently corrupt both the map and the \a pos map. */ -/*! \fn QMultiMap &QMultiMap::operator+=(const QMultiMap &other) +/*! \fn template <class Key, class T> QMultiMap &QMultiMap<Key, T>::operator+=(const QMultiMap &other) Inserts all the items in the \a other map into this map and returns a reference to this map. @@ -1932,7 +2011,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insert(), operator+() */ -/*! \fn QMultiMap QMultiMap::operator+(const QMultiMap &other) const +/*! \fn template <class Key, class T> QMultiMap QMultiMap<Key, T>::operator+(const QMultiMap &other) const Returns a map that contains all the items in this map in addition to all the items in \a other. If a key is common to both @@ -1942,7 +2021,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn bool QMultiMap::contains(const Key &key, const T &value) const + \fn template <class Key, class T> bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const \since 4.3 Returns \c true if the map contains an item with key \a key and @@ -1952,7 +2031,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn int QMultiMap::remove(const Key &key, const T &value) + \fn template <class Key, class T> int QMultiMap<Key, T>::remove(const Key &key, const T &value) \since 4.3 Removes all the items that have the key \a key and the value \a @@ -1962,7 +2041,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn int QMultiMap::count(const Key &key, const T &value) const + \fn template <class Key, class T> int QMultiMap<Key, T>::count(const Key &key, const T &value) const \since 4.3 Returns the number of items with key \a key and value \a value. @@ -1971,7 +2050,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn typename QMap<Key, T>::iterator QMultiMap::find(const Key &key, const T &value) + \fn template <class Key, class T> typename QMap<Key, T>::iterator QMultiMap<Key, T>::find(const Key &key, const T &value) \since 4.3 Returns an iterator pointing to the item with key \a key and @@ -1987,7 +2066,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn typename QMap<Key, T>::const_iterator QMultiMap::find(const Key &key, const T &value) const + \fn template <class Key, class T> typename QMap<Key, T>::const_iterator QMultiMap<Key, T>::find(const Key &key, const T &value) const \since 4.3 \overload @@ -2004,7 +2083,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! - \fn typename QMap<Key, T>::const_iterator QMultiMap::constFind(const Key &key, const T &value) const + \fn template <class Key, class T> typename QMap<Key, T>::const_iterator QMultiMap<Key, T>::constFind(const Key &key, const T &value) const \since 4.3 Returns an iterator pointing to the item with key \a key and the |