File indexing completed on 2024-04-28 16:44:07
0001 /* 0002 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0003 SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org> 0004 */ 0005 0006 #pragma once 0007 0008 #include <QMultiMap> 0009 #include <QString> 0010 0011 namespace Bugzilla 0012 { 0013 // Query container. Do not use QUrlQuery. Since bugzilla wants more encoding 0014 // than QUrlQuery would provide by default we always store the input values 0015 // in this Query container. Only once we are actually ready to construct 0016 // the final request is this container converted to a QUrlQuery. 0017 // 0018 // NB: This class intentionally has no QUrlQuery converter function because 0019 // any behavior we need must be implemented in this container, not run 0020 // through QUrlQuery to prevent encoding confusion. 0021 // 0022 // QMap is used as base because order makes test assertions easier to check. 0023 class Query : public QMultiMap<QString, QString> 0024 { 0025 public: 0026 using QMultiMap<QString, QString>::QMultiMap; 0027 0028 // Compat rigging so this feels like QUrlQuery and reduces porting 0029 // noise for bugfix backport. 0030 bool hasQueryItem(const QString &key); 0031 void addQueryItem(const QString &key, const QString &value); 0032 0033 // Don't use this to do anything other than streaming to qDebug. 0034 // The output is not encoded and thus not necessarily a valid URL query. 0035 QString toString() const; 0036 }; 0037 0038 } // namespace Bugzilla