From 538386f36fcf1dba7d6a0e71d1fb6861ce297558 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 25 Mar 2012 08:18:15 +0100 Subject: [PATCH] QLatin1String: add qHash overload It was never introduced in Qt 4, probably because of the implicit conversion to QString (that is, adding the qHash overload for QLatin1String in Qt 4 would have been a BIC). Change-Id: I2ebc8e73a85be497866820e0ca416dd11167bb53 Reviewed-by: Robin Burchell --- src/corelib/tools/qhash.cpp | 6 ++++++ src/corelib/tools/qhash.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 52a1eedc3f..863e37605d 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -136,6 +136,11 @@ uint qHash(const QBitArray &bitArray, uint seed) return result; } +uint qHash(const QLatin1String &key, uint seed) +{ + return hash(reinterpret_cast(key.data()), key.size(), seed); +} + /*! \internal @@ -618,6 +623,7 @@ void QHashData::checkSanity() \fn uint qHash(const QBitArray &key, uint seed = 0) \fn uint qHash(const QString &key, uint seed = 0) \fn uint qHash(const QStringRef &key, uint seed = 0) + \fn uint qHash(const QLatin1String &key, uint seed = 0) \relates QHash \since 5.0 diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index e5606c6935..8fe66aac76 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -88,6 +88,7 @@ Q_CORE_EXPORT uint qHash(const QByteArray &key, uint seed = 0); Q_CORE_EXPORT uint qHash(const QString &key, uint seed = 0); Q_CORE_EXPORT uint qHash(const QStringRef &key, uint seed = 0); Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed = 0); +Q_CORE_EXPORT uint qHash(const QLatin1String &key, uint seed = 0); #if defined(Q_CC_MSVC) #pragma warning( push )