File: tinyxml_8h-source.html

package info (click to toggle)
criticalmass 1%3A1.0.2-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,188 kB
  • sloc: ansic: 47,628; cpp: 25,201; sh: 11,834; xml: 3,532; perl: 3,271; makefile: 610; python: 72; awk: 40; lisp: 33
file content (449 lines) | stat: -rw-r--r-- 40,990 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>tinyxml.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.10 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>tinyxml.h</h1><div class="fragment"><pre>00001 <font class="comment">/*</font>
00002 <font class="comment">Copyright (c) 2000 Lee Thomason (www.grinninglizard.com)</font>
00003 <font class="comment"></font>
00004 <font class="comment">This software is provided 'as-is', without any express or implied </font>
00005 <font class="comment">warranty. In no event will the authors be held liable for any </font>
00006 <font class="comment">damages arising from the use of this software.</font>
00007 <font class="comment"></font>
00008 <font class="comment">Permission is granted to anyone to use this software for any </font>
00009 <font class="comment">purpose, including commercial applications, and to alter it and </font>
00010 <font class="comment">redistribute it freely, subject to the following restrictions:</font>
00011 <font class="comment"></font>
00012 <font class="comment">1. The origin of this software must not be misrepresented; you must </font>
00013 <font class="comment">not claim that you wrote the original software. If you use this </font>
00014 <font class="comment">software in a product, an acknowledgment in the product documentation </font>
00015 <font class="comment">would be appreciated but is not required.</font>
00016 <font class="comment"></font>
00017 <font class="comment">2. Altered source versions must be plainly marked as such, and </font>
00018 <font class="comment">must not be misrepresented as being the original software.</font>
00019 <font class="comment"></font>
00020 <font class="comment">3. This notice may not be removed or altered from any source </font>
00021 <font class="comment">distribution.</font>
00022 <font class="comment">*/</font>
00023 
00024 
00025 <font class="preprocessor">#ifndef TINYXML_INCLUDED</font>
00026 <font class="preprocessor"></font><font class="preprocessor">#define TINYXML_INCLUDED</font>
00027 <font class="preprocessor"></font>
00028 <font class="preprocessor">#pragma warning( disable : 4530 )</font>
00029 <font class="preprocessor"></font><font class="preprocessor">#pragma warning( disable : 4786 )</font>
00030 <font class="preprocessor"></font>
00031 <font class="preprocessor">#include &lt;string&gt;</font>
00032 <font class="preprocessor">#include &lt;stdio.h&gt;</font>
00033 <font class="preprocessor">#include &lt;assert.h&gt;</font>
00034 
00035 <font class="keyword">class </font><a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>;
00036 <font class="keyword">class </font><a class="code" href="classTiXmlElement.html">TiXmlElement</a>;
00037 <font class="keyword">class </font><a class="code" href="classTiXmlComment.html">TiXmlComment</a>;
00038 <font class="keyword">class </font><a class="code" href="classTiXmlUnknown.html">TiXmlUnknown</a>;
00039 <font class="keyword">class </font><a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>;
00040 <font class="keyword">class </font><a class="code" href="classTiXmlText.html">TiXmlText</a>;
00041 <font class="keyword">class </font><a class="code" href="classTiXmlDeclaration.html">TiXmlDeclaration</a>;
00042 
00043 
<a name="l00066"></a><a class="code" href="classTiXmlBase.html">00066</a> <font class="keyword">class </font><a class="code" href="classTiXmlBase.html">TiXmlBase</a>
00067 {
00068     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlNode.html">TiXmlNode</a>;
00069     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlElement.html">TiXmlElement</a>;
00070     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>;
00071  
00072   <font class="keyword">public</font>:
00073     TiXmlBase()<font class="keyword">                             </font>{}  
00074     <font class="keyword">virtual</font> ~TiXmlBase()<font class="keyword">                    </font>{}
00075     
00076     <font class="comment">/*  All TinyXml classes can print themselves to a filestream.</font>
00077 <font class="comment">    */</font>
00078     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth )   = 0;
00079 
00080   <font class="keyword">protected</font>:
00081     <font class="comment">/*  General parsing helper method. Takes a pointer in,</font>
00082 <font class="comment">        skips all the white space it finds, and returns a pointer</font>
00083 <font class="comment">        to the first non-whitespace data.</font>
00084 <font class="comment">    */</font>
00085     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* SkipWhiteSpace( <font class="keyword">const</font> <font class="keywordtype">char</font>* p );
00086 
00087     <font class="comment">/*  Reads an XML name into the string provided. Returns</font>
00088 <font class="comment">        a pointer just past the last character of the name, </font>
00089 <font class="comment">        or 0 if the function has an error.</font>
00090 <font class="comment">    */</font>
00091     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* ReadName( <font class="keyword">const</font> <font class="keywordtype">char</font>* p, std::string* name );
00092 
00093     <font class="keyword">enum</font>
00094     {
00095         TIXML_NO_ERROR = 0,
00096         TIXML_ERROR_OPENING_FILE,
00097         TIXML_ERROR_OUT_OF_MEMORY,
00098         TIXML_ERROR_PARSING_ELEMENT,
00099         TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00100         TIXML_ERROR_READING_ELEMENT_VALUE,
00101         TIXML_ERROR_READING_ATTRIBUTES,
00102         TIXML_ERROR_PARSING_EMPTY,
00103         TIXML_ERROR_READING_END_TAG,
00104         TIXML_ERROR_PARSING_UNKNOWN,
00105         TIXML_ERROR_PARSING_COMMENT,
00106         TIXML_ERROR_PARSING_DECLARATION,
00107 
00108         TIXML_ERROR_STRING_COUNT
00109     };
00110     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* errorString[ TIXML_ERROR_STRING_COUNT ];
00111 };
00112 
00113 
<a name="l00120"></a><a class="code" href="classTiXmlNode.html">00120</a> <font class="keyword">class </font><a class="code" href="classTiXmlNode.html">TiXmlNode</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlBase.html">TiXmlBase</a>
00121 {
00122   <font class="keyword">public</font>:
<a name="l00126"></a><a class="code" href="classTiXmlNode.html#s7">00126</a>     <font class="keyword">enum</font> NodeType 
00127     {
00128         DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT
00129     };
00130 
00131     <font class="keyword">virtual</font> ~TiXmlNode();
00132 
<a name="l00145"></a><a class="code" href="classTiXmlNode.html#a1">00145</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlNode.html#a1">Value</a>()<font class="keyword">  const           </font>{ <font class="keywordflow">return</font> value; }
00146 
<a name="l00156"></a><a class="code" href="classTiXmlNode.html#a2">00156</a>     <font class="keywordtype">void</font> <a class="code" href="classTiXmlNode.html#a2">SetValue</a>( <font class="keyword">const</font> std::string&amp; _value )<font class="keyword">      </font>{ value = _value; }
00157 
00159     <font class="keywordtype">void</font> <a class="code" href="classTiXmlNode.html#a3">Clear</a>();
00160 
<a name="l00162"></a><a class="code" href="classTiXmlNode.html#a4">00162</a>     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a4">Parent</a>()<font class="keyword"> const                   </font>{ <font class="keywordflow">return</font> parent; }
00163 
<a name="l00164"></a><a class="code" href="classTiXmlNode.html#a5">00164</a>     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a5">FirstChild</a>()<font class="keyword"> const   </font>{ <font class="keywordflow">return</font> firstChild; }      
00165     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a5">FirstChild</a>( <font class="keyword">const</font> std::string&amp; value ) <font class="keyword">const</font>;    
00166     
00167     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a8">LastChild</a>()<font class="keyword"> const    </font>{ <font class="keywordflow">return</font> lastChild; }       
00168     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a8">LastChild</a>( <font class="keyword">const</font> std::string&amp; value ) <font class="keyword">const</font>;     
00169 
00186     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a9">IterateChildren</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* previous );
00187 
00189     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a9">IterateChildren</a>( <font class="keyword">const</font> std::string&amp; value, <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* previous );
00190         
00194     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a11">InsertEndChild</a>( <font class="keyword">const</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>&amp; addThis );                  
00195 
00199     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a12">InsertBeforeChild</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* beforeThis, <font class="keyword">const</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>&amp; addThis );
00200 
00204     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a13">InsertAfterChild</a>(  <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* afterThis, <font class="keyword">const</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>&amp; addThis );
00205     
00209     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a14">ReplaceChild</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* replaceThis, <font class="keyword">const</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>&amp; withThis );
00210     
00212     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlNode.html#a15">RemoveChild</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* removeThis );
00213 
<a name="l00215"></a><a class="code" href="classTiXmlNode.html#a16">00215</a>     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a16">PreviousSibling</a>()<font class="keyword"> const          </font>{ <font class="keywordflow">return</font> prev; }
00216 
00218     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a16">PreviousSibling</a>( <font class="keyword">const</font> std::string&amp; ) <font class="keyword">const</font>;
00219     
<a name="l00221"></a><a class="code" href="classTiXmlNode.html#a18">00221</a>     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a18">NextSibling</a>()<font class="keyword"> const              </font>{ <font class="keywordflow">return</font> next; }
00222 
00224     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* <a class="code" href="classTiXmlNode.html#a18">NextSibling</a>( <font class="keyword">const</font> std::string&amp; ) <font class="keyword">const</font>;
00225 
00230     <a class="code" href="classTiXmlElement.html">TiXmlElement</a>* <a class="code" href="classTiXmlNode.html#a20">NextSiblingElement</a>() <font class="keyword">const</font>;
00231 
00236     <a class="code" href="classTiXmlElement.html">TiXmlElement</a>* <a class="code" href="classTiXmlNode.html#a20">NextSiblingElement</a>( <font class="keyword">const</font> std::string&amp; ) <font class="keyword">const</font>;
00237 
00239     <a class="code" href="classTiXmlElement.html">TiXmlElement</a>* <a class="code" href="classTiXmlNode.html#a22">FirstChildElement</a>()   <font class="keyword">const</font>;
00240     
00242     <a class="code" href="classTiXmlElement.html">TiXmlElement</a>* <a class="code" href="classTiXmlNode.html#a22">FirstChildElement</a>( <font class="keyword">const</font> std::string&amp; value ) <font class="keyword">const</font>;
00243 
<a name="l00245"></a><a class="code" href="classTiXmlNode.html#a24">00245</a>     <font class="keyword">virtual</font> <font class="keywordtype">int</font> <a class="code" href="classTiXmlNode.html#a24">Type</a>()<font class="keyword">  </font>{ <font class="keywordflow">return</font> type; }
00246 
00250     <a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>* <a class="code" href="classTiXmlNode.html#a25">GetDocument</a>() <font class="keyword">const</font>;
00251 
<a name="l00252"></a><a class="code" href="classTiXmlNode.html#a26">00252</a>     <a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>* <a class="code" href="classTiXmlNode.html#a26">ToDocument</a>()<font class="keyword"> const   </font>{ <font class="keywordflow">return</font> ( type == DOCUMENT ) ? (<a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>*) <font class="keyword">this</font> : 0; } 
<a name="l00253"></a><a class="code" href="classTiXmlNode.html#a27">00253</a>     <a class="code" href="classTiXmlElement.html">TiXmlElement</a>*  <a class="code" href="classTiXmlNode.html#a27">ToElement</a>()<font class="keyword"> const    </font>{ <font class="keywordflow">return</font> ( type == ELEMENT  ) ? (<a class="code" href="classTiXmlElement.html">TiXmlElement</a>*)  <font class="keyword">this</font> : 0; } 
<a name="l00254"></a><a class="code" href="classTiXmlNode.html#a28">00254</a>     <a class="code" href="classTiXmlComment.html">TiXmlComment</a>*  <a class="code" href="classTiXmlNode.html#a28">ToComment</a>()<font class="keyword"> const    </font>{ <font class="keywordflow">return</font> ( type == COMMENT  ) ? (<a class="code" href="classTiXmlComment.html">TiXmlComment</a>*)  <font class="keyword">this</font> : 0; } 
<a name="l00255"></a><a class="code" href="classTiXmlNode.html#a29">00255</a>     <a class="code" href="classTiXmlUnknown.html">TiXmlUnknown</a>*  <a class="code" href="classTiXmlNode.html#a29">ToUnknown</a>()<font class="keyword"> const    </font>{ <font class="keywordflow">return</font> ( type == UNKNOWN  ) ? (<a class="code" href="classTiXmlUnknown.html">TiXmlUnknown</a>*)  <font class="keyword">this</font> : 0; } 
<a name="l00256"></a><a class="code" href="classTiXmlNode.html#a30">00256</a>     <a class="code" href="classTiXmlText.html">TiXmlText</a>*     <a class="code" href="classTiXmlNode.html#a30">ToText</a>()    <font class="keyword">const</font>    { <font class="keywordflow">return</font> ( type == TEXT     ) ? (<a class="code" href="classTiXmlText.html">TiXmlText</a>*)     <font class="keyword">this</font> : 0; } 
<a name="l00257"></a><a class="code" href="classTiXmlNode.html#a31">00257</a>     <a class="code" href="classTiXmlDeclaration.html">TiXmlDeclaration</a>* <a class="code" href="classTiXmlNode.html#a31">ToDeclaration</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> ( type == DECLARATION ) ? (<a class="code" href="classTiXmlDeclaration.html">TiXmlDeclaration</a>*) <font class="keyword">this</font> : 0; } 
00258 
00259     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font> = 0;
00260 
00261   <font class="keyword">protected</font>:
00262     TiXmlNode( NodeType type );
00263     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* ) = 0;
00264 
00265     <font class="comment">// The node is passed in by ownership. This object will delete it.</font>
00266     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* LinkEndChild( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* addThis );
00267 
00268     <font class="comment">// Figure out what is at *p, and parse it. Return a node if</font>
00269     <font class="comment">// successful, and update p.</font>
00270     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* IdentifyAndParse( <font class="keyword">const</font> <font class="keywordtype">char</font>** p );
00271 
00272     <font class="keywordtype">void</font> CopyToClone( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* target )<font class="keyword"> const </font>{ target-&gt;value = value; }
00273 
00274     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>*      parent;     
00275     NodeType        type;
00276     
00277     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>*      firstChild;
00278     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>*      lastChild;
00279 
00280     std::string     value;
00281     
00282     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>*      prev;
00283     <a class="code" href="classTiXmlNode.html">TiXmlNode</a>*      next;
00284 };
00285 
00286 
<a name="l00296"></a><a class="code" href="classTiXmlAttribute.html">00296</a> <font class="keyword">class </font><a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlBase.html">TiXmlBase</a>
00297 {
00298     <font class="keyword">friend</font> <font class="keyword">class </font>TiXmlAttributeSet;
00299 
00300   <font class="keyword">public</font>:
<a name="l00302"></a><a class="code" href="classTiXmlAttribute.html#a0">00302</a>     <a class="code" href="classTiXmlAttribute.html#a0">TiXmlAttribute</a>() : prev( 0 ), next( 0 ) {}
00303 
<a name="l00305"></a><a class="code" href="classTiXmlAttribute.html#a1">00305</a>     <a class="code" href="classTiXmlAttribute.html#a0">TiXmlAttribute</a>( <font class="keyword">const</font> std::string&amp; _name, <font class="keyword">const</font> std::string&amp; _value )   : name( _name ), value( _value ), prev( 0 ), next( 0 ) {}
00306 
<a name="l00307"></a><a class="code" href="classTiXmlAttribute.html#a2">00307</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlAttribute.html#a2">Name</a>()  <font class="keyword">const</font> { <font class="keywordflow">return</font> name; }       
<a name="l00308"></a><a class="code" href="classTiXmlAttribute.html#a3">00308</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlAttribute.html#a3">Value</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> value; }      
00309 
<a name="l00310"></a><a class="code" href="classTiXmlAttribute.html#a4">00310</a>     <font class="keywordtype">void</font> <a class="code" href="classTiXmlAttribute.html#a4">SetName</a>( <font class="keyword">const</font> std::string&amp; _name )<font class="keyword">    </font>{ name = _name; }       
<a name="l00311"></a><a class="code" href="classTiXmlAttribute.html#a5">00311</a>     <font class="keywordtype">void</font> <a class="code" href="classTiXmlAttribute.html#a5">SetValue</a>( <font class="keyword">const</font> std::string&amp; _value )<font class="keyword">  </font>{ value = _value; }     
00312 
00314     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* <a class="code" href="classTiXmlAttribute.html#a6">Next</a>();
00316     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* <a class="code" href="classTiXmlAttribute.html#a7">Previous</a>();
00317 
00318     <font class="keywordtype">bool</font> operator==( <font class="keyword">const</font> <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>&amp; rhs )<font class="keyword"> const </font>{ <font class="keywordflow">return</font> rhs.name == name; }
00319     <font class="keywordtype">bool</font> operator&lt;( <font class="keyword">const</font> <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>&amp; rhs )  <font class="keyword">const</font> { <font class="keywordflow">return</font> name &lt; rhs.name; }
00320     <font class="keywordtype">bool</font> operator&gt;( <font class="keyword">const</font> <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>&amp; rhs )  <font class="keyword">const</font> { <font class="keywordflow">return</font> name &gt; rhs.name; }
00321 
00322     <font class="comment">/*  [internal use] </font>
00323 <font class="comment">        Attribtue parsing starts: first letter of the name</font>
00324 <font class="comment">                         returns: the next char after the value end quote</font>
00325 <font class="comment">    */</font>  
00326     <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00327 
00328     <font class="comment">// [internal use] </font>
00329     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00330 
00331     <font class="comment">// [internal use]</font>
00332     <font class="comment">// Set the document pointer so the attribute can report errors.</font>
00333     <font class="keywordtype">void</font> SetDocument( <a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>* doc )<font class="keyword">  </font>{ document = doc; }
00334 
00335   <font class="keyword">private</font>:
00336     <a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>*  document;   <font class="comment">// A pointer back to a document, for error reporting.</font>
00337     std::string     name;
00338     std::string     value;
00339 
00340     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* prev;
00341     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* next;
00342 };
00343 
00344 
00345 <font class="comment">/*  A class used to manage a group of attributes.</font>
00346 <font class="comment">    It is only used internally, both by the ELEMENT and the DECLARATION.</font>
00347 <font class="comment">    </font>
00348 <font class="comment">    The set can be changed transparent to the Element and Declaration</font>
00349 <font class="comment">    classes that use it, but NOT transparent to the Attribute </font>
00350 <font class="comment">    which has to implement a next() and previous() method. Which makes</font>
00351 <font class="comment">    it a bit problematic and prevents the use of STL.</font>
00352 <font class="comment"></font>
00353 <font class="comment">    This version is implemented with circular lists because:</font>
00354 <font class="comment">        - I like circular lists</font>
00355 <font class="comment">        - it demonstrates some independence from the (typical) doubly linked list.</font>
00356 <font class="comment">*/</font>
00357 <font class="keyword">class </font>TiXmlAttributeSet
00358 {
00359   <font class="keyword">public</font>:
00360     TiXmlAttributeSet();
00361     ~TiXmlAttributeSet();
00362 
00363     <font class="keywordtype">void</font> Add( <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* attribute );
00364     <font class="keywordtype">void</font> Remove( <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* attribute );
00365 
00366     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* First()<font class="keyword"> const   </font>{ <font class="keywordflow">return</font> ( sentinel.next == &amp;sentinel ) ? 0 : sentinel.next; }
00367     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* Last()  <font class="keyword">const</font>   { <font class="keywordflow">return</font> ( sentinel.prev == &amp;sentinel ) ? 0 : sentinel.prev; }
00368     
00369     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* Find( <font class="keyword">const</font> std::string&amp; name ) <font class="keyword">const</font>;
00370 
00371   <font class="keyword">private</font>:
00372     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a> sentinel;
00373 };
00374 
00375 
<a name="l00380"></a><a class="code" href="classTiXmlElement.html">00380</a> <font class="keyword">class </font><a class="code" href="classTiXmlElement.html">TiXmlElement</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00381 {
00382   <font class="keyword">public</font>:
00384     <a class="code" href="classTiXmlElement.html#a0">TiXmlElement</a>( <font class="keyword">const</font> std::string&amp; value );
00385 
00386     <font class="keyword">virtual</font> ~TiXmlElement();
00387 
00391     <font class="keyword">const</font> std::string* <a class="code" href="classTiXmlElement.html#a2">Attribute</a>( <font class="keyword">const</font> std::string&amp; name ) <font class="keyword">const</font>;
00392 
00396     <font class="keyword">const</font> std::string* <a class="code" href="classTiXmlElement.html#a2">Attribute</a>( <font class="keyword">const</font> std::string&amp; name, <font class="keywordtype">int</font>* i ) <font class="keyword">const</font>;
00397 
00401     <font class="keywordtype">void</font> <a class="code" href="classTiXmlElement.html#a4">SetAttribute</a>( <font class="keyword">const</font> std::string&amp; name, 
00402                        <font class="keyword">const</font> std::string&amp; value );
00403 
00407     <font class="keywordtype">void</font> <a class="code" href="classTiXmlElement.html#a4">SetAttribute</a>( <font class="keyword">const</font> std::string&amp; name, 
00408                        <font class="keywordtype">int</font> value );
00409 
00412     <font class="keywordtype">void</font> <a class="code" href="classTiXmlElement.html#a6">RemoveAttribute</a>( <font class="keyword">const</font> std::string&amp; name );
00413 
<a name="l00414"></a><a class="code" href="classTiXmlElement.html#a7">00414</a>     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* <a class="code" href="classTiXmlElement.html#a7">FirstAttribute</a>()<font class="keyword">    </font>{ <font class="keywordflow">return</font> attributeSet.First(); }        
<a name="l00415"></a><a class="code" href="classTiXmlElement.html#a8">00415</a>     <a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>* <a class="code" href="classTiXmlElement.html#a8">LastAttribute</a>()<font class="keyword">     </font>{ <font class="keywordflow">return</font> attributeSet.Last(); }     
00416 
00417     <font class="comment">// [internal use] Creates a new Element and returs it.</font>
00418     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00419     <font class="comment">// [internal use] </font>
00420     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00421 
00422   <font class="keyword">protected</font>:
00423     <font class="comment">/*  [internal use] </font>
00424 <font class="comment">        Attribtue parsing starts: next char past '&lt;'</font>
00425 <font class="comment">                         returns: next char past '&gt;'</font>
00426 <font class="comment">    */</font>  
00427     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00428     <font class="keyword">const</font> <font class="keywordtype">char</font>* ReadValue( <font class="keyword">const</font> <font class="keywordtype">char</font>* p );
00429 
00430   <font class="keyword">private</font>:
00431     TiXmlAttributeSet attributeSet;
00432 };
00433 
00434 
<a name="l00437"></a><a class="code" href="classTiXmlComment.html">00437</a> <font class="keyword">class </font><a class="code" href="classTiXmlComment.html">TiXmlComment</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00438 {
00439   <font class="keyword">public</font>:
<a name="l00441"></a><a class="code" href="classTiXmlComment.html#a0">00441</a>     <a class="code" href="classTiXmlComment.html#a0">TiXmlComment</a>() : <a class="code" href="classTiXmlNode.html">TiXmlNode</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>::COMMENT ) {}
00442     <font class="keyword">virtual</font> ~TiXmlComment()<font class="keyword"> </font>{}
00443 
00444     <font class="comment">// [internal use] Creates a new Element and returs it.</font>
00445     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00446     <font class="comment">// [internal use] </font>
00447     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00448 
00449   <font class="keyword">protected</font>:
00450     <font class="comment">/*  [internal use] </font>
00451 <font class="comment">        Attribtue parsing starts: at the ! of the !--</font>
00452 <font class="comment">                         returns: next char past '&gt;'</font>
00453 <font class="comment">    */</font>  
00454     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00455 };
00456 
00457 
<a name="l00460"></a><a class="code" href="classTiXmlText.html">00460</a> <font class="keyword">class </font><a class="code" href="classTiXmlText.html">TiXmlText</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00461 {
00462   <font class="keyword">public</font>:
00463     TiXmlText()  : TiXmlNode( TiXmlNode::TEXT )<font class="keyword"> </font>{}
00464     <font class="keyword">virtual</font> ~TiXmlText()<font class="keyword"> </font>{}
00465 
00466 
00467     <font class="comment">// [internal use] Creates a new Element and returns it.</font>
00468     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00469     <font class="comment">// [internal use] </font>
00470     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00471     <font class="comment">// [internal use]   </font>
00472     <font class="keywordtype">bool</font> Blank();   <font class="comment">// returns true if all white space and new lines</font>
00473 
00474     <font class="comment">/*  [internal use] </font>
00475 <font class="comment">        Attribtue parsing starts: First char of the text</font>
00476 <font class="comment">                         returns: next char past '&gt;'</font>
00477 <font class="comment">    */</font>  
00478     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00479 };
00480 
00481 
<a name="l00495"></a><a class="code" href="classTiXmlDeclaration.html">00495</a> <font class="keyword">class </font><a class="code" href="classTiXmlDeclaration.html">TiXmlDeclaration</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00496 {
00497   <font class="keyword">public</font>:
<a name="l00499"></a><a class="code" href="classTiXmlDeclaration.html#a0">00499</a>     <a class="code" href="classTiXmlDeclaration.html#a0">TiXmlDeclaration</a>()   : <a class="code" href="classTiXmlNode.html">TiXmlNode</a>( <a class="code" href="classTiXmlNode.html">TiXmlNode</a>::DECLARATION ) {}
00500 
00502     <a class="code" href="classTiXmlDeclaration.html#a0">TiXmlDeclaration</a>( <font class="keyword">const</font> std::string&amp; version, 
00503                       <font class="keyword">const</font> std::string&amp; encoding,
00504                       <font class="keyword">const</font> std::string&amp; standalone );
00505 
00506     <font class="keyword">virtual</font> ~TiXmlDeclaration()<font class="keyword"> </font>{}
00507 
<a name="l00509"></a><a class="code" href="classTiXmlDeclaration.html#a3">00509</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlDeclaration.html#a3">Version</a>()<font class="keyword">        </font>{ <font class="keywordflow">return</font> version; }
<a name="l00511"></a><a class="code" href="classTiXmlDeclaration.html#a4">00511</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlDeclaration.html#a4">Encoding</a>()<font class="keyword">       </font>{ <font class="keywordflow">return</font> encoding; }
<a name="l00513"></a><a class="code" href="classTiXmlDeclaration.html#a5">00513</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlDeclaration.html#a5">Standalone</a>()<font class="keyword">     </font>{ <font class="keywordflow">return</font> standalone; }
00514 
00515     <font class="comment">// [internal use] Creates a new Element and returs it.</font>
00516     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00517     <font class="comment">// [internal use] </font>
00518     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00519 
00520   <font class="keyword">protected</font>:
00521     <font class="comment">//  [internal use] </font>
00522     <font class="comment">//  Attribtue parsing starts: next char past '&lt;'</font>
00523     <font class="comment">//                   returns: next char past '&gt;'</font>
00524     
00525     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00526 
00527   <font class="keyword">private</font>:
00528     std::string version;
00529     std::string encoding;
00530     std::string standalone;
00531 };
00532 
00533 
<a name="l00539"></a><a class="code" href="classTiXmlUnknown.html">00539</a> <font class="keyword">class </font><a class="code" href="classTiXmlUnknown.html">TiXmlUnknown</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00540 {
00541   <font class="keyword">public</font>:
00542     TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN )<font class="keyword"> </font>{}
00543     <font class="keyword">virtual</font> ~TiXmlUnknown()<font class="keyword"> </font>{}
00544 
00545     <font class="comment">// [internal use]   </font>
00546     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00547     <font class="comment">// [internal use]   </font>
00548     <font class="keyword">virtual</font> <font class="keywordtype">void</font> Print( FILE* fp, <font class="keywordtype">int</font> depth );
00549 
00550   <font class="keyword">protected</font>:
00551     <font class="comment">/*  [internal use] </font>
00552 <font class="comment">        Attribute parsing starts: First char of the text</font>
00553 <font class="comment">                         returns: next char past '&gt;'</font>
00554 <font class="comment">    */</font>  
00555     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00556 };
00557 
00558 
<a name="l00563"></a><a class="code" href="classTiXmlDocument.html">00563</a> <font class="keyword">class </font><a class="code" href="classTiXmlDocument.html">TiXmlDocument</a> : <font class="keyword">public</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>
00564 {
00565   <font class="keyword">public</font>:
00567     <a class="code" href="classTiXmlDocument.html#a0">TiXmlDocument</a>();
00569     <a class="code" href="classTiXmlDocument.html#a0">TiXmlDocument</a>( <font class="keyword">const</font> std::string&amp; documentName );
00570     
00571     <font class="keyword">virtual</font> ~TiXmlDocument()<font class="keyword"> </font>{}
00572 
00577     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlDocument.html#a3">LoadFile</a>();
00579     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlDocument.html#a4">SaveFile</a>();
00581     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlDocument.html#a3">LoadFile</a>( <font class="keyword">const</font> std::string&amp; filename );
00583     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlDocument.html#a4">SaveFile</a>( <font class="keyword">const</font> std::string&amp; filename );
00584 
00586     <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="classTiXmlDocument.html#a7">Parse</a>( <font class="keyword">const</font> <font class="keywordtype">char</font>* );
00587     
<a name="l00589"></a><a class="code" href="classTiXmlDocument.html#a8">00589</a>     <font class="keywordtype">bool</font> <a class="code" href="classTiXmlDocument.html#a8">Error</a>()<font class="keyword">                        </font>{ <font class="keywordflow">return</font> error; }
<a name="l00591"></a><a class="code" href="classTiXmlDocument.html#a9">00591</a>     <font class="keyword">const</font> std::string&amp; <a class="code" href="classTiXmlDocument.html#a9">ErrorDesc</a>()<font class="keyword">      </font>{ <font class="keywordflow">return</font> errorDesc; }
00592 
00594     <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classTiXmlDocument.html#a11">Print</a>( FILE* fp, <font class="keywordtype">int</font> depth = 0 );
<a name="l00596"></a><a class="code" href="classTiXmlDocument.html#a11">00596</a>     <font class="keywordtype">void</font> <a class="code" href="classTiXmlDocument.html#a11">Print</a>()<font class="keyword">                                        </font>{ <a class="code" href="classTiXmlDocument.html#a11">Print</a>( stdout, 0 ); }
00597   
00598     <font class="comment">// [internal use]   </font>
00599     <font class="keyword">virtual</font> <a class="code" href="classTiXmlNode.html">TiXmlNode</a>* Clone() <font class="keyword">const</font>;
00600     <font class="comment">// [internal use]   </font>
00601     <font class="keywordtype">void</font> SetError( <font class="keywordtype">int</font> err )<font class="keyword"> </font>{      assert( err &gt; 0 &amp;&amp; err &lt; TIXML_ERROR_STRING_COUNT );
00602                                     error   = <font class="keyword">true</font>; 
00603                                     errorId = err;
00604                                     errorDesc = errorString[ errorId ]; }
00605 
00606   <font class="keyword">private</font>:
00607     <font class="keywordtype">bool</font> error;
00608     <font class="keywordtype">int</font>  errorId;   
00609     std::string errorDesc;
00610 };
00611 
00612 
00613 <font class="preprocessor">#endif</font>
00614 <font class="preprocessor"></font>
</pre></div><hr><address><small>Generated at Sun Aug 26 20:37:31 2001 for TinyXml by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>