KParts

selectorinterface.cpp
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2010 David Faure <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "selectorinterface.h"
9 
10 #include <QHash>
11 
12 using namespace KParts;
13 
15 {
17 }
18 
19 class Q_DECL_HIDDEN SelectorInterface::ElementPrivate : public QSharedData
20 {
21 public:
22  QString tag;
23  QHash<QString, QString> attributes;
24 };
25 
26 SelectorInterface::Element::Element()
27  : d(new ElementPrivate)
28 {
29 }
30 
31 SelectorInterface::Element::Element(const SelectorInterface::Element &other)
32  : d(other.d)
33 {
34 }
35 
36 SelectorInterface::Element::~Element()
37 {
38 }
39 
40 bool SelectorInterface::Element::isNull() const
41 {
42  return d->tag.isNull();
43 }
44 
45 void SelectorInterface::Element::setTagName(const QString &tag)
46 {
47  d->tag = tag;
48 }
49 
50 QString SelectorInterface::Element::tagName() const
51 {
52  return d->tag;
53 }
54 
55 void SelectorInterface::Element::setAttribute(const QString &name, const QString &value)
56 {
57  d->attributes[name] = value; // insert or replace
58 }
59 
60 QStringList SelectorInterface::Element::attributeNames() const
61 {
62  return d->attributes.keys();
63 }
64 
65 QString SelectorInterface::Element::attribute(const QString &name, const QString &defaultValue) const
66 {
67  return d->attributes.value(name, defaultValue);
68 }
69 
70 bool SelectorInterface::Element::hasAttribute(const QString &name) const
71 {
72  return d->attributes.contains(name);
73 }
virtual QueryMethods supportedQueryMethods() const
Returns the supported query methods.
Optional base class for HtmlExtension-derived classes Provides DOM Selector like API: querySelector a...
const char * name(StandardAction id)
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
The KParts namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 03:51:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.