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 #include "query.h" 0007 0008 namespace Bugzilla 0009 { 0010 bool Query::hasQueryItem(const QString &key) 0011 { 0012 return contains(key); 0013 } 0014 0015 void Query::addQueryItem(const QString &key, const QString &value) 0016 { 0017 insert(key, value); 0018 } 0019 0020 // Don't use this to do anything other than streaming to qDebug. 0021 // The output is not encoded and thus not necessarily a valid URL query. 0022 QString Query::toString() const 0023 { 0024 QString output; 0025 for (auto it = cbegin(); it != cend(); ++it) { 0026 if (!output.isEmpty()) { 0027 output += QStringLiteral("&"); 0028 } 0029 output += it.key() + QStringLiteral("=") + it.value(); 0030 } 0031 return output; 0032 } 0033 0034 } // namespace Bugzilla