QXmpp  Version:0.9.1
QXmppElement.h
1 /*
2  * Copyright (C) 2008-2014 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPELEMENT_H
25 #define QXMPPELEMENT_H
26 
27 #include <QMap>
28 #include <QStringList>
29 #include <QXmlStreamWriter>
30 
31 #include "QXmppGlobal.h"
32 
33 class QDomElement;
34 class QXmppElement;
35 class QXmppElementPrivate;
36 
37 typedef QList<QXmppElement> QXmppElementList;
38 class QXMPP_EXPORT QXmppElement
39 {
40 public:
41  QXmppElement();
42  QXmppElement(const QXmppElement &other);
43  QXmppElement(const QDomElement &element);
44  ~QXmppElement();
45 
46  QDomElement sourceDomElement() const;
47 
48  QStringList attributeNames() const;
49 
50  QString attribute(const QString &name) const;
51  void setAttribute(const QString &name, const QString &value);
52 
53  void appendChild(const QXmppElement &child);
54  QXmppElement firstChildElement(const QString &name = QString()) const;
55  QXmppElement nextSiblingElement(const QString &name = QString()) const;
56  void removeChild(const QXmppElement &child);
57 
58  QString tagName() const;
59  void setTagName(const QString &type);
60 
61  QString value() const;
62  void setValue(const QString &text);
63 
64  bool isNull() const;
65  void toXml(QXmlStreamWriter *writer) const;
66 
67  QXmppElement &operator=(const QXmppElement &other);
68 
69 private:
70  QXmppElement(QXmppElementPrivate *other);
71  QXmppElementPrivate *d;
72 };
73 
74 #endif