From 9166163f103b8ac35544270c8cf397de3416b8f0 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 4 Apr 2012 20:19:39 +0100 Subject: QUrl: added two-arguments qHash support An unnecessary #include was also removed, and other includes refactored. Change-Id: Ifcd3e37d75029c142a2e55ab492b88624505670a Reviewed-by: Thiago Macieira --- src/corelib/io/qtldurl.cpp | 1 + src/corelib/io/qurl.cpp | 17 ++++++----------- src/corelib/io/qurl.h | 6 ++++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp index 7adb40261b..48df01b48c 100644 --- a/src/corelib/io/qtldurl.cpp +++ b/src/corelib/io/qtldurl.cpp @@ -44,6 +44,7 @@ #include "private/qurltlds_p.h" #include "private/qtldurl_p.h" #include "QtCore/qstringlist.h" +#include "QtCore/qhash.h" QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9753474617..62ad732935 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -180,19 +180,13 @@ regardless of the Qt::FormattingOptions used. */ -/*! - \fn uint qHash(const QUrl &url) - \since 4.7 - \relates QUrl - - Computes a hash key from the normalized version of \a url. - */ #include "qurl.h" #include "qurl_p.h" #include "qplatformdefs.h" #include "qstring.h" #include "qstringlist.h" #include "qdebug.h" +#include "qhash.h" #include "qdir.h" // for QDir::fromNativeSeparators #include "qtldurl_p.h" #include "private/qipaddress_p.h" @@ -2546,21 +2540,22 @@ QString QUrl::errorString() const \internal */ -/*! \fn uint qHash(const QUrl &url) +/*! \fn uint qHash(const QUrl &url, uint seed = 0) \relates QHash + \since 5.0 Returns the hash value for the \a url. */ -uint qHash(const QUrl &url) +uint qHash(const QUrl &url, uint seed) { if (!url.d) - return qHash(-1); // the hash of an unset port (-1) + return qHash(-1, seed); // the hash of an unset port (-1) return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ - qHash(url.d->port) ^ + qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment); diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 5fcbbf0c0c..068fe73401 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -46,7 +46,9 @@ #include #include #include -#include +#include +#include +#include QT_BEGIN_HEADER @@ -304,7 +306,7 @@ public: static QByteArray toAce(const QString &); static QStringList idnWhitelist(); static void setIdnWhitelist(const QStringList &); - friend Q_CORE_EXPORT uint qHash(const QUrl &url); + friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0); private: QUrlPrivate *d; -- cgit v1.2.3