summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-03-04 09:54:35 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-03-04 19:10:37 +0000
commita0ffdf765e34820b591bcb9d1bee6df0985056cf (patch)
tree2328cacb6547e7de3535a968d234aa84942b445f /src/corelib/tools/qhash.h
parentd57adfe5f375121c3e233465526ee5d9df03e1e9 (diff)
parent2a4b95778993b00499eb94f61a87330fdbadf947 (diff)
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r--src/corelib/tools/qhash.h43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 59883e3968..c87cf56988 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -309,10 +309,10 @@ public:
QList<Key> keys(const T &value) const;
QList<T> values() const;
#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QList<Key> uniqueKeys() const;
- QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QList<T> values(const Key &key) const;
- QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") int count(const Key &key) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QMultiHash for hashes storing multiple values with the same key.") QList<Key> uniqueKeys() const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QMultiHash for hashes storing multiple values with the same key.") QList<T> values(const Key &key) const;
#endif
+ int count(const Key &key) const;
class const_iterator;
@@ -512,8 +512,8 @@ public:
iterator insert(const Key &key, const T &value);
void insert(const QHash &hash);
#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") iterator insertMulti(const Key &key, const T &value);
- QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QHash &unite(const QHash &other);
+ QT_DEPRECATED_VERSION_X_5_15("Use QMultiHash for hashes storing multiple values with the same key.") iterator insertMulti(const Key &key, const T &value);
+ QT_DEPRECATED_VERSION_X_5_15("Use QMultiHash for hashes storing multiple values with the same key.") QHash &unite(const QHash &other);
#endif
// STL compatibility
@@ -711,6 +711,19 @@ Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values() const
}
template <class Key, class T>
+Q_OUTOFLINE_TEMPLATE int QHash<Key, T>::count(const Key &akey) const
+{
+ int cnt = 0;
+ Node *node = *findNode(akey);
+ if (node != e) {
+ do {
+ ++cnt;
+ } while ((node = node->next) != e && node->key == akey);
+ }
+ return cnt;
+}
+
+template <class Key, class T>
Q_INLINE_TEMPLATE const T QHash<Key, T>::operator[](const Key &akey) const
{
return value(akey);
@@ -1053,7 +1066,6 @@ public:
int remove(const Key &key, const T &value);
- int count(const Key &key) const;
int count(const Key &key, const T &value) const;
QList<Key> uniqueKeys() const;
@@ -1207,12 +1219,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values(const Key &akey) const
}
template <class Key, class T>
-Q_OUTOFLINE_TEMPLATE int QHash<Key, T>::count(const Key &akey) const
-{
- return static_cast<const QMultiHash<Key, T> *>(this)->count(akey);
-}
-
-template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::uniqueKeys() const
{
return static_cast<const QMultiHash<Key, T> *>(this)->uniqueKeys();
@@ -1232,19 +1238,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMultiHash<Key, T>::values(const Key &akey) const
return res;
}
-template <class Key, class T>
-Q_OUTOFLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &akey) const
-{
- int cnt = 0;
- Node *node = *findNode(akey);
- if (node != this->e) {
- do {
- ++cnt;
- } while ((node = node->next) != this->e && node->key == akey);
- }
- return cnt;
-}
-
#if !defined(QT_NO_JAVA_STYLE_ITERATORS)
template <class Key, class T>
class QHashIterator