summaryrefslogtreecommitdiff
path: root/libopie/xmltree.cc
authorsimon <simon>2002-04-30 14:26:53 (UTC)
committer simon <simon>2002-04-30 14:26:53 (UTC)
commit5dae945f8ec25a811efb10eb71d606ce8da4429f (patch) (unidiff)
treec12689435fbfb2abd6aedfcbd88208c1cb69407f /libopie/xmltree.cc
parent3c1b87ffa621f872c72228733a078511e56d2daf (diff)
downloadopie-5dae945f8ec25a811efb10eb71d606ce8da4429f.zip
opie-5dae945f8ec25a811efb10eb71d606ce8da4429f.tar.gz
opie-5dae945f8ec25a811efb10eb71d606ce8da4429f.tar.bz2
- put the xml tree classes into the Opie namespace
Diffstat (limited to 'libopie/xmltree.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/xmltree.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/xmltree.cc b/libopie/xmltree.cc
index 408e3c6..27db5b3 100644
--- a/libopie/xmltree.cc
+++ b/libopie/xmltree.cc
@@ -1,90 +1,91 @@
1/* This file is part of the KDE project 1/* This file is part of the KDE project
2 Copyright (C) 2001 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2001 Simon Hausmann <hausmann@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 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 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, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qpe/stringutil.h> 20#include <qpe/stringutil.h>
21#include <opie/xmltree.h> 21#include <opie/xmltree.h>
22 22
23#include <qxml.h> 23#include <qxml.h>
24 24
25#include <assert.h> 25#include <assert.h>
26 26
27using namespace Opie;
27 28
28XMLElement::XMLElement() 29XMLElement::XMLElement()
29 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) 30 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 )
30{ 31{
31} 32}
32 33
33XMLElement::~XMLElement() 34XMLElement::~XMLElement()
34{ 35{
35 XMLElement *n = m_first; 36 XMLElement *n = m_first;
36 37
37 while ( n ) 38 while ( n )
38 { 39 {
39 XMLElement *tmp = n; 40 XMLElement *tmp = n;
40 n = n->m_next; 41 n = n->m_next;
41 delete tmp; 42 delete tmp;
42 } 43 }
43} 44}
44 45
45void XMLElement::appendChild( XMLElement *child ) 46void XMLElement::appendChild( XMLElement *child )
46{ 47{
47 if ( child->m_parent ) 48 if ( child->m_parent )
48 child->m_parent->removeChild( child ); 49 child->m_parent->removeChild( child );
49 50
50 child->m_parent = this; 51 child->m_parent = this;
51 52
52 if ( m_last ) 53 if ( m_last )
53 m_last->m_next = child; 54 m_last->m_next = child;
54 55
55 child->m_prev = m_last; 56 child->m_prev = m_last;
56 57
57 if ( !m_first ) 58 if ( !m_first )
58 m_first = child; 59 m_first = child;
59 60
60 m_last = child; 61 m_last = child;
61} 62}
62 63
63void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild ) 64void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
64{ 65{
65 assert( newChild != refChild ); 66 assert( newChild != refChild );
66 67
67 if ( refChild == m_last ) 68 if ( refChild == m_last )
68 { 69 {
69 appendChild( newChild ); 70 appendChild( newChild );
70 return; 71 return;
71 } 72 }
72 73
73 assert( refChild ); 74 assert( refChild );
74 assert( refChild->m_parent ); 75 assert( refChild->m_parent );
75 assert( refChild->m_parent == this ); 76 assert( refChild->m_parent == this );
76 77
77 if ( newChild->m_parent && newChild != refChild ) 78 if ( newChild->m_parent && newChild != refChild )
78 newChild->m_parent->removeChild( newChild ); 79 newChild->m_parent->removeChild( newChild );
79 80
80 newChild->m_parent = this; 81 newChild->m_parent = this;
81 82
82 XMLElement *next = refChild->m_next; 83 XMLElement *next = refChild->m_next;
83 84
84 refChild->m_next = newChild; 85 refChild->m_next = newChild;
85 86
86 newChild->m_prev = refChild; 87 newChild->m_prev = refChild;
87 newChild->m_next = next; 88 newChild->m_next = next;
88 89
89 if ( next ) 90 if ( next )
90 next->m_prev = newChild; 91 next->m_prev = newChild;