From c3b9a67cf054c71d7dd57d91220cded62256019d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 24 Mar 2012 18:23:49 +0000 Subject: [PATCH] More qHash(T, uint) overloads for Qt types The more we get in 5.0, the better. Change-Id: If00084477709db4fc3f6b2e15024d046491be2ae Reviewed-by: Thiago Macieira --- src/corelib/tools/qregexp.cpp | 4 ++-- src/dbus/qdbusextratypes.h | 8 ++++---- src/network/kernel/qhostaddress.cpp | 4 ++-- src/network/kernel/qhostaddress.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 6462b3df92..1db0fcf44c 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -3815,9 +3815,9 @@ struct QRegExpPrivate }; #if !defined(QT_NO_REGEXP_OPTIM) -uint qHash(const QRegExpEngineKey &key) +uint qHash(const QRegExpEngineKey &key, uint seed) { - return qHash(key.pattern); + return qHash(key.pattern, seed); } typedef QCache EngineCache; diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h index d8bdf7424c..c1b8cffc79 100644 --- a/src/dbus/qdbusextratypes.h +++ b/src/dbus/qdbusextratypes.h @@ -99,8 +99,8 @@ 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) -{ return qHash(objectPath.path()); } +inline uint qHash(const QDBusObjectPath &objectPath, uint seed) +{ return qHash(objectPath.path(), seed); } class Q_DBUS_EXPORT QDBusSignature @@ -146,8 +146,8 @@ 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) -{ return qHash(signature.signature()); } +inline uint qHash(const QDBusSignature &signature, uint seed) +{ return qHash(signature.signature(), seed); } class QDBusVariant { diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 009c8f2a6a..2adf19ead4 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -1027,9 +1027,9 @@ QDebug operator<<(QDebug d, const QHostAddress &address) } #endif -uint qHash(const QHostAddress &key) +uint qHash(const QHostAddress &key, uint seed) { - return qHash(key.toString()); + return qHash(key.toString(), seed); } #ifndef QT_NO_DATASTREAM diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index fdf09ecc82..b298e3f479 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -135,7 +135,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QHostAddress &); #endif -Q_NETWORK_EXPORT uint qHash(const QHostAddress &key); +Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed = 0); #ifndef QT_NO_DATASTREAM Q_NETWORK_EXPORT QDataStream &operator<<(QDataStream &, const QHostAddress &);