diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2010-01-12 18:10:12 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2010-01-13 09:06:20 (GMT) |
commit | b38da980696e69b61d2f5411ad2f2c36453ed089 (patch) | |
tree | 8a9e8160ea104ddd23706ea185e87320bb6f4708 | |
parent | 22796b38c3a7dbcdb540e4c58e645b0267fe360c (diff) | |
download | Qt-b38da980696e69b61d2f5411ad2f2c36453ed089.zip Qt-b38da980696e69b61d2f5411ad2f2c36453ed089.tar.gz Qt-b38da980696e69b61d2f5411ad2f2c36453ed089.tar.bz2 |
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
-rw-r--r-- | src/corelib/io/qurl.h | 7 | ||||
-rw-r--r-- | 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 <QtCore/qobjectdefs.h> #include <QtCore/qpair.h> #include <QtCore/qstring.h> +#include <QtCore/qhash.h> 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 |