xmltree.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __bookmarks_h__
00022 #define __bookmarks_h__
00023
00024 #include <qstring.h>
00025 #include <qmap.h>
00026 #include <qtextstream.h>
00027
00028 namespace Opie
00029 {
00030
00034 class XMLElement
00035 {
00036 public:
00037 typedef QMap<QString, QString> AttributeMap;
00038
00042 XMLElement();
00043 ~XMLElement();
00044
00051 void appendChild( XMLElement *child );
00052
00058 void insertAfter( XMLElement *newChild, XMLElement *refChild );
00059
00063 void insertBefore( XMLElement *newChild, XMLElement *refChild );
00064
00069 void removeChild( XMLElement *child );
00070
00074 XMLElement *parent() const { return m_parent; }
00075 XMLElement *firstChild() const { return m_first; }
00076 XMLElement *nextChild() const { return m_next; }
00077 XMLElement *prevChild() const { return m_prev; }
00078 XMLElement *lastChild() const { return m_last; }
00079
00080 void setTagName( const QString &tag ) { m_tag = tag; }
00081 QString tagName() const { return m_tag; }
00082
00083 void setValue( const QString &val ) { m_value = val; }
00084 QString value() const { return m_value; }
00085
00086 void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; }
00087 AttributeMap attributes() const { return m_attributes; }
00088 AttributeMap &attributes() { return m_attributes; }
00089
00090 QString attribute( const QString & ) const;
00091 void setAttribute( const QString &attr, const QString &value );
00092 void save( QTextStream &stream, uint indent = 0 );
00093
00094 XMLElement *namedItem( const QString &name );
00095
00096 XMLElement *clone() const;
00097
00098 static XMLElement *load( const QString &fileName );
00099
00100 private:
00101 QString m_tag;
00102 QString m_value;
00103 AttributeMap m_attributes;
00104
00105 XMLElement *m_parent;
00106 XMLElement *m_next;
00107 XMLElement *m_prev;
00108 XMLElement *m_first;
00109 XMLElement *m_last;
00110
00111 XMLElement( const XMLElement &rhs );
00112 XMLElement &operator=( const XMLElement &rhs );
00113 class Private;
00114 Private* d;
00115 };
00116
00117 }
00118
00119 #endif
This file is part of the documentation for OPIE Version 1.1.