QLatin1String: add qHash overload
authorGiuseppe D'Angelo <dangelog@gmail.com>
Sun, 25 Mar 2012 07:18:15 +0000 (08:18 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 5 Apr 2012 18:48:53 +0000 (20:48 +0200)
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 <robin+qt@viroteck.net>
src/corelib/tools/qhash.cpp
src/corelib/tools/qhash.h

index 52a1eed..863e376 100644 (file)
@@ -136,6 +136,11 @@ uint qHash(const QBitArray &bitArray, uint seed)
     return result;
 }
 
+uint qHash(const QLatin1String &key, uint seed)
+{
+    return hash(reinterpret_cast<const uchar *>(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
index e5606c6..8fe66aa 100644 (file)
@@ -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 )