summaryrefslogtreecommitdiff
path: root/include
authorkergoth <kergoth>2002-03-16 04:59:45 (UTC)
committer kergoth <kergoth>2002-03-16 04:59:45 (UTC)
commita4ae0b213389af1ca002b684d2493786311ab60f (patch) (unidiff)
tree67b729a64a50ed2dcab3cb5a6367d7ea72b15d80 /include
parent20cbfeefd68221f7b6f9dd512c6ff3e9a9484af2 (diff)
downloadopie-a4ae0b213389af1ca002b684d2493786311ab60f.zip
opie-a4ae0b213389af1ca002b684d2493786311ab60f.tar.gz
opie-a4ae0b213389af1ca002b684d2493786311ab60f.tar.bz2
mark: added .pro for libopie. moved .h to includedir.
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opie/xmltree.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/include/opie/xmltree.h b/include/opie/xmltree.h
new file mode 100644
index 0000000..7f1b7b7
--- a/dev/null
+++ b/include/opie/xmltree.h
@@ -0,0 +1,110 @@
1/* This file is part of the KDE project
2 Copyright (C) 2000,2001 Simon Hausmann <hausmann@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18*/
19
20
21#ifndef __bookmarks_h__
22#define __bookmarks_h__
23
24#include <qstring.h>
25#include <qmap.h>
26#include <qtextstream.h>
27
28/**
29 * A small xml lib written by Simon Hausmann.
30 */
31class XMLElement
32{
33public:
34 typedef QMap<QString, QString> AttributeMap;
35
36 /**
37 * The constructor of XMLElement
38 */
39 XMLElement();
40 ~XMLElement();
41
42 /** appendChild appends a child to the XMLElement behind the last element.
43 * The ownership of the child get's transfered to the
44 * this XMLElement.
45 * If child is already the child of another parent
46 * it's get removed from the other parent first.
47 */
48 void appendChild( XMLElement *child );
49
50 /** inserts newChild after refChild. If newChild is the child
51 * of another parent the child will get removed.
52 * The ownership of child gets transfered.
53 *
54 */
55 void insertAfter( XMLElement *newChild, XMLElement *refChild );
56
57 /** same as insertAfter but the element get's inserted before refChild.
58 *
59 */
60 void insertBefore( XMLElement *newChild, XMLElement *refChild );
61
62 /** removeChild removes the child from the XMLElement.
63 * The ownership gets dropped. You need to delete the
64 * child yourself.
65 */
66 void removeChild( XMLElement *child );
67
68 /** parent() returns the parent of this XMLElement
69 * If there is no parent 0l gets returned
70 */
71 XMLElement *parent() const { return m_parent; }
72 XMLElement *firstChild() const { return m_first; }
73 XMLElement *nextChild() const { return m_next; }
74 XMLElement *prevChild() const { return m_prev; }
75 XMLElement *lastChild() const { return m_last; }
76
77 void setTagName( const QString &tag ) { m_tag = tag; }
78 QString tagName() const { return m_tag; }
79
80 void setValue( const QString &val ) { m_value = val; }
81 QString value() const { return m_value; }
82
83 void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; }
84 AttributeMap attributes() const { return m_attributes; }
85 AttributeMap &attributes() { return m_attributes; }
86
87 void save( QTextStream &stream, uint indent = 0 );
88
89 XMLElement *namedItem( const QString &name );
90
91 XMLElement *clone() const;
92
93 static XMLElement *load( const QString &fileName );
94
95private:
96 QString m_tag;
97 QString m_value;
98 AttributeMap m_attributes;
99
100 XMLElement *m_parent;
101 XMLElement *m_next;
102 XMLElement *m_prev;
103 XMLElement *m_first;
104 XMLElement *m_last;
105
106 XMLElement( const XMLElement &rhs );
107 XMLElement &operator=( const XMLElement &rhs );
108};
109
110#endif