summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2012-07-02 09:01:56 +0100
committerQt by Nokia <qt-info@nokia.com>2012-07-23 19:57:07 +0200
commit58ec01e278496bdaaee05546beb543a119de4277 (patch)
tree7a4437101eb0acaff913ad4696626b2b8cfa149d /src/corelib/plugin
parentacbfb4d777474aadd28136141082a8114d4310ac (diff)
More qHash(T, uint) support
Add the seed to QPair, QUuid, QPersistentModelIndex's qHash(), and fix qHash documentation for them and for many other datatypes. Change-Id: I1386f3ed42ee1a832371a242ee5c82895ba92c2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/quuid.cpp15
-rw-r--r--src/corelib/plugin/quuid.h2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index bfe8dfc3c4..952e41851a 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -999,14 +999,17 @@ QDebug operator<<(QDebug dbg, const QUuid &id)
}
#endif
-/**
- Returns a hash of the QUuid
- */
-uint qHash(const QUuid &uuid)
+/*!
+ \since 5.0
+ \relates QUuid
+ Returns a hash of the UUID \a uuid, using \a seed to seed the calculation.
+*/
+uint qHash(const QUuid &uuid, uint seed)
{
return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
- ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
- ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]);
+ ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
+ ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7])
+ ^ seed;
}
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index e595613e8f..7fd32a307b 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -227,7 +227,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);
+Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0);
QT_END_NAMESPACE