Change qHash() to work with size_t instead of uint

This is required, so that QHash and QSet can hold more
than 2^32 items on 64 bit platforms.

The actual hashing functions for strings are still 32bit, this will
be changed in a follow-up commit.

Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Lars Knoll 2020-01-31 12:11:54 +01:00
parent 775945137b
commit c6cdf38e75
125 changed files with 305 additions and 310 deletions

View File

@ -53,7 +53,7 @@
#include "slippymap.h"
#include "qmath.h"
uint qHash(const QPoint& p)
size_t qHash(const QPoint& p)
{
return p.x() * 17 ^ p.y();
}

View File

@ -173,7 +173,7 @@ QString LanguageChooser::languageName(const QString &qmFile)
QColor LanguageChooser::colorForLanguage(const QString &language)
{
uint hashValue = qHash(language);
size_t hashValue = qHash(language);
int red = 156 + (hashValue & 0x3F);
int green = 156 + ((hashValue >> 6) & 0x3F);
int blue = 156 + ((hashValue >> 12) & 0x3F);

View File

@ -64,7 +64,7 @@ struct FixStringCacheKey
return hash;
}
};
inline uint qHash(const FixStringCacheKey &f) { return f.hashCode(); }
inline size_t qHash(const FixStringCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
struct FileInfoCacheKey
@ -102,7 +102,7 @@ struct FileInfoCacheKey
|| (c0 == QLatin1Char('\\') && c1 == QLatin1Char('\\')));
}
};
inline uint qHash(const FileInfoCacheKey &f) { return f.hashCode(); }
inline size_t qHash(const FileInfoCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
template <typename T>

View File

@ -306,13 +306,13 @@ struct ReplaceExtraCompilerCacheKey
MakefileGenerator::ReplaceFor forShell;
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s);
bool operator==(const ReplaceExtraCompilerCacheKey &f) const;
inline uint hashCode() const {
inline size_t hashCode() const {
if (!hash)
hash = (uint)forShell ^ qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
hash = (size_t)forShell ^ qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
return hash;
}
};
inline uint qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
inline size_t qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
QT_END_NAMESPACE

View File

@ -116,7 +116,7 @@ uint ProString::updatedHash() const
return (m_hash = hash(m_string.constData() + m_offset, m_length));
}
uint qHash(const ProString &str)
size_t qHash(const ProString &str)
{
if (!(str.m_hash & 0x80000000))
return str.m_hash;

View File

@ -173,7 +173,7 @@ private:
mutable uint m_hash;
QChar *prepareExtend(int extraLen, int thisTarget, int extraTarget);
uint updatedHash() const;
friend uint qHash(const ProString &str);
friend size_t qHash(const ProString &str);
friend QString operator+(const ProString &one, const ProString &two);
friend class ProKey;
};
@ -206,7 +206,7 @@ private:
};
Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
uint qHash(const ProString &str);
size_t qHash(const ProString &str);
QString operator+(const ProString &one, const ProString &two);
inline QString operator+(const ProString &one, const QString &two)
{ return one.toQStringRef() + two; }

View File

@ -107,7 +107,7 @@ QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _ho
{
}
uint qHash(const QMakeBaseKey &key)
size_t qHash(const QMakeBaseKey &key)
{
return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
}

View File

@ -62,7 +62,7 @@ public:
bool hostBuild;
};
uint qHash(const QMakeBaseKey &key);
size_t qHash(const QMakeBaseKey &key);
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two);
class QMakeBaseEnv

View File

@ -149,7 +149,7 @@ inline bool operator==(const Employee &e1, const Employee &e2)
&& e1.dateOfBirth() == e2.dateOfBirth();
}
inline uint qHash(const Employee &key, uint seed)
inline size_t qHash(const Employee &key, size_t seed)
{
return qHash(key.name(), seed) ^ key.dateOfBirth().day();
}
@ -312,7 +312,7 @@ qDeleteAll(hash2.keyBegin(), hash2.keyEnd());
//! [28]
//! [qhashbits]
inline uint qHash(const std::vector<int> &key, uint seed = 0)
inline size_t qHash(const std::vector<int> &key, size_t seed = 0)
{
if (key.empty())
return seed;
@ -322,14 +322,14 @@ inline uint qHash(const std::vector<int> &key, uint seed = 0)
//! [qhashbits]
//! [qhashrange]
inline uint qHash(const std::vector<int> &key, uint seed = 0)
inline size_t qHash(const std::vector<int> &key, size_t seed = 0)
{
return qHashRange(key.begin(), key.end(), seed);
}
//! [qhashrange]
//! [qhashrangecommutative]
inline uint qHash(const std::unordered_set<int> &key, uint seed = 0)
inline size_t qHash(const std::unordered_set<int> &key, size_t seed = 0)
{
return qHashRangeCommutative(key.begin(), key.end(), seed);
}
@ -348,9 +348,9 @@ qHash(qMakePair(key.first, key.second), seed);
//! [31]
//! [32]
uint qHash(K key);
uint qHash(const K &key);
size_t qHash(K key);
size_t qHash(const K &key);
uint qHash(K key, uint seed);
uint qHash(const K &key, uint seed);
size_t qHash(K key, size_t seed);
size_t qHash(const K &key, size_t seed);
//! [32]

View File

@ -142,7 +142,7 @@ public:
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_MOVABLE_TYPE);
inline uint qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }
inline size_t qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }
class QWindowsFileSystemWatcherEngineThread : public QThread
{

View File

@ -4116,7 +4116,7 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)
\relates QHash
\since 5.0
*/
uint qHash(const QUrl &url, uint seed) noexcept
size_t qHash(const QUrl &url, size_t seed) noexcept
{
if (!url.d)
return qHash(-1, seed); // the hash of an unset port (-1)

View File

@ -119,7 +119,7 @@ class QTypeInfo<QUrlTwoFlags<E1, E2> > : public QTypeInfoMerger<QUrlTwoFlags<E1,
class QUrl;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QUrl
{
@ -356,7 +356,7 @@ public:
static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode);
static void setIdnWhitelist(const QStringList &);
friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed) noexcept;
private:
QUrlPrivate *d;

View File

@ -434,7 +434,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const
Returns the hash value for \a key,
using \a seed to seed the calculation.
*/
uint qHash(const QUrlQuery &key, uint seed) noexcept
size_t qHash(const QUrlQuery &key, size_t seed) noexcept
{
if (const QUrlQueryPrivate *d = key.d) {
QtPrivate::QHashCombine hash;

View File

@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed = 0) noexcept;
class QUrlQueryPrivate;
class Q_CORE_EXPORT QUrlQuery
@ -109,7 +109,7 @@ public:
private:
friend class QUrl;
friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed) noexcept;
QSharedDataPointer<QUrlQueryPrivate> d;
public:
typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;

View File

@ -3978,7 +3978,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
*/
/*!
\fn uint qHash(const QPersistentModelIndex &index, uint seed = 0)
\fn size_t qHash(const QPersistentModelIndex &index, size_t seed = 0)
\since 5.0
\relates QPersistentModelIndex

View File

@ -103,7 +103,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
class QPersistentModelIndexData;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
uint qHash(const QPersistentModelIndex &index, uint seed = 0) noexcept;
size_t qHash(const QPersistentModelIndex &index, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QPersistentModelIndex
{
@ -141,14 +141,14 @@ public:
bool isValid() const;
private:
QPersistentModelIndexData *d;
friend uint qHash(const QPersistentModelIndex &, uint seed) noexcept;
friend size_t qHash(const QPersistentModelIndex &, size_t seed) noexcept;
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif
};
Q_DECLARE_SHARED(QPersistentModelIndex)
inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept
inline size_t qHash(const QPersistentModelIndex &index, size_t seed) noexcept
{ return qHash(index.d, seed); }
@ -461,8 +461,8 @@ inline QVariant QModelIndex::data(int arole) const
inline Qt::ItemFlags QModelIndex::flags() const
{ return m ? m->flags(*this) : Qt::ItemFlags(); }
inline uint qHash(const QModelIndex &index) noexcept
{ return uint((uint(index.row()) << 4) + index.column() + index.internalId()); }
inline size_t qHash(const QModelIndex &index, size_t seed) noexcept
{ return size_t((size_t(index.row()) << 4) + size_t(index.column()) + index.internalId()) ^ seed; }
QT_END_NAMESPACE

View File

@ -223,9 +223,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
// dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC
inline uint qHash(const QItemSelectionRange &) { return 0; }
#ifdef Q_CC_MSVC
/*

View File

@ -192,7 +192,7 @@ bool QMimeType::operator==(const QMimeType &other) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QMimeType &key, uint seed) noexcept
size_t qHash(const QMimeType &key, size_t seed) noexcept
{
return qHash(key.d->name, seed);
}

View File

@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
class QMimeTypePrivate;
class QMimeType;
Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QMimeType
{
@ -119,7 +119,7 @@ protected:
friend class QMimeXMLProvider;
friend class QMimeBinaryProvider;
friend class QMimeTypePrivate;
friend Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed) noexcept;
QExplicitlySharedDataPointer<QMimeTypePrivate> d;
};

View File

@ -1089,7 +1089,7 @@ QDebug operator<<(QDebug dbg, const QUuid &id)
\relates QUuid
Returns a hash of the UUID \a uuid, using \a seed to seed the calculation.
*/
uint qHash(const QUuid &uuid, uint seed) noexcept
size_t qHash(const QUuid &uuid, size_t seed) noexcept
{
return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])

View File

@ -243,7 +243,7 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
#endif
Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QUuid &uuid, size_t seed = 0) noexcept;
inline bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
{ return !(rhs < lhs); }

View File

@ -1200,7 +1200,7 @@ void QCborArray::detach(qsizetype reserved)
Returns the offset of this iterator relative to \a other.
*/
uint qHash(const QCborArray &array, uint seed)
size_t qHash(const QCborArray &array, size_t seed)
{
return qHashRange(array.begin(), array.end(), seed);
}

View File

@ -294,7 +294,7 @@ inline QCborArray QCborValueRef::toArray(const QCborArray &a) const
return concrete().toArray(a);
}
Q_CORE_EXPORT uint qHash(const QCborArray &array, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QCborArray &array, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborArray &a);

View File

@ -138,12 +138,12 @@ QDataStream &operator<<(QDataStream &ds, QCborSimpleType st);
QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
#endif
inline uint qHash(QCborSimpleType tag, uint seed = 0)
inline size_t qHash(QCborSimpleType tag, size_t seed = 0)
{
return qHash(quint8(tag), seed);
}
inline uint qHash(QCborTag tag, uint seed = 0)
inline size_t qHash(QCborTag tag, size_t seed = 0)
{
return qHash(quint64(tag), seed);
}

View File

@ -1744,7 +1744,7 @@ void QCborMap::detach(qsizetype reserved)
\sa operator+=(), operator-()
*/
uint qHash(const QCborMap &map, uint seed)
size_t qHash(const QCborMap &map, size_t seed)
{
return qHashRange(map.begin(), map.end(), seed);
}

View File

@ -350,7 +350,7 @@ inline QCborMap QCborValueRef::toMap(const QCborMap &m) const
return concrete().toMap(m);
}
Q_CORE_EXPORT uint qHash(const QCborMap &map, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m);

View File

@ -2921,7 +2921,7 @@ inline QCborMap::QCborMap(QCborContainerPrivate &dd) noexcept
{
}
uint qHash(const QCborValue &value, uint seed)
size_t qHash(const QCborValue &value, size_t seed)
{
switch (value.type()) {
case QCborValue::Integer:

View File

@ -481,7 +481,7 @@ private:
qsizetype i;
};
Q_CORE_EXPORT uint qHash(const QCborValue &value, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v);

View File

@ -1133,7 +1133,7 @@ void QJsonArray::compact()
a->compact(a->elements.size());
}
uint qHash(const QJsonArray &array, uint seed)
size_t qHash(const QJsonArray &array, size_t seed)
{
return qHashRange(array.begin(), array.end(), seed);
}

View File

@ -252,7 +252,7 @@ private:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonArray)
Q_CORE_EXPORT uint qHash(const QJsonArray &array, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QJsonArray &array, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &);

View File

@ -1487,7 +1487,7 @@ void QJsonObject::removeAt(int index)
o->removeAt(index);
}
uint qHash(const QJsonObject &object, uint seed)
size_t qHash(const QJsonObject &object, size_t seed)
{
QtPrivate::QHashCombine hash;
for (auto it = object.begin(), end = object.end(); it != end; ++it) {

View File

@ -302,7 +302,7 @@ private:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonObject)
Q_CORE_EXPORT uint qHash(const QJsonObject &object, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QJsonObject &object, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &);

View File

@ -943,7 +943,7 @@ QJsonValue QJsonValueRef::toValue() const
return o->valueAt(index);
}
uint qHash(const QJsonValue &value, uint seed)
size_t qHash(const QJsonValue &value, size_t seed)
{
switch (value.type()) {
case QJsonValue::Null:

View File

@ -232,7 +232,7 @@ public:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonValue)
Q_CORE_EXPORT uint qHash(const QJsonValue &value, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QJsonValue &value, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);

View File

@ -216,12 +216,9 @@ public:
QPointer<QObject> guard;
QObject *obj;
QByteArray prop;
// two overloads because friends can't have default arguments
friend uint qHash(const RestorableId &key, uint seed)
friend size_t qHash(const RestorableId &key, size_t seed)
noexcept(noexcept(qHash(std::declval<QByteArray>())))
{ return qHash(qMakePair(key.obj, key.prop), seed); }
friend uint qHash(const RestorableId &key) noexcept(noexcept(qHash(key, 0U)))
{ return qHash(key, 0U); }
friend bool operator==(const RestorableId &lhs, const RestorableId &rhs) noexcept
{ return lhs.obj == rhs.obj && lhs.prop == rhs.prop; }
friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept

View File

@ -5028,7 +5028,7 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QByteArray::FromBase64Result &key, uint seed) noexcept
size_t qHash(const QByteArray::FromBase64Result &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.decoded);

View File

@ -697,7 +697,7 @@ inline bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray
return !operator==(lhs, rhs);
}
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray::FromBase64Result &key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray::FromBase64Result &key, size_t seed = 0) noexcept;
QT_END_NAMESPACE

View File

@ -1089,7 +1089,7 @@ bool QLocale::operator!=(const QLocale &other) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QLocale &key, uint seed) noexcept
size_t qHash(const QLocale &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.d->m_data);

View File

@ -59,7 +59,7 @@ class QTextStreamPrivate;
class QLocalePrivate;
Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QLocale
{
@ -1131,7 +1131,7 @@ private:
friend class QSystemLocale;
friend class QCalendarBackend;
friend class QGregorianCalendar;
friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed) noexcept;
QSharedDataPointer<QLocalePrivate> d;
};

View File

@ -891,7 +891,7 @@ static bool operator==(const QRegExpEngineKey &key1, const QRegExpEngineKey &key
&& key1.cs == key2.cs;
}
static uint qHash(const QRegExpEngineKey &key, uint seed = 0) noexcept
static size_t qHash(const QRegExpEngineKey &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.pattern);
@ -4041,7 +4041,7 @@ bool QRegExp::operator==(const QRegExp &rx) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QRegExp &key, uint seed) noexcept
size_t qHash(const QRegExp &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.priv->engineKey);

View File

@ -53,7 +53,7 @@ struct QRegExpPrivate;
class QStringList;
class QRegExp;
Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QRegExp &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QRegExp
{
@ -110,7 +110,7 @@ public:
static QString escape(const QString &str);
friend Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QRegExp &key, size_t seed) noexcept;
private:
QRegExpPrivate *priv;

View File

@ -1828,7 +1828,7 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QRegularExpression &key, uint seed) noexcept
size_t qHash(const QRegularExpression &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.d->pattern);

View File

@ -59,7 +59,7 @@ class QRegularExpressionMatchIterator;
struct QRegularExpressionPrivate;
class QRegularExpression;
Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QRegularExpression
{
@ -167,7 +167,7 @@ private:
friend class QRegularExpressionMatch;
friend struct QRegularExpressionMatchPrivate;
friend class QRegularExpressionMatchIterator;
friend Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed) noexcept;
QRegularExpression(QRegularExpressionPrivate &dd);
QExplicitlySharedDataPointer<QRegularExpressionPrivate> d;

View File

@ -61,7 +61,7 @@ inline bool operator==(const CalendarName &u, const CalendarName &v)
return u.compare(v, Qt::CaseInsensitive) == 0;
}
inline uint qHash(const CalendarName &key, uint seed = 0) noexcept
inline size_t qHash(const CalendarName &key, size_t seed = 0) noexcept
{
return qHash(key.toLower(), seed);
}

View File

@ -5950,13 +5950,13 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
}
#endif // debug_stream && datestring
/*! \fn uint qHash(const QDateTime &key, uint seed = 0)
/*! \fn size_t qHash(const QDateTime &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(const QDateTime &key, uint seed)
size_t qHash(const QDateTime &key, size_t seed)
{
// Use to toMSecsSinceEpoch instead of individual qHash functions for
// QDate/QTime/spec/offset because QDateTime::operator== converts both arguments
@ -5965,24 +5965,24 @@ uint qHash(const QDateTime &key, uint seed)
return key.isValid() ? qHash(key.toMSecsSinceEpoch(), seed) : seed;
}
/*! \fn uint qHash(QDate key, uint seed = 0)
/*! \fn size_t qHash(QDate key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(QDate key, uint seed) noexcept
size_t qHash(QDate key, size_t seed) noexcept
{
return qHash(key.toJulianDay(), seed);
}
/*! \fn uint qHash(QTime key, uint seed = 0)
/*! \fn size_t qHash(QTime key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(QTime key, uint seed) noexcept
size_t qHash(QTime key, size_t seed) noexcept
{
return qHash(key.msecsSinceStartOfDay(), seed);
}

View File

@ -447,9 +447,9 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &);
// QDateTime is not noexcept for now -- to be revised once
// timezone and calendaring support is added
Q_CORE_EXPORT uint qHash(const QDateTime &key, uint seed = 0);
Q_CORE_EXPORT uint qHash(QDate key, uint seed = 0) noexcept;
Q_CORE_EXPORT uint qHash(QTime key, uint seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(const QDateTime &key, size_t seed = 0);
Q_CORE_EXPORT size_t qHash(QDate key, size_t seed = 0) noexcept;
Q_CORE_EXPORT size_t qHash(QTime key, size_t seed = 0) noexcept;
QT_END_NAMESPACE

View File

@ -50,7 +50,7 @@ class Q_CORE_EXPORT QBitArray
{
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &);
friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) noexcept;
friend Q_CORE_EXPORT size_t qHash(const QBitArray &key, size_t seed) noexcept;
QByteArray d;
public:

View File

@ -210,11 +210,6 @@ static inline uint hash(const uchar *p, size_t len, uint seed) noexcept
return h;
}
uint qHashBits(const void *p, size_t len, uint seed) noexcept
{
return hash(static_cast<const uchar*>(p), int(len), seed);
}
static inline uint hash(const QChar *p, size_t len, uint seed) noexcept
{
uint h = seed;
@ -228,33 +223,38 @@ static inline uint hash(const QChar *p, size_t len, uint seed) noexcept
return h;
}
uint qHash(const QByteArray &key, uint seed) noexcept
size_t qHashBits(const void *p, size_t size, size_t seed) noexcept
{
return hash(static_cast<const uchar*>(p), int(size), static_cast<uint>(seed));
}
size_t qHash(const QByteArray &key, size_t seed) noexcept
{
return hash(reinterpret_cast<const uchar *>(key.constData()), size_t(key.size()), seed);
}
#if QT_STRINGVIEW_LEVEL < 2
uint qHash(const QString &key, uint seed) noexcept
size_t qHash(const QString &key, size_t seed) noexcept
{
return hash(key.unicode(), size_t(key.size()), seed);
}
uint qHash(const QStringRef &key, uint seed) noexcept
size_t qHash(const QStringRef &key, size_t seed) noexcept
{
return hash(key.unicode(), size_t(key.size()), seed);
}
#endif
uint qHash(QStringView key, uint seed) noexcept
size_t qHash(QStringView key, size_t seed) noexcept
{
return hash(key.data(), key.size(), seed);
}
uint qHash(const QBitArray &bitArray, uint seed) noexcept
size_t qHash(const QBitArray &bitArray, size_t seed) noexcept
{
int m = bitArray.d.size() - 1;
uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()),
size_t(qMax(0, m)), seed);
size_t result = qHashBits(reinterpret_cast<const uchar *>(bitArray.d.constData()), size_t(qMax(0, m)), seed);
// deal with the last 0 to 7 bits manually, because we can't trust that
// the padding is initialized to 0 in bitArray.d
@ -264,7 +264,7 @@ uint qHash(const QBitArray &bitArray, uint seed) noexcept
return result;
}
uint qHash(QLatin1String key, uint seed) noexcept
size_t qHash(QLatin1String key, size_t seed) noexcept
{
return hash(reinterpret_cast<const uchar *>(key.data()), size_t(key.size()), seed);
}
@ -406,7 +406,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
}
/*!
\fn template <typename T1, typename T2> uint qHash(const QPair<T1, T2> &key, uint seed = 0)
\fn template <typename T1, typename T2> size_t qHash(const QPair<T1, T2> &key, size_t seed = 0)
\since 5.0
\relates QHash
@ -416,7 +416,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
*/
/*!
\fn template <typename T1, typename T2> uint qHash(const std::pair<T1, T2> &key, uint seed = 0)
\fn template <typename T1, typename T2> size_t qHash(const std::pair<T1, T2> &key, size_t seed = 0)
\since 5.7
\relates QHash
@ -430,7 +430,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
constraints, we cannot change the QPair algorithm to match the std::pair one before Qt 6.
*/
/*! \fn template <typename InputIterator> uint qHashRange(InputIterator first, InputIterator last, uint seed = 0)
/*! \fn template <typename InputIterator> size_t qHashRange(InputIterator first, InputIterator last, size_t seed = 0)
\relates QHash
\since 5.5
@ -465,7 +465,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashBits(), qHashRangeCommutative()
*/
/*! \fn template <typename InputIterator> uint qHashRangeCommutative(InputIterator first, InputIterator last, uint seed = 0)
/*! \fn template <typename InputIterator> size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed = 0)
\relates QHash
\since 5.5
@ -501,7 +501,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashBits(), qHashRange()
*/
/*! \fn uint qHashBits(const void *p, size_t len, uint seed = 0)
/*! \fn size_t qHashBits(const void *p, size_t len, size_t seed = 0)
\relates QHash
\since 5.4
@ -526,77 +526,77 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashRange(), qHashRangeCommutative()
*/
/*! \fn uint qHash(char key, uint seed = 0)
/*! \fn size_t qHash(char key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(uchar key, uint seed = 0)
/*! \fn size_t qHash(uchar key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(signed char key, uint seed = 0)
/*! \fn size_t qHash(signed char key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(ushort key, uint seed = 0)
/*! \fn size_t qHash(ushort key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(short key, uint seed = 0)
/*! \fn size_t qHash(short key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(uint key, uint seed = 0)
/*! \fn size_t qHash(uint key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(int key, uint seed = 0)
/*! \fn size_t qHash(int key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(ulong key, uint seed = 0)
/*! \fn size_t qHash(ulong key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(long key, uint seed = 0)
/*! \fn size_t qHash(long key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(quint64 key, uint seed = 0)
/*! \fn size_t qHash(quint64 key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(qint64 key, uint seed = 0)
/*! \fn size_t qHash(qint64 key, size_t seed = 0)
\relates QHash
\since 5.0
@ -608,7 +608,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(float key, uint seed) noexcept
size_t qHash(float key, size_t seed) noexcept
{
return key != 0.0f ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
@ -618,7 +618,7 @@ uint qHash(float key, uint seed) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(double key, uint seed) noexcept
size_t qHash(double key, size_t seed) noexcept
{
return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
@ -629,62 +629,62 @@ uint qHash(double key, uint seed) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
uint qHash(long double key, uint seed) noexcept
size_t qHash(long double key, size_t seed) noexcept
{
return key != 0.0L ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
#endif
/*! \fn uint qHash(const QChar key, uint seed = 0)
/*! \fn size_t qHash(const QChar key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(const QByteArray &key, uint seed = 0)
/*! \fn size_t qHash(const QByteArray &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(const QBitArray &key, uint seed = 0)
/*! \fn size_t qHash(const QBitArray &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(const QString &key, uint seed = 0)
/*! \fn size_t qHash(const QString &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(const QStringRef &key, uint seed = 0)
/*! \fn size_t qHash(const QStringRef &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(QStringView key, uint seed = 0)
/*! \fn size_t qHash(QStringView key, size_t seed = 0)
\relates QStringView
\since 5.10
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn uint qHash(QLatin1String key, uint seed = 0)
/*! \fn size_t qHash(QLatin1String key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
/*! \fn template <class T> uint qHash(const T *key, uint seed = 0)
/*! \fn template <class T> size_t qHash(const T *key, size_t seed = 0)
\relates QHash
\since 5.0
@ -2855,7 +2855,7 @@ uint qHash(long double key, uint seed) noexcept
*/
/*!
\fn template <class Key, class T> uint qHash(const QHash<Key, T> &key, uint seed = 0)
\fn template <class Key, class T> size_t qHash(const QHash<Key, T> &key, size_t seed = 0)
\since 5.8
\relates QHash
@ -2865,7 +2865,7 @@ uint qHash(long double key, uint seed) noexcept
*/
/*!
\fn template <class Key, class T> uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
\fn template <class Key, class T> size_t qHash(const QMultiHash<Key, T> &key, size_t seed = 0)
\since 5.8
\relates QMultiHash

View File

@ -2011,7 +2011,7 @@ public:
#endif // !QT_NO_JAVA_STYLE_ITERATORS
template <class Key, class T>
uint qHash(const QHash<Key, T> &key, uint seed = 0)
size_t qHash(const QHash<Key, T> &key, size_t seed = 0)
noexcept(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
{
QtPrivate::QHashCombineCommutative hash;
@ -2024,7 +2024,7 @@ uint qHash(const QHash<Key, T> &key, uint seed = 0)
}
template <class Key, class T>
inline uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
inline size_t qHash(const QMultiHash<Key, T> &key, size_t seed = 0)
noexcept(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
{
const QHash<Key, T> &key2 = key;

View File

@ -70,7 +70,7 @@ Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
namespace QHashPrivate {
Q_DECL_CONST_FUNCTION constexpr uint hash(size_t key, uint seed) noexcept
Q_DECL_CONST_FUNCTION constexpr size_t hash(size_t key, size_t seed) noexcept
{
key ^= seed;
if constexpr (sizeof(size_t) == 4) {
@ -86,74 +86,74 @@ Q_DECL_CONST_FUNCTION constexpr uint hash(size_t key, uint seed) noexcept
key ^= key >> 32;
key *= UINT64_C(0xd6e8feb86659fd93);
key ^= key >> 32;
return uint(key);
return key;
}
}
}
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHashBits(const void *p, size_t size, size_t seed = 0) noexcept;
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uchar key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uchar key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(signed char key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(signed char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ushort key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ushort key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(short key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(short key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uint key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uint key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(int key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(int key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ulong key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ulong key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(long key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(long key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(quint64 key, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(quint64 key, size_t seed = 0) noexcept
{
if (sizeof(quint64) > sizeof(size_t))
key ^= (key >> 32);
return QHashPrivate::hash(size_t(key), seed);
}
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(qint64 key, uint seed = 0) noexcept { return qHash(quint64(key), seed); }
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(float key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(double key, uint seed = 0) noexcept;
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0) noexcept { return qHash(quint64(key), seed); }
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(float key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) noexcept;
#if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(long double key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept;
#endif
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(const QChar key, uint seed = 0) noexcept { return qHash(key.unicode(), seed); }
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray &key, uint seed = 0) noexcept;
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(const QChar key, size_t seed = 0) noexcept { return qHash(key.unicode(), seed); }
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray &key, size_t seed = 0) noexcept;
#if QT_STRINGVIEW_LEVEL < 2
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QStringRef &key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QString &key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QStringRef &key, size_t seed = 0) noexcept;
#endif
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QStringView key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QStringView key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QBitArray &key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QLatin1String key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) noexcept;
Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) noexcept
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(std::nullptr_t, size_t seed = 0) noexcept
{
return qHash(reinterpret_cast<quintptr>(nullptr), seed);
return seed;
}
template <class T> inline uint qHash(const T *key, uint seed = 0) noexcept
template <class T> inline size_t qHash(const T *key, size_t seed = 0) noexcept
{
return qHash(reinterpret_cast<quintptr>(key), seed);
}
template<typename T> inline uint qHash(const T &t, uint seed)
template<typename T> inline size_t qHash(const T &t, size_t seed)
noexcept(noexcept(qHash(t)))
{ return qHash(t) ^ seed; }
namespace QtPrivate {
struct QHashCombine {
typedef uint result_type;
typedef size_t result_type;
template <typename T>
Q_DECL_CONSTEXPR result_type operator()(uint seed, const T &t) const noexcept(noexcept(qHash(t)))
constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
// combiner taken from N3876 / boost::hash_combine
{ return seed ^ (qHash(t) + 0x9e3779b9 + (seed << 6) + (seed >> 2)) ; }
};
@ -164,37 +164,38 @@ struct QHashCombineCommutative {
// usually what we want: {0,1,3} should hash differently than
// {1,3,0}. Except when it isn't (e.g. for QSet and
// QHash). Therefore, provide a commutative combiner, too.
typedef uint result_type;
typedef size_t result_type;
template <typename T>
Q_DECL_CONSTEXPR result_type operator()(uint seed, const T &t) const noexcept(noexcept(qHash(t)))
constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
{ return seed + qHash(t); } // don't use xor!
};
} // namespace QtPrivate
template <typename InputIterator>
inline uint qHashRange(InputIterator first, InputIterator last, uint seed = 0)
inline size_t qHashRange(InputIterator first, InputIterator last, size_t seed = 0)
noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw
{
return std::accumulate(first, last, seed, QtPrivate::QHashCombine());
}
template <typename InputIterator>
inline uint qHashRangeCommutative(InputIterator first, InputIterator last, uint seed = 0)
inline size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed = 0)
noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw
{
return std::accumulate(first, last, seed, QtPrivate::QHashCombineCommutative());
}
template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key, uint seed = 0)
template <typename T1, typename T2> inline size_t qHash(const QPair<T1, T2> &key, size_t seed = 0)
noexcept(noexcept(qHash(key.first, seed)) && noexcept(qHash(key.second, seed)))
{
uint h1 = qHash(key.first, seed);
uint h2 = qHash(key.second, seed);
return ((h1 << 16) | (h1 >> 16)) ^ h2 ^ seed;
QtPrivate::QHashCombine hash;
seed = hash(seed, key.first);
seed = hash(seed, key.second);
return seed;
}
template <typename T1, typename T2> inline uint qHash(const std::pair<T1, T2> &key, uint seed = 0)
template <typename T1, typename T2> inline size_t qHash(const std::pair<T1, T2> &key, size_t seed = 0)
noexcept(noexcept(qHash(key.first, seed)) && noexcept(qHash(key.second, seed)))
{
QtPrivate::QHashCombine hash;

View File

@ -230,7 +230,7 @@ QSet(InputIterator, InputIterator) -> QSet<ValueType>;
#endif
template <typename T>
uint qHash(const QSet<T> &key, uint seed = 0)
size_t qHash(const QSet<T> &key, size_t seed = 0)
noexcept(noexcept(qHashRangeCommutative(key.begin(), key.end(), seed)))
{
return qHashRangeCommutative(key.begin(), key.end(), seed);

View File

@ -1136,7 +1136,7 @@
*/
/*!
\fn template <class T> uint qHash(const QSet<T> &key, uint seed = 0)
\fn template <class T> size_t qHash(const QSet<T> &key, size_t seed = 0)
\relates QHash
\since 5.5

View File

@ -305,12 +305,12 @@ Q_INLINE_TEMPLATE void swap(QExplicitlySharedDataPointer<T> &p1, QExplicitlyShar
{ p1.swap(p2); }
template <class T>
Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer<T> &ptr, uint seed = 0) noexcept
Q_INLINE_TEMPLATE size_t qHash(const QSharedDataPointer<T> &ptr, size_t seed = 0) noexcept
{
return qHash(ptr.data(), seed);
}
template <class T>
Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer<T> &ptr, uint seed = 0) noexcept
Q_INLINE_TEMPLATE size_t qHash(const QExplicitlySharedDataPointer<T> &ptr, size_t seed = 0) noexcept
{
return qHash(ptr.data(), seed);
}

View File

@ -882,7 +882,7 @@ Q_INLINE_TEMPLATE bool operator<(T *ptr1, const QSharedPointer<X> &ptr2)
// qHash
//
template <class T>
Q_INLINE_TEMPLATE uint qHash(const QSharedPointer<T> &ptr, uint seed = 0)
Q_INLINE_TEMPLATE size_t qHash(const QSharedPointer<T> &ptr, size_t seed = 0)
{
return QT_PREPEND_NAMESPACE(qHash)(ptr.data(), seed);
}

View File

@ -611,7 +611,7 @@ inline bool operator>=(const QVarLengthArray<T, Prealloc1> &lhs, const QVarLengt
}
template <typename T, qsizetype Prealloc>
uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
size_t qHash(const QVarLengthArray<T, Prealloc> &key, size_t seed = 0)
noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed)))
{
return qHashRange(key.cbegin(), key.cend(), seed);

View File

@ -903,7 +903,7 @@
*/
/*!
\fn template <typename T, qsizetype Prealloc> uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
\fn template <typename T, qsizetype Prealloc> size_t qHash(const QVarLengthArray<T, Prealloc> &key, size_t seed = 0)
\relates QVarLengthArray
\since 5.14

View File

@ -731,7 +731,7 @@ Q_DECLARE_SEQUENTIAL_ITERATOR(Vector)
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector)
template <typename T>
uint qHash(const QVector<T> &key, uint seed = 0)
size_t qHash(const QVector<T> &key, size_t seed = 0)
noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed)))
{
return qHashRange(key.cbegin(), key.cend(), seed);

View File

@ -391,7 +391,7 @@
*/
/*!
\fn template <typename T> uint qHash(const QVector<T> &key, uint seed = 0)
\fn template <typename T> size_t qHash(const QVector<T> &key, size_t seed = 0)
\since 5.6
\relates QVector

View File

@ -541,14 +541,14 @@ QDebug operator<<(QDebug debug, const QVersionNumber &version)
#endif
/*!
\fn uint qHash(const QVersionNumber &key, uint seed)
\fn size_t qHash(const QVersionNumber &key, size_t seed)
\relates QHash
\since 5.6
Returns the hash value for the \a key, using \a seed to seed the
calculation.
*/
uint qHash(const QVersionNumber &key, uint seed)
size_t qHash(const QVersionNumber &key, size_t seed)
{
QtPrivate::QHashCombine hash;
for (int i = 0; i < key.segmentCount(); ++i)

View File

@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
class QVersionNumber;
Q_CORE_EXPORT uint qHash(const QVersionNumber &key, uint seed = 0);
Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed = 0);
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream& operator<<(QDataStream &out, const QVersionNumber &version);
@ -283,7 +283,7 @@ private:
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version);
#endif
friend Q_CORE_EXPORT uint qHash(const QVersionNumber &key, uint seed);
friend Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed);
};
Q_DECLARE_TYPEINFO(QVersionNumber, Q_MOVABLE_TYPE);

View File

@ -105,7 +105,7 @@ inline bool operator!=(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
inline bool operator<(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
{ return lhs.path() < rhs.path(); }
inline uint qHash(const QDBusObjectPath &objectPath, uint seed = 0)
inline size_t qHash(const QDBusObjectPath &objectPath, size_t seed = 0)
{ return qHash(objectPath.path(), seed); }
@ -158,7 +158,7 @@ inline bool operator!=(const QDBusSignature &lhs, const QDBusSignature &rhs)
inline bool operator<(const QDBusSignature &lhs, const QDBusSignature &rhs)
{ return lhs.signature() < rhs.signature(); }
inline uint qHash(const QDBusSignature &signature, uint seed = 0)
inline size_t qHash(const QDBusSignature &signature, size_t seed = 0)
{ return qHash(signature.signature(), seed); }
class QDBusVariant

View File

@ -253,9 +253,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qpixmapcache.moc"
QT_END_INCLUDE_NAMESPACE
uint qHash(const QPixmapCache::Key &k)
size_t qHash(const QPixmapCache::Key &k, size_t seed)
{
return qHash(QPMCache::get(k)->key);
return qHash(QPMCache::get(k)->key, seed);
}
QPMCache::QPMCache()

View File

@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
uint qHash(const QPixmapCache::Key &k);
size_t qHash(const QPixmapCache::Key &k, size_t seed = 0);
class QPixmapCache::KeyData
{

View File

@ -5231,7 +5231,7 @@ bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexce
Returns the hash value for \a key, using \a seed to seed the calculation.
*/
uint qHash(QPointingDeviceUniqueId key, uint seed) noexcept
size_t qHash(QPointingDeviceUniqueId key, size_t seed) noexcept
{
return qHash(key.numericId(), seed);
}

View File

@ -831,7 +831,7 @@ Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept;
inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
{ return !operator==(lhs, rhs); }
Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) noexcept;
Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;

View File

@ -2749,9 +2749,9 @@ void QGuiApplicationPrivate::processContextMenuEvent(QWindowSystemInterfacePriva
}
#endif
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
Q_GUI_EXPORT size_t qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k, size_t seed)
{
return qHash(k.device) + k.touchPointId;
return (qHash(k.device) + k.touchPointId) ^ seed;
}
Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,

View File

@ -372,7 +372,7 @@ private:
static qreal m_maxDevicePixelRatio;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
Q_GUI_EXPORT size_t qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k, size_t seed = 0);
Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
const QGuiApplicationPrivate::ActiveTouchPointsKey &b);

View File

@ -1467,7 +1467,7 @@ bool QKeySequence::operator==(const QKeySequence &other) const
Calculates the hash value of \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QKeySequence &key, uint seed) noexcept
size_t qHash(const QKeySequence &key, size_t seed) noexcept
{
return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
}

View File

@ -65,7 +65,7 @@ void qt_set_sequence_auto_mnemonic(bool b);
class QVariant;
class QKeySequencePrivate;
Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) noexcept;
Q_GUI_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QKeySequence &key, size_t seed = 0) noexcept;
class Q_GUI_EXPORT QKeySequence
{
@ -211,7 +211,7 @@ private:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) noexcept;
friend Q_GUI_EXPORT size_t qHash(const QKeySequence &key, size_t seed) noexcept;
friend class QShortcutMap;
friend class QShortcut;

View File

@ -133,9 +133,9 @@ inline bool operator!=(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
return !a.equals(b);
}
inline uint qHash(const QOpenGLConfig::Gpu &gpu)
inline size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed = 0)
{
return qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion);
return (qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion)) ^ seed;
}
QT_END_NAMESPACE

View File

@ -103,7 +103,7 @@ struct QOpenGLVersionStatus
OpenGLStatus status;
};
inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0) noexcept
inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
{
return qHash(static_cast<int>(v.status * 1000)
+ v.version.first * 100 + v.version.second * 10, seed);

View File

@ -81,7 +81,7 @@ private:
QOpenGLVersionProfilePrivate* d;
};
inline uint qHash(const QOpenGLVersionProfile &v, uint seed = 0)
inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0)
{
return qHash(static_cast<int>(v.profile() * 1000)
+ v.version().first * 100 + v.version().second * 10, seed);

View File

@ -136,7 +136,7 @@ enum class Tag : quint32 {
aabg = IccTag('a', 'a', 'b', 'g'),
};
inline uint qHash(const Tag &key, uint seed = 0)
inline size_t qHash(const Tag &key, size_t seed = 0)
{
return qHash(quint32(key), seed);
}

View File

@ -156,7 +156,7 @@ protected:
int m_currentRowHeight; // Height of last row
};
inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
inline size_t qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
{
return (g.glyph << 8) | (g.subPixelPosition * 10).round().toInt();
}

View File

@ -783,7 +783,7 @@ bool QTransform::operator==(const QTransform &o) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QTransform &key, uint seed) noexcept
size_t qHash(const QTransform &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.m11());

View File

@ -206,7 +206,7 @@ private:
};
Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE);
Q_GUI_EXPORT Q_DECL_CONST_FUNCTION uint qHash(const QTransform &key, uint seed = 0) noexcept;
Q_GUI_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(const QTransform &key, size_t seed = 0) noexcept;
/******* inlines *****/
inline QTransform::TransformationType QTransform::inline_type() const

View File

@ -711,7 +711,7 @@ bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClear
\relates QRhiDepthStencilClearValue
*/
uint qHash(const QRhiDepthStencilClearValue &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed) Q_DECL_NOTHROW
{
return seed * (uint(qFloor(qreal(v.depthClearValue()) * 100)) + v.stencilClearValue());
}
@ -807,7 +807,7 @@ bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW
\relates QRhiViewport
*/
uint qHash(const QRhiViewport &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiViewport &v, size_t seed) Q_DECL_NOTHROW
{
const std::array<float, 4> r = v.viewport();
return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3])
@ -898,7 +898,7 @@ bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW
\relates QRhiScissor
*/
uint qHash(const QRhiScissor &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiScissor &v, size_t seed) Q_DECL_NOTHROW
{
const std::array<int, 4> r = v.scissor();
return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3]);
@ -1032,7 +1032,7 @@ bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b
\relates QRhiVertexInputBinding
*/
uint qHash(const QRhiVertexInputBinding &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiVertexInputBinding &v, size_t seed) Q_DECL_NOTHROW
{
return seed + v.stride() + v.classification();
}
@ -1185,7 +1185,7 @@ bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribut
\relates QRhiVertexInputAttribute
*/
uint qHash(const QRhiVertexInputAttribute &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiVertexInputAttribute &v, size_t seed) Q_DECL_NOTHROW
{
return seed + uint(v.binding()) + uint(v.location()) + uint(v.format()) + v.offset();
}
@ -1246,7 +1246,7 @@ bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)
\relates QRhiVertexInputLayout
*/
uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW
{
return qHash(v.m_bindings, seed) + qHash(v.m_attributes, seed);
}
@ -1336,7 +1336,7 @@ bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHR
\relates QRhiShaderStage
*/
uint qHash(const QRhiShaderStage &v, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiShaderStage &v, size_t seed) Q_DECL_NOTHROW
{
return v.type() + qHash(v.shader(), seed) + v.shaderVariant();
}
@ -3182,7 +3182,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
\relates QRhiShaderResourceBinding
*/
uint qHash(const QRhiShaderResourceBinding &b, uint seed) Q_DECL_NOTHROW
size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) Q_DECL_NOTHROW
{
const QRhiShaderResourceBinding::Data *d = b.data();
return seed + uint(d->binding) + 10 * uint(d->stage) + 100 * uint(d->type)

View File

@ -94,7 +94,7 @@ Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiDepthStencilClearValue &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &);
#endif
@ -126,7 +126,7 @@ Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiViewport &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiViewport &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
#endif
@ -150,7 +150,7 @@ Q_DECLARE_TYPEINFO(QRhiScissor, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiScissor &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiScissor &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
#endif
@ -185,7 +185,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiVertexInputBinding &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
#endif
@ -229,7 +229,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiVertexInputAttribute &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
#endif
@ -265,7 +265,7 @@ private:
QVarLengthArray<QRhiVertexInputAttribute, 8> m_attributes;
friend Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
};
@ -273,7 +273,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
#endif
@ -310,7 +310,7 @@ Q_DECLARE_TYPEINFO(QRhiShaderStage, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiShaderStage &s, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiShaderStage &s, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &);
#endif
@ -411,7 +411,7 @@ Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QRhiShaderResourceBinding &b, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
#endif

View File

@ -543,7 +543,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
\relates QShader
*/
uint qHash(const QShader &s, uint seed) Q_DECL_NOTHROW
size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW
{
uint h = s.stage();
for (auto it = s.d->shaders.constBegin(), itEnd = s.d->shaders.constEnd(); it != itEnd; ++it)
@ -596,7 +596,7 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
\relates QShaderKey
*/
uint qHash(const QShaderKey &k, uint seed) Q_DECL_NOTHROW
size_t qHash(const QShaderKey &k, size_t seed) Q_DECL_NOTHROW
{
return seed + 10 * k.source() + k.sourceVersion().version() + k.sourceVersion().flags() + k.sourceVariant();
}

View File

@ -158,7 +158,7 @@ private:
QShaderPrivate *d;
friend struct QShaderPrivate;
friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT uint qHash(const QShader &, uint) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT size_t qHash(const QShader &, size_t) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
#endif
@ -190,7 +190,7 @@ private:
Q_DECLARE_TYPEINFO(QShaderKey, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(const QShader &s, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QShader &s, size_t seed = 0) Q_DECL_NOTHROW;
inline bool operator!=(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
{
@ -216,7 +216,7 @@ inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NO
return !(lhs == rhs);
}
Q_GUI_EXPORT uint qHash(const QShaderKey &k, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT size_t qHash(const QShaderKey &k, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);

View File

@ -2086,7 +2086,7 @@ QString QFont::toString() const
\relates QFont
\since 5.3
*/
uint qHash(const QFont &font, uint seed) noexcept
size_t qHash(const QFont &font, size_t seed) noexcept
{
return qHash(QFontPrivate::get(font)->request, seed);
}

View File

@ -347,7 +347,7 @@ private:
Q_DECLARE_SHARED(QFont)
Q_GUI_EXPORT uint qHash(const QFont &font, uint seed = 0) noexcept;
Q_GUI_EXPORT size_t qHash(const QFont &font, size_t seed = 0) noexcept;
inline bool QFont::bold() const
{ return weight() > Medium; }

View File

@ -136,7 +136,7 @@ struct QFontDef
}
};
inline uint qHash(const QFontDef &fd, uint seed = 0) noexcept
inline size_t qHash(const QFontDef &fd, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, qRound64(fd.pixelSize*10000)); // use only 4 fractional digits

View File

@ -399,7 +399,7 @@ inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId
return f1.index == f2.index && f1.encoding == f2.encoding && f1.filename == f2.filename && f1.uuid == f2.uuid;
}
inline uint qHash(const QFontEngine::FaceId &f, uint seed = 0)
inline size_t qHash(const QFontEngine::FaceId &f, size_t seed = 0)
noexcept(noexcept(qHash(f.filename)))
{
QtPrivate::QHashCombine hash;

View File

@ -323,7 +323,7 @@ bool QRawFont::operator==(const QRawFont &other) const
\relates QRawFont
\since 5.8
*/
uint qHash(const QRawFont &font, uint seed) noexcept
size_t qHash(const QRawFont &font, size_t seed) noexcept
{
return qHash(QRawFontPrivate::get(font)->fontEngine, seed);
}

View File

@ -156,7 +156,7 @@ Q_DECLARE_SHARED(QRawFont)
Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags)
Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) noexcept;
Q_GUI_EXPORT size_t qHash(const QRawFont &font, size_t seed = 0) noexcept;
inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const
{

View File

@ -358,7 +358,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
\fn uint qHash(const QVulkanLayer &key, uint seed)
\fn size_t qHash(const QVulkanLayer &key, size_t seed)
\since 5.10
\relates QVulkanLayer
@ -401,7 +401,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
\fn uint qHash(const QVulkanExtension &key, uint seed)
\fn size_t qHash(const QVulkanExtension &key, size_t seed)
\since 5.10
\relates QVulkanExtension

View File

@ -91,7 +91,7 @@ inline bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcep
inline bool operator!=(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcept
{ return !(lhs == rhs); }
inline uint qHash(const QVulkanLayer &key, uint seed = 0) noexcept
inline size_t qHash(const QVulkanLayer &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);
@ -114,7 +114,7 @@ inline bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs)
inline bool operator!=(const QVulkanExtension &lhs, const QVulkanExtension &rhs) noexcept
{ return !(lhs == rhs); }
inline uint qHash(const QVulkanExtension &key, uint seed = 0) noexcept
inline size_t qHash(const QVulkanExtension &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);

View File

@ -1333,7 +1333,7 @@ QDebug operator<<(QDebug d, const QHostAddress &address)
\relates QHostAddress
Returns a hash of the host address \a key, using \a seed to seed the calculation.
*/
uint qHash(const QHostAddress &key, uint seed) noexcept
size_t qHash(const QHostAddress &key, size_t seed) noexcept
{
return qHashBits(key.d->a6.c, 16, seed);
}

View File

@ -66,7 +66,7 @@ typedef QIPv6Address Q_IPV6ADDR;
class QHostAddress;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed = 0) noexcept;
Q_NETWORK_EXPORT size_t qHash(const QHostAddress &key, size_t seed = 0) noexcept;
class Q_NETWORK_EXPORT QHostAddress
{
@ -154,7 +154,7 @@ public:
static QPair<QHostAddress, int> parseSubnet(const QString &subnet);
friend Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed) noexcept;
friend Q_NETWORK_EXPORT size_t qHash(const QHostAddress &key, size_t seed) noexcept;
protected:
friend class QHostAddressPrivate;
QExplicitlySharedDataPointer<QHostAddressPrivate> d;

View File

@ -232,20 +232,20 @@ Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &
*/
/*!
\fn uint qHash(const QOcspResponse &response, uint seed)
\fn size_t qHash(const QOcspResponse &response, size_t seed)
Returns the hash value for the \a response, using \a seed to seed the calculation.
\since 5.13
\relates QHash
*/
uint qHash(const QOcspResponse &response, uint seed) noexcept
size_t qHash(const QOcspResponse &response, size_t seed) noexcept
{
const QOcspResponsePrivate *d = response.d.data();
Q_ASSERT(d);
QtPrivate::QHashCombine hasher;
uint hash = hasher(seed, int(d->certificateStatus));
size_t hash = hasher(seed, int(d->certificateStatus));
hash = hasher(hash, int(d->revocationReason));
if (!d->signerCert.isNull())
hash = hasher(hash, d->signerCert);

View File

@ -73,7 +73,7 @@ enum class QOcspRevocationReason
};
class QOcspResponse;
Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed = 0) noexcept;
Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed = 0) noexcept;
class QOcspResponsePrivate;
class Q_NETWORK_EXPORT QOcspResponse
@ -100,7 +100,7 @@ private:
friend class QSslSocketBackendPrivate;
friend Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs);
friend Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed) noexcept;
friend Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed) noexcept;
QSharedDataPointer<QOcspResponsePrivate> d;
};

View File

@ -761,7 +761,7 @@ QString QSslCertificate::subjectDisplayName() const
}
/*!
\fn uint qHash(const QSslCertificate &key, uint seed)
\fn size_t qHash(const QSslCertificate &key, size_t seed)
Returns the hash value for the \a key, using \a seed to seed the calculation.
\since 5.4

View File

@ -65,7 +65,7 @@ class QStringList;
class QSslCertificate;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_NETWORK_EXPORT uint qHash(const QSslCertificate &key, uint seed = 0) noexcept;
Q_NETWORK_EXPORT size_t qHash(const QSslCertificate &key, size_t seed = 0) noexcept;
class QSslCertificatePrivate;
class Q_NETWORK_EXPORT QSslCertificate
@ -170,7 +170,7 @@ private:
friend class QSslCertificatePrivate;
friend class QSslSocketBackendPrivate;
friend Q_NETWORK_EXPORT uint qHash(const QSslCertificate &key, uint seed) noexcept;
friend Q_NETWORK_EXPORT size_t qHash(const QSslCertificate &key, size_t seed) noexcept;
};
Q_DECLARE_SHARED(QSslCertificate)

View File

@ -72,7 +72,7 @@ bool QSslCertificate::operator==(const QSslCertificate &other) const
return false;
}
uint qHash(const QSslCertificate &key, uint seed) noexcept
size_t qHash(const QSslCertificate &key, size_t seed) noexcept
{
if (X509 * const x509 = key.d->x509) {
const EVP_MD *sha1 = q_EVP_sha1();

View File

@ -64,7 +64,7 @@ bool QSslCertificate::operator==(const QSslCertificate &other) const
return d->derData == other.d->derData;
}
uint qHash(const QSslCertificate &key, uint seed) noexcept
size_t qHash(const QSslCertificate &key, size_t seed) noexcept
{
// DER is the native encoding here, so toDer() is just "return d->derData":
return qHash(key.toDer(), seed);

View File

@ -316,7 +316,7 @@ QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam)
Returns an hash value for \a dhparam, using \a seed to seed
the calculation.
*/
uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) noexcept
size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed) noexcept
{
return qHash(dhparam.d->derData, seed);
}

View File

@ -56,7 +56,7 @@ class QSslDiffieHellmanParametersPrivate;
class QSslDiffieHellmanParameters;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed = 0) noexcept;
Q_NETWORK_EXPORT size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed = 0) noexcept;
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
@ -106,7 +106,7 @@ private:
#ifndef QT_NO_DEBUG_STREAM
friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam);
#endif
friend Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) noexcept;
friend Q_NETWORK_EXPORT size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed) noexcept;
};
Q_DECLARE_SHARED(QSslDiffieHellmanParameters)

View File

@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
\fn uint qHash(QSslEllipticCurve curve, uint seed)
\fn size_t qHash(QSslEllipticCurve curve, size_t seed)
\since 5.5
\relates QHash

View File

@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QSslEllipticCurve;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed = 0) noexcept;
Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed = 0) noexcept;
class QSslEllipticCurve {
public:
@ -78,7 +78,7 @@ private:
int id;
friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept;
friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) noexcept;
friend Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept;
friend class QSslContext;
friend class QSslSocketPrivate;
@ -87,7 +87,7 @@ private:
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
Q_DECL_CONSTEXPR inline uint qHash(QSslEllipticCurve curve, uint seed) noexcept
Q_DECL_CONSTEXPR inline size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept
{ return qHash(curve.id, seed); }
Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept

Some files were not shown because too many files have changed in this diff Show More