libopie API Documentation

xmltree.h

00001 /*  This file is part of the KDE project
00002     Copyright (C) 2000,2001 Simon Hausmann <hausmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
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 } // namespace Opie
00118 
00119 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:46 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001