diff options
Diffstat (limited to 'src/corelib/io/qurlquery.cpp')
-rw-r--r-- | src/corelib/io/qurlquery.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 77d1ab3e24..2b695a4f7b 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -34,6 +34,7 @@ #include "qurlquery.h" #include "qurl_p.h" +#include <QtCore/qhashfunctions.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE @@ -407,6 +408,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const if (d == other.d) return true; if (d && other.d) + // keep in sync with qHash(QUrlQuery): return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList; @@ -414,6 +416,25 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const } /*! + \since 5.6 + \relates QUrlQuery + + Returns the hash value for \a key, + using \a seed to seed the calculation. +*/ +uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW +{ + if (const QUrlQueryPrivate *d = key.d) { + QtPrivate::QHashCombine hash; + // keep in sync with operator==: + seed = hash(seed, d->valueDelimiter); + seed = hash(seed, d->pairDelimiter); + seed = hash(seed, d->itemList); + } + return seed; +} + +/*! Returns \c true if this QUrlQuery object contains no key-value pairs, such as after being default-constructed or after parsing an empty query string. @@ -621,6 +642,7 @@ QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingO QList<QPair<QString, QString> > result; Map::const_iterator it = d->itemList.constBegin(); Map::const_iterator end = d->itemList.constEnd(); + result.reserve(d->itemList.count()); for ( ; it != end; ++it) result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding)); |