summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <dangelog@gmail.com>2012-03-25 08:18:15 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-05 20:48:53 +0200
commit538386f36fcf1dba7d6a0e71d1fb6861ce297558 (patch)
tree82c2376e2bad80c866d65472e29e85692614e4d3 /src
parent2d89850b23eefe1ca497e8480191138badd17847 (diff)
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 <robin+qt@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qhash.cpp6
-rw-r--r--src/corelib/tools/qhash.h1
2 files changed, 7 insertions, 0 deletions
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<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
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 )