Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtCore/qurlquery.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // Copyright (C) 2016 Intel Corporation.
0003 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0004 
0005 #ifndef QURLQUERY_H
0006 #define QURLQUERY_H
0007 
0008 #include <QtCore/qshareddata.h>
0009 #include <QtCore/qurl.h>
0010 
0011 #include <initializer_list>
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed = 0) noexcept;
0016 
0017 class QUrlQueryPrivate;
0018 class Q_CORE_EXPORT QUrlQuery
0019 {
0020 public:
0021     QUrlQuery();
0022     explicit QUrlQuery(const QUrl &url);
0023     explicit QUrlQuery(const QString &queryString);
0024     QUrlQuery(std::initializer_list<std::pair<QString, QString>> list)
0025         : QUrlQuery()
0026     {
0027         for (const std::pair<QString, QString> &item : list)
0028             addQueryItem(item.first, item.second);
0029     }
0030 
0031     QUrlQuery(const QUrlQuery &other);
0032     QUrlQuery(QUrlQuery &&other) noexcept;
0033     QUrlQuery &operator=(const QUrlQuery &other);
0034     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrlQuery)
0035     ~QUrlQuery();
0036 
0037     bool operator==(const QUrlQuery &other) const;
0038     bool operator!=(const QUrlQuery &other) const
0039     { return !(*this == other); }
0040 
0041     void swap(QUrlQuery &other) noexcept { d.swap(other.d); }
0042 
0043     bool isEmpty() const;
0044     bool isDetached() const;
0045     void clear();
0046 
0047     QString query(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
0048     void setQuery(const QString &queryString);
0049     QString toString(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const
0050     { return query(encoding); }
0051 
0052     void setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter);
0053     QChar queryValueDelimiter() const;
0054     QChar queryPairDelimiter() const;
0055 
0056     void setQueryItems(const QList<std::pair<QString, QString> > &query);
0057     QList<std::pair<QString, QString> > queryItems(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
0058 
0059     bool hasQueryItem(const QString &key) const;
0060     void addQueryItem(const QString &key, const QString &value);
0061     void removeQueryItem(const QString &key);
0062     QString queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
0063     QStringList allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
0064     void removeAllQueryItems(const QString &key);
0065 
0066     static constexpr char16_t defaultQueryValueDelimiter() noexcept { return u'='; }
0067     static constexpr char16_t defaultQueryPairDelimiter() noexcept { return u'&'; }
0068 
0069 private:
0070     friend class QUrl;
0071     friend Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed) noexcept;
0072     QSharedDataPointer<QUrlQueryPrivate> d;
0073 
0074 public:
0075     typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;
0076     inline DataPtr &data_ptr() { return d; }
0077 };
0078 
0079 Q_DECLARE_SHARED(QUrlQuery)
0080 
0081 QT_END_NAMESPACE
0082 
0083 #endif // QURLQUERY_H