File indexing completed on 2024-04-28 15:29:24
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2010 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "selectorinterface.h" 0009 0010 #include <QHash> 0011 0012 using namespace KParts; 0013 0014 SelectorInterface::QueryMethods SelectorInterface::supportedQueryMethods() const 0015 { 0016 return KParts::SelectorInterface::None; 0017 } 0018 0019 class Q_DECL_HIDDEN SelectorInterface::ElementPrivate : public QSharedData 0020 { 0021 public: 0022 QString tag; 0023 QHash<QString, QString> attributes; 0024 }; 0025 0026 SelectorInterface::Element::Element() 0027 : d(new ElementPrivate) 0028 { 0029 } 0030 0031 SelectorInterface::Element::Element(const SelectorInterface::Element &other) 0032 : d(other.d) 0033 { 0034 } 0035 0036 SelectorInterface::Element::~Element() 0037 { 0038 } 0039 0040 bool SelectorInterface::Element::isNull() const 0041 { 0042 return d->tag.isNull(); 0043 } 0044 0045 void SelectorInterface::Element::setTagName(const QString &tag) 0046 { 0047 d->tag = tag; 0048 } 0049 0050 QString SelectorInterface::Element::tagName() const 0051 { 0052 return d->tag; 0053 } 0054 0055 void SelectorInterface::Element::setAttribute(const QString &name, const QString &value) 0056 { 0057 d->attributes[name] = value; // insert or replace 0058 } 0059 0060 QStringList SelectorInterface::Element::attributeNames() const 0061 { 0062 return d->attributes.keys(); 0063 } 0064 0065 QString SelectorInterface::Element::attribute(const QString &name, const QString &defaultValue) const 0066 { 0067 return d->attributes.value(name, defaultValue); 0068 } 0069 0070 bool SelectorInterface::Element::hasAttribute(const QString &name) const 0071 { 0072 return d->attributes.contains(name); 0073 }