author | harlekin <harlekin> | 2002-03-19 00:18:04 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-19 00:18:04 (UTC) |
commit | 342ac04976065864b351c6b36087a483a8932da7 (patch) (unidiff) | |
tree | 646a89071882378786532ff587ac0e6e8fd0df03 /libopie/xmltree.h | |
parent | 02bd3d07a8949bdfe0fe708ff8f3c01bc84fab08 (diff) | |
download | opie-342ac04976065864b351c6b36087a483a8932da7.zip opie-342ac04976065864b351c6b36087a483a8932da7.tar.gz opie-342ac04976065864b351c6b36087a483a8932da7.tar.bz2 |
along with tododb
-rw-r--r-- | libopie/xmltree.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/xmltree.h b/libopie/xmltree.h index 7f1b7b7..7f50365 100644 --- a/libopie/xmltree.h +++ b/libopie/xmltree.h | |||
@@ -23,88 +23,90 @@ | |||
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * A small xml lib written by Simon Hausmann. | 29 | * A small xml lib written by Simon Hausmann. |
30 | */ | 30 | */ |
31 | class XMLElement | 31 | class XMLElement |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | typedef QMap<QString, QString> AttributeMap; | 34 | typedef QMap<QString, QString> AttributeMap; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * The constructor of XMLElement | 37 | * The constructor of XMLElement |
38 | */ | 38 | */ |
39 | XMLElement(); | 39 | XMLElement(); |
40 | ~XMLElement(); | 40 | ~XMLElement(); |
41 | 41 | ||
42 | /** appendChild appends a child to the XMLElement behind the last element. | 42 | /** appendChild appends a child to the XMLElement behind the last element. |
43 | * The ownership of the child get's transfered to the | 43 | * The ownership of the child get's transfered to the |
44 | * this XMLElement. | 44 | * this XMLElement. |
45 | * If child is already the child of another parent | 45 | * If child is already the child of another parent |
46 | * it's get removed from the other parent first. | 46 | * it's get removed from the other parent first. |
47 | */ | 47 | */ |
48 | void appendChild( XMLElement *child ); | 48 | void appendChild( XMLElement *child ); |
49 | 49 | ||
50 | /** inserts newChild after refChild. If newChild is the child | 50 | /** inserts newChild after refChild. If newChild is the child |
51 | * of another parent the child will get removed. | 51 | * of another parent the child will get removed. |
52 | * The ownership of child gets transfered. | 52 | * The ownership of child gets transfered. |
53 | * | 53 | * |
54 | */ | 54 | */ |
55 | void insertAfter( XMLElement *newChild, XMLElement *refChild ); | 55 | void insertAfter( XMLElement *newChild, XMLElement *refChild ); |
56 | 56 | ||
57 | /** same as insertAfter but the element get's inserted before refChild. | 57 | /** same as insertAfter but the element get's inserted before refChild. |
58 | * | 58 | * |
59 | */ | 59 | */ |
60 | void insertBefore( XMLElement *newChild, XMLElement *refChild ); | 60 | void insertBefore( XMLElement *newChild, XMLElement *refChild ); |
61 | 61 | ||
62 | /** removeChild removes the child from the XMLElement. | 62 | /** removeChild removes the child from the XMLElement. |
63 | * The ownership gets dropped. You need to delete the | 63 | * The ownership gets dropped. You need to delete the |
64 | * child yourself. | 64 | * child yourself. |
65 | */ | 65 | */ |
66 | void removeChild( XMLElement *child ); | 66 | void removeChild( XMLElement *child ); |
67 | 67 | ||
68 | /** parent() returns the parent of this XMLElement | 68 | /** parent() returns the parent of this XMLElement |
69 | * If there is no parent 0l gets returned | 69 | * If there is no parent 0l gets returned |
70 | */ | 70 | */ |
71 | XMLElement *parent() const { return m_parent; } | 71 | XMLElement *parent() const { return m_parent; } |
72 | XMLElement *firstChild() const { return m_first; } | 72 | XMLElement *firstChild() const { return m_first; } |
73 | XMLElement *nextChild() const { return m_next; } | 73 | XMLElement *nextChild() const { return m_next; } |
74 | XMLElement *prevChild() const { return m_prev; } | 74 | XMLElement *prevChild() const { return m_prev; } |
75 | XMLElement *lastChild() const { return m_last; } | 75 | XMLElement *lastChild() const { return m_last; } |
76 | 76 | ||
77 | void setTagName( const QString &tag ) { m_tag = tag; } | 77 | void setTagName( const QString &tag ) { m_tag = tag; } |
78 | QString tagName() const { return m_tag; } | 78 | QString tagName() const { return m_tag; } |
79 | 79 | ||
80 | void setValue( const QString &val ) { m_value = val; } | 80 | void setValue( const QString &val ) { m_value = val; } |
81 | QString value() const { return m_value; } | 81 | QString value() const { return m_value; } |
82 | 82 | ||
83 | void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; } | 83 | void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; } |
84 | AttributeMap attributes() const { return m_attributes; } | 84 | AttributeMap attributes() const { return m_attributes; } |
85 | AttributeMap &attributes() { return m_attributes; } | 85 | AttributeMap &attributes() { return m_attributes; } |
86 | 86 | ||
87 | QString attribute(const QString &)const; | ||
88 | void setAttribute( const QString &attr, const QString &value ); | ||
87 | void save( QTextStream &stream, uint indent = 0 ); | 89 | void save( QTextStream &stream, uint indent = 0 ); |
88 | 90 | ||
89 | XMLElement *namedItem( const QString &name ); | 91 | XMLElement *namedItem( const QString &name ); |
90 | 92 | ||
91 | XMLElement *clone() const; | 93 | XMLElement *clone() const; |
92 | 94 | ||
93 | static XMLElement *load( const QString &fileName ); | 95 | static XMLElement *load( const QString &fileName ); |
94 | 96 | ||
95 | private: | 97 | private: |
96 | QString m_tag; | 98 | QString m_tag; |
97 | QString m_value; | 99 | QString m_value; |
98 | AttributeMap m_attributes; | 100 | AttributeMap m_attributes; |
99 | 101 | ||
100 | XMLElement *m_parent; | 102 | XMLElement *m_parent; |
101 | XMLElement *m_next; | 103 | XMLElement *m_next; |
102 | XMLElement *m_prev; | 104 | XMLElement *m_prev; |
103 | XMLElement *m_first; | 105 | XMLElement *m_first; |
104 | XMLElement *m_last; | 106 | XMLElement *m_last; |
105 | 107 | ||
106 | XMLElement( const XMLElement &rhs ); | 108 | XMLElement( const XMLElement &rhs ); |
107 | XMLElement &operator=( const XMLElement &rhs ); | 109 | XMLElement &operator=( const XMLElement &rhs ); |
108 | }; | 110 | }; |
109 | 111 | ||
110 | #endif | 112 | #endif |