-rw-r--r-- | library/xmlreader.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/library/xmlreader.cpp b/library/xmlreader.cpp index 1ae4485..1caab28 100644 --- a/library/xmlreader.cpp +++ b/library/xmlreader.cpp | |||
@@ -1,37 +1,43 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "xmlreader.h" | 20 | #include "xmlreader.h" |
21 | 21 | ||
22 | /*! \class Node xmlreader.h | ||
23 | \brief A single element in an XML structure defined by XmlHandler | ||
24 | |||
25 | \ingroup qtopiaemb | ||
26 | */ | ||
27 | |||
22 | Node::Node() | 28 | Node::Node() |
23 | : parent( 0 ), prev( 0 ), | 29 | : parent( 0 ), prev( 0 ), |
24 | next( 0 ), first( 0 ), last( 0 ) | 30 | next( 0 ), first( 0 ), last( 0 ) |
25 | { | 31 | { |
26 | } | 32 | } |
27 | 33 | ||
28 | 34 | ||
29 | Node::~Node() | 35 | Node::~Node() |
30 | { | 36 | { |
31 | Node *n = first, *m; | 37 | Node *n = first, *m; |
32 | 38 | ||
33 | while ( n ) { | 39 | while ( n ) { |
34 | m = n->next; | 40 | m = n->next; |
35 | delete n; | 41 | delete n; |
36 | n = m; | 42 | n = m; |
37 | } | 43 | } |
@@ -65,32 +71,41 @@ void Node::setAttributes( const QXmlAttributes &a ) | |||
65 | QMap<QString, QString> Node::attributeMap() | 71 | QMap<QString, QString> Node::attributeMap() |
66 | { | 72 | { |
67 | return attributes; | 73 | return attributes; |
68 | } | 74 | } |
69 | 75 | ||
70 | QString Node::subData(const QString& tag) const | 76 | QString Node::subData(const QString& tag) const |
71 | { | 77 | { |
72 | Node* c = firstChild(); | 78 | Node* c = firstChild(); |
73 | while ( c ) { | 79 | while ( c ) { |
74 | if ( c->tagName() == tag ) | 80 | if ( c->tagName() == tag ) |
75 | return c->data(); | 81 | return c->data(); |
76 | c = c->nextNode(); | 82 | c = c->nextNode(); |
77 | } | 83 | } |
78 | return QString::null; | 84 | return QString::null; |
79 | } | 85 | } |
80 | 86 | ||
87 | /*! \class XmlHandler xmlreader.h | ||
88 | \brief XML document structure holder | ||
89 | |||
90 | This class provides a Node structure that developers can read their | ||
91 | xml data into. | ||
92 | |||
93 | \ingroup qtopiaemb | ||
94 | */ | ||
95 | |||
81 | XmlHandler::XmlHandler() | 96 | XmlHandler::XmlHandler() |
82 | : node( 0 ), tree( 0 ) | 97 | : node( 0 ), tree( 0 ) |
83 | { | 98 | { |
84 | } | 99 | } |
85 | 100 | ||
86 | XmlHandler::~XmlHandler() | 101 | XmlHandler::~XmlHandler() |
87 | { | 102 | { |
88 | } | 103 | } |
89 | 104 | ||
90 | 105 | ||
91 | bool XmlHandler::startDocument() | 106 | bool XmlHandler::startDocument() |
92 | { | 107 | { |
93 | tree = node = new Node; | 108 | tree = node = new Node; |
94 | node->setTagName( "DOCUMENT" ); | 109 | node->setTagName( "DOCUMENT" ); |
95 | 110 | ||
96 | return TRUE; | 111 | return TRUE; |