Undeprecate QHash::count(Key)
For compatibility with std::unordered_map. Spotted in the API review. Change-Id: Ic34600d55baebcbbf115c1090cd555984037c44c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
c3fc9a24d8
commit
f4fca8697f
@ -1574,7 +1574,6 @@ uint qHash(long double key, uint seed) noexcept
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> int QHash<Key, T>::count(const Key &key) const
|
||||
\obsolete
|
||||
|
||||
Returns the number of items associated with the \a key.
|
||||
|
||||
@ -2693,13 +2692,6 @@ uint qHash(long double key, uint seed) noexcept
|
||||
\sa QHash::remove()
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> int QMultiHash<Key, T>::count(const Key &key) const
|
||||
|
||||
Returns the number of items associated with the \a key.
|
||||
|
||||
\sa contains(), insert()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <class Key, class T> int QMultiHash<Key, T>::count(const Key &key, const T &value) const
|
||||
\since 4.3
|
||||
|
@ -314,8 +314,8 @@ public:
|
||||
#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;
|
||||
#endif
|
||||
int count(const Key &key) const;
|
||||
|
||||
class const_iterator;
|
||||
|
||||
@ -729,6 +729,19 @@ Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values() const
|
||||
return res;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
@ -1072,7 +1085,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;
|
||||
@ -1225,12 +1237,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values(const Key &akey) const
|
||||
return static_cast<const QMultiHash<Key, T> *>(this)->values(akey);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
@ -1251,19 +1257,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
|
||||
|
Loading…
Reference in New Issue
Block a user