QUrl: added two-arguments qHash support
An unnecessary #include <QHash> was also removed, and other includes refactored. Change-Id: Ifcd3e37d75029c142a2e55ab492b88624505670a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c3b9a67cf0
commit
9166163f10
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qobjectdefs.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qpair.h>
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user