From b38da980696e69b61d2f5411ad2f2c36453ed089 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 12 Jan 2010 19:10:12 +0100 Subject: add a hash function to QUrl, and remove the xmlpatterns specific one we had a hash function defined in xmlpatterns; this commit adds a global hash function for QUrls. Beware that code that defines its own hash function for QUrls will need to #ifdef it out for 4.7. Patch-By: Warwick Allison Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.h | 7 +++++++ src/xmlpatterns/type/qprimitives_p.h | 14 -------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index f76d345..bb04ad1 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -75,6 +76,7 @@ public: RemovePath = 0x20, RemoveQuery = 0x40, RemoveFragment = 0x80, + // 0x100: private: normalized StripTrailingSlash = 0x10000 }; @@ -268,6 +270,11 @@ public: inline DataPtr &data_ptr() { return d; } }; +inline uint qHash(const QUrl &uri) +{ + return qHash(uri.toEncoded(QUrl::FormattingOption(0x100))); +} + Q_DECLARE_TYPEINFO(QUrl, Q_MOVABLE_TYPE); Q_DECLARE_SHARED(QUrl) Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions) diff --git a/src/xmlpatterns/type/qprimitives_p.h b/src/xmlpatterns/type/qprimitives_p.h index 01c04a1..d86fa4f 100644 --- a/src/xmlpatterns/type/qprimitives_p.h +++ b/src/xmlpatterns/type/qprimitives_p.h @@ -79,18 +79,6 @@ class QString; */ namespace QPatternist { - - /** - * @internal - * - * A method to allow a QHash or QSet with QUrl - * as key type. - */ - inline uint qHash(const QUrl &uri) - { - return qHash(uri.toString()); - } - /** * @defgroup Patternist_cppWXSTypes C++ Primitives for W3C XML Schema Number Types * @@ -208,8 +196,6 @@ namespace QPatternist QString Q_AUTOTEST_EXPORT escape(const QString &input); } -using QPatternist::qHash; - QT_END_NAMESPACE QT_END_HEADER -- cgit v0.12