File indexing completed on 2024-04-28 04:58:10

0001 // /* This file is part of the KDE project
0002 //     SPDX-FileCopyrightText: 2023 Stefano Crocco <stefano.crocco@alice.it>
0003 // 
0004 //     SPDX-License-Identifier: LGPL-2.0-or-later
0005 // */
0006 
0007 #include "asyncselectorinterface.h"
0008 
0009 AsyncSelectorInterface::~AsyncSelectorInterface()
0010 {
0011 }
0012 
0013 AsyncSelectorInterface::QueryMethods AsyncSelectorInterface::supportedAsyncQueryMethods() const
0014 {
0015     return None;
0016 }
0017 
0018 #if QT_VERSION_MAJOR > 5
0019 
0020 //Code for this class copied from kparts/selectorinterface.cpp (KF 5.110) written by David Faure <faure@kde.org>
0021 class Q_DECL_HIDDEN AsyncSelectorInterface::ElementPrivate : public QSharedData
0022 {
0023 public:
0024     QString tag;
0025     QHash<QString, QString> attributes;
0026 };
0027 
0028 AsyncSelectorInterface::Element::Element()
0029     : d(new ElementPrivate)
0030 {
0031 }
0032 
0033 AsyncSelectorInterface::Element::Element(const AsyncSelectorInterface::Element &other)
0034     : d(other.d)
0035 {
0036 }
0037 
0038 AsyncSelectorInterface::Element::~Element()
0039 {
0040 }
0041 
0042 bool AsyncSelectorInterface::Element::isNull() const
0043 {
0044     return d->tag.isNull();
0045 }
0046 
0047 void AsyncSelectorInterface::Element::setTagName(const QString &tag)
0048 {
0049     d->tag = tag;
0050 }
0051 
0052 QString AsyncSelectorInterface::Element::tagName() const
0053 {
0054     return d->tag;
0055 }
0056 
0057 void AsyncSelectorInterface::Element::setAttribute(const QString &name, const QString &value)
0058 {
0059     d->attributes[name] = value; // insert or replace
0060 }
0061 
0062 QStringList AsyncSelectorInterface::Element::attributeNames() const
0063 {
0064     return d->attributes.keys();
0065 }
0066 
0067 QString AsyncSelectorInterface::Element::attribute(const QString &name, const QString &defaultValue) const
0068 {
0069     return d->attributes.value(name, defaultValue);
0070 }
0071 
0072 bool AsyncSelectorInterface::Element::hasAttribute(const QString &name) const
0073 {
0074     return d->attributes.contains(name);
0075 }
0076 
0077 #endif