summaryrefslogtreecommitdiff
path: root/libopie/xmltree.cc
authorkergoth <kergoth>2002-03-16 04:59:45 (UTC)
committer kergoth <kergoth>2002-03-16 04:59:45 (UTC)
commita4ae0b213389af1ca002b684d2493786311ab60f (patch) (unidiff)
tree67b729a64a50ed2dcab3cb5a6367d7ea72b15d80 /libopie/xmltree.cc
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 'libopie/xmltree.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/xmltree.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/xmltree.cc b/libopie/xmltree.cc
index bf93151..d5ce74a 100644
--- a/libopie/xmltree.cc
+++ b/libopie/xmltree.cc
@@ -1,85 +1,85 @@
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 20
21#include "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
27namespace 27namespace
28{ 28{
29 29
30/** 30/**
31 Encode an attribute value upon saving. 31 Encode an attribute value upon saving.
32 replaces '"' with "&quot" 32 replaces '"' with "&quot"
33 replaces '<' with "&lt" 33 replaces '<' with "&lt"
34 replaces '&' with "&amp" 34 replaces '&' with "&amp"
35 replaces '>' with "&gt" 35 replaces '>' with "&gt"
36*/ 36*/
37QString encodeAttr( const QString& str ) 37QString encodeAttr( const QString& str )
38{ 38{
39 QString encAttr( str ); // cause of the const parameter 39 QString encAttr( str ); // cause of the const parameter
40 encAttr = encAttr.replace( QRegExp( "[<]" ), "&lt" ); 40 encAttr = encAttr.replace( QRegExp( "[<]" ), "&lt" );
41 encAttr = encAttr.replace( QRegExp( "[>]" ), "&gt" ); 41 encAttr = encAttr.replace( QRegExp( "[>]" ), "&gt" );
42 encAttr = encAttr.replace( QRegExp( "[\"]" ), "&quot" ); 42 encAttr = encAttr.replace( QRegExp( "[\"]" ), "&quot" );
43 encAttr = encAttr.replace( QRegExp( "[&]" ), "&amp" ); 43 encAttr = encAttr.replace( QRegExp( "[&]" ), "&amp" );
44 return encAttr; 44 return encAttr;
45} 45}
46 46
47} 47}
48 48
49XMLElement::XMLElement() 49XMLElement::XMLElement()
50 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) 50 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 )
51{ 51{
52} 52}
53 53
54XMLElement::~XMLElement() 54XMLElement::~XMLElement()
55{ 55{
56 XMLElement *n = m_first; 56 XMLElement *n = m_first;
57 57
58 while ( n ) 58 while ( n )
59 { 59 {
60 XMLElement *tmp = n; 60 XMLElement *tmp = n;
61 n = n->m_next; 61 n = n->m_next;
62 delete tmp; 62 delete tmp;
63 } 63 }
64} 64}
65 65
66void XMLElement::appendChild( XMLElement *child ) 66void XMLElement::appendChild( XMLElement *child )
67{ 67{
68 if ( child->m_parent ) 68 if ( child->m_parent )
69 child->m_parent->removeChild( child ); 69 child->m_parent->removeChild( child );
70 70
71 child->m_parent = this; 71 child->m_parent = this;
72 72
73 if ( m_last ) 73 if ( m_last )
74 m_last->m_next = child; 74 m_last->m_next = child;
75 75
76 child->m_prev = m_last; 76 child->m_prev = m_last;
77 77
78 if ( !m_first ) 78 if ( !m_first )
79 m_first = child; 79 m_first = child;
80 80
81 m_last = child; 81 m_last = child;
82} 82}
83 83
84void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild ) 84void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
85{ 85{