summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslerror.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-09-25 16:01:09 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-10-19 07:32:41 +0200
commit32dfbd6dbf8393dcd4e4eaa557902108a2714326 (patch)
tree8e6d5ec29a1e6633a23822a320c26417923a7c44 /src/network/ssl/qsslerror.cpp
parente8bdc949fc3646ff323a4fb4b83835e089a86b77 (diff)
Add qHash(QSslError) overload
qsslsocket_winrt.cpp defined it locally, which runs the risk of clashes with a potential user-defined qHash(QSslError), so make it public. Also included both .error() and .certificate() in the hash, as both of these are used to determine equality (the WinRT version only used .error()). [ChangeLog][QtNetwork][QSslError] Can now be used in QSet/QHash. Change-Id: Ieb7995bed491ff011d4be9dad544248b56fd4f73 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'src/network/ssl/qsslerror.cpp')
-rw-r--r--src/network/ssl/qsslerror.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index ff30098347..5004e561a8 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -305,6 +305,19 @@ QSslCertificate QSslError::certificate() const
return d->certificate;
}
+/*!
+ Returns the hash value for the \a key, using \a seed to seed the calculation.
+ \since 5.4
+ \relates QHash
+*/
+uint qHash(const QSslError &key, uint seed) Q_DECL_NOTHROW
+{
+ // 2x boost::hash_combine inlined:
+ seed ^= qHash(key.error()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+ seed ^= qHash(key.certificate()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+ return seed;
+}
+
#ifndef QT_NO_DEBUG_STREAM
//class QDebug;
QDebug operator<<(QDebug debug, const QSslError &error)