aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/i__xml_8cpp-source.html
blob: 8d77b76801e14fe3cab3ad288a4c26c0c14087d8 (plain)
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</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="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>i_xml.cpp</h1><a href="i__xml_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="i__xml_8h.html">nel/misc/i_xml.h</a>"</font>
00029 
00030 <font class="preprocessor">#ifndef NL_DONT_USE_EXTERNAL_CODE</font>
00031 <font class="preprocessor"></font>
00032 <font class="comment">// Include from libxml2</font>
00033 <font class="preprocessor">#include &lt;libxml/xmlerror.h&gt;</font>
00034 
00035 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00036 
<a name="l00037"></a><a class="code" href="i__xml_8cpp.html#a0">00037</a> <font class="preprocessor">#define NLMISC_READ_BUFFER_SIZE 1024</font>
00038 <font class="preprocessor"></font>
00039 <font class="keyword">namespace </font>NLMISC 
00040 {
00041 
00042 <font class="comment">// *********************************************************</font>
00043 
00044 <font class="keyword">const</font> <font class="keywordtype">char</font> <a class="code" href="namespaceNLMISC.html#a169">SEPARATOR</a> = <font class="charliteral">' '</font>;
00045 
00046 <font class="comment">// ***************************************************************************</font>
00047 
<a name="l00048"></a><a class="code" href="i__xml_8cpp.html#a1">00048</a> <font class="preprocessor">#define readnumber(dest,thetype,digits,convfunc) \</font>
00049 <font class="preprocessor">        string number_as_string; \</font>
00050 <font class="preprocessor">        serialSeparatedBufferIn( number_as_string ); \</font>
00051 <font class="preprocessor">        dest = (thetype)convfunc( number_as_string.c_str() );</font>
00052 <font class="preprocessor"></font>
00053 <font class="comment">// ***************************************************************************</font>
00054 
00055 <font class="keyword">inline</font> <font class="keywordtype">void</font> CIXml::flushContentString ()
00056 {
00057         <font class="comment">// String size</font>
00058         _ContentString.erase ();
00059 
00060         <font class="comment">// Reset</font>
00061         _ContentStringIndex = 0;
00062 }
00063 
00064 <font class="comment">// ***************************************************************************</font>
00065 
00066 CIXml::CIXml () : IStream (true <font class="comment">/* Input mode */</font>)
00067 {
00068         <font class="comment">// Not initialized</font>
00069         _Parser = NULL;
00070         _CurrentElement = NULL;
00071         _CurrentNode = NULL;
00072         _PushBegin = <font class="keyword">false</font>;
00073         _AttribPresent = <font class="keyword">false</font>;
00074         _ErrorString = <font class="stringliteral">""</font>;
00075 }
00076 
00077 <font class="comment">// ***************************************************************************</font>
00078 
00079 CIXml::~CIXml ()
00080 {
00081         <font class="comment">// Release</font>
00082         release ();
00083 }
00084 
00085 <font class="comment">// ***************************************************************************</font>
00086 
00087 <font class="keywordtype">void</font> CIXml::release ()
00088 {
00089         <font class="comment">// Release the parser</font>
00090         <font class="keywordflow">if</font> (_Parser)
00091         {
00092                 <font class="comment">// Free it</font>
00093                 xmlFreeDoc (_Parser-&gt;myDoc);
00094                 xmlFreeParserCtxt (_Parser);
00095                 <font class="comment">// xmlCleanupParser (); Crash..</font>
00096                 _Parser = NULL;
00097         }
00098 
00099         <font class="comment">// Not initialized</font>
00100         _Parser = NULL;
00101         _CurrentElement = NULL;
00102         _CurrentNode = NULL;
00103         _PushBegin = <font class="keyword">false</font>;
00104         _AttribPresent = <font class="keyword">false</font>;
00105         _ErrorString = <font class="stringliteral">""</font>;
00106 }
00107 
00108 <font class="comment">// ***************************************************************************</font>
00109 
00110 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a300">xmlGenericErrorFuncForNeL</a> (<font class="keywordtype">void</font> *ctx, <font class="keyword">const</font> <font class="keywordtype">char</font> *msg, ...)
00111 {
00112         <font class="comment">// Get the error string</font>
00113         string str;
00114         <a class="code" href="common_8h.html#a0">NLMISC_CONVERT_VARGS</a> (str, msg, NLMISC::MaxCStringSize);
00115         ((CIXml*)ctx)-&gt;_ErrorString += str;
00116 }
00117 
00118 <font class="comment">// ***************************************************************************</font>
00119 
00120 <font class="keywordtype">bool</font> CIXml::init (IStream &amp;stream)
00121 {
00122         <font class="comment">// Release</font>
00123         release ();
00124 
00125         <font class="comment">// Input stream ?</font>
00126         <font class="keywordflow">if</font> (stream.isReading())
00127         {
00128                 <font class="comment">// Set XML mode</font>
00129                 setXMLMode (<font class="keyword">true</font>);
00130 
00131                 <font class="comment">// Get current position</font>
00132                 sint32 pos = stream.getPos ();
00133 
00134                 <font class="comment">// Go to end</font>
00135                 <font class="keywordtype">bool</font> seekGood = stream.seek (0, end);
00136                 <a class="code" href="debug_8h.html#a6">nlassert</a> (seekGood);
00137 
00138                 <font class="comment">// Get input stream length</font>
00139                 sint32 length = stream.getPos () - pos;
00140 
00141                 <font class="comment">// Go to start</font>
00142                 stream.seek (pos, begin);
00143 
00144                 <font class="comment">// The read buffer</font>
00145         <font class="keywordtype">char</font> buffer[<a class="code" href="i__xml_8cpp.html#a0">NLMISC_READ_BUFFER_SIZE</a>];
00146 
00147                 <font class="comment">// Fill the buffer</font>
00148                 stream.serialBuffer ((uint8*)buffer, 4);
00149                 length -= 4;
00150 
00151                 <font class="comment">// Set error handler</font>
00152                 xmlSetGenericErrorFunc  (<font class="keyword">this</font>, <a class="code" href="namespaceNLMISC.html#a300">xmlGenericErrorFuncForNeL</a>);
00153 
00154                 <font class="comment">// Ask to get debug info</font>
00155                 xmlLineNumbersDefault(1);
00156 
00157                 <font class="comment">// The parser context</font>
00158         _Parser = xmlCreatePushParserCtxt(NULL, NULL, buffer, 4, NULL);
00159                 <a class="code" href="debug_8h.html#a6">nlassert</a> (_Parser);
00160 
00161                 <font class="comment">// For all the file</font>
00162         <font class="keywordflow">while</font> (length&gt;=<a class="code" href="i__xml_8cpp.html#a0">NLMISC_READ_BUFFER_SIZE</a>)
00163                 {
00164                         <font class="comment">// Fill the buffer</font>
00165                         stream.serialBuffer ((uint8*)buffer, <a class="code" href="i__xml_8cpp.html#a0">NLMISC_READ_BUFFER_SIZE</a>);
00166 
00167                         <font class="comment">// Read a buffer</font>
00168             <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = xmlParseChunk(_Parser, buffer, <a class="code" href="i__xml_8cpp.html#a0">NLMISC_READ_BUFFER_SIZE</a>, 0);
00169 
00170                         <font class="comment">// Error code ?</font>
00171                         <font class="keywordflow">if</font> (res)
00172                         {
00173                                 <font class="keywordflow">throw</font> EXmlParsingError (_ErrorString);
00174                         }
00175 
00176                         <font class="comment">// Length left</font>
00177                         length -= <a class="code" href="i__xml_8cpp.html#a0">NLMISC_READ_BUFFER_SIZE</a>;
00178         }
00179 
00180                 <font class="comment">// Fill the buffer</font>
00181                 stream.serialBuffer ((uint8*)buffer, length);
00182 
00183                 <font class="comment">// Parse the last buffer</font>
00184                 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = xmlParseChunk(_Parser, buffer, length, 1);
00185 
00186                 <font class="comment">// Error code ?</font>
00187                 <font class="keywordflow">if</font> (res)
00188                 {
00189                         <font class="keywordflow">throw</font> EXmlParsingError (_ErrorString);
00190                 }
00191 
00192                 <font class="comment">// Ok</font>
00193                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00194         }
00195         <font class="keywordflow">else</font>
00196         {
00197                 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"The stream is not an input stream."</font>);
00198         }
00199 
00200         <font class="comment">// Error</font>
00201         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00202 }
00203 
00204 <font class="comment">// ***************************************************************************</font>
00205 
00206 <font class="keywordtype">void</font> CIXml::serialSeparatedBufferIn ( string &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, <font class="keywordtype">bool</font> checkSeparator )
00207 {
00208         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00209 
00210         <font class="comment">// Output stream has been initialized ?</font>
00211         <font class="keywordflow">if</font> ( _Parser )
00212         {
00213                 <font class="comment">// Current node presents ?</font>
00214                 <font class="keywordflow">if</font> (_CurrentElement)
00215                 {
00216                         <font class="comment">// Write a push attribute ?</font>
00217                         <font class="keywordflow">if</font> (_PushBegin)
00218                         {
00219                                 <font class="comment">// Current attrib is set ?</font>
00220                                 <font class="keywordflow">if</font> (_AttribPresent)
00221                                 {
00222                                         <font class="comment">// Should have a current element</font>
00223                                         <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentElement);
00224 
00225                                         <font class="comment">// Get the attribute</font>
00226                                         xmlChar *attributeValue = xmlGetProp (_CurrentElement, (<font class="keyword">const</font> xmlChar*)_AttribName.c_str());
00227 
00228                                         <font class="comment">// Attribute is here ?</font>
00229                                         <font class="keywordflow">if</font> (attributeValue)
00230                                         {
00231                                                 <font class="comment">// Copy the value</font>
00232                                                 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)attributeValue;
00233 
00234                                                 <font class="comment">// Delete the value</font>
00235                                                 xmlFree ((<font class="keywordtype">void</font>*)attributeValue);
00236                                         }
00237                                         <font class="keywordflow">else</font>
00238                                         {
00239                                                 <font class="comment">// Node name must not be NULL</font>
00240                                                 <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentElement-&gt;name);
00241 
00242                                                 <font class="comment">// Make an error message</font>
00243                                                 <font class="keywordtype">char</font> tmp[512];
00244                                                 <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error in block line %d\nAttribute \"%s\" is missing in node \"%s\""</font>, 
00245                                                         (<font class="keywordtype">int</font>)_CurrentElement-&gt;content, _AttribName.c_str(), _CurrentElement-&gt;name);
00246                                                 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00247                                         }
00248 
00249                                         <font class="comment">// The attribute has been used </font>
00250                                         _AttribPresent = <font class="keyword">false</font>;
00251                                 }
00252                                 <font class="keywordflow">else</font>
00253                                 {
00254                                         <font class="comment">// * Error, the stream don't use XML streaming properly</font>
00255                                         <font class="comment">// * You must take care of this in your last serial call:</font>
00256                                         <font class="comment">// * - Between xmlPushBegin() and xmlPushEnd(), before each serial, you must set the attribute name with xmlSetAttrib.</font>
00257                                         <font class="comment">// * - Between xmlPushBegin() and xmlPushEnd(), you must serial only basic objects (numbers and strings).</font>
00258                                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Error, the stream don't use XML streaming properly"</font> );
00259                                 }
00260                         }
00261                         <font class="keywordflow">else</font>
00262                         {
00263                                 <font class="comment">// Content length</font>
00264                                 uint length = _ContentString.length();
00265 
00266                                 <font class="comment">// String empty ?</font>
00267                                 <font class="keywordflow">if</font> (length==0)
00268                                 {
00269                                         <font class="comment">// Try to open the node</font>
00270                                         <font class="keywordflow">do</font>
00271                                         {
00272                                                 <font class="comment">// If no more node, empty string</font>
00273                                                 <font class="keywordflow">if</font> (_CurrentNode == NULL)
00274                                                 {
00275                                                         <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = <font class="stringliteral">""</font>;
00276                                                         _ContentStringIndex = 0;
00277                                                         _ContentString.erase ();
00278                                                         <font class="keywordflow">return</font>;
00279                                                 }
00280 
00281                                                 <font class="comment">// Node with the good name</font>
00282                                                 <font class="keywordflow">if</font> (_CurrentNode-&gt;type == XML_TEXT_NODE)
00283                                                 {
00284                                                         <font class="comment">// Stop searching</font>
00285                                                         <font class="keywordflow">break</font>;
00286                                                 }
00287                                                 <font class="keywordflow">else</font>
00288                                                         <font class="comment">// Get next</font>
00289                                                         _CurrentNode = _CurrentNode-&gt;next;
00290                                         }
00291                                         <font class="keywordflow">while</font> (_CurrentNode);
00292 
00293                                         <font class="comment">// Not found ?</font>
00294                                         <font class="keywordflow">if</font> (_CurrentNode != NULL)
00295                                         {
00296                                                 <font class="comment">// Read the content</font>
00297                                                 <font class="keyword">const</font> <font class="keywordtype">char</font> *content = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlNodeGetContent (_CurrentNode);
00298                                                 <font class="keywordflow">if</font> (content)
00299                                                 {
00300                                                         _ContentString = content;
00301 
00302                                                         <font class="comment">// Delete the value</font>
00303                                                         xmlFree ((<font class="keywordtype">void</font>*)content);
00304                                                 }
00305                                                 <font class="keywordflow">else</font>
00306                                                         _ContentString.erase ();
00307 
00308                                                 <font class="comment">// Set the current index</font>
00309                                                 _ContentStringIndex = 0;
00310 
00311                                                 <font class="comment">// New length</font>
00312                                                 length = _ContentString.length();
00313                                         }
00314                                 }
00315 
00316                                 <font class="comment">// Keyword in the buffer ?</font>
00317                                 <font class="keywordflow">if</font> (_ContentStringIndex &lt; length)
00318                                 {
00319                                         <font class="comment">// First index</font>
00320                                         uint first = _ContentStringIndex;
00321 
00322                                         <font class="comment">// Have to take care of separators ?</font>
00323                                         <font class="keywordflow">if</font> (checkSeparator)
00324                                         {
00325                                                 <font class="comment">// Scan to the end</font>
00326                                                 <font class="keywordflow">while</font> (_ContentStringIndex &lt; length)
00327                                                 {
00328                                                         <font class="comment">// Not a separator ?</font>
00329                                                         <font class="keywordflow">if</font> ( (_ContentString[_ContentStringIndex]==<a class="code" href="namespaceNLMISC.html#a169">SEPARATOR</a>) || (_ContentString[_ContentStringIndex]==<font class="charliteral">'\n'</font>) )
00330                                                         {
00331                                                                 _ContentStringIndex++;
00332                                                                 <font class="keywordflow">break</font>;
00333                                                         }
00334 
00335                                                         <font class="comment">// Next char</font>
00336                                                         _ContentStringIndex++;
00337                                                 }
00338                                         }
00339                                         <font class="keywordflow">else</font>
00340                                         {
00341                                                 <font class="comment">// Copy all the string</font>
00342                                                 _ContentStringIndex = length;
00343                                         }
00344 
00345                                         <font class="comment">// Make a string</font>
00346                                         <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>.assign (_ContentString, first, _ContentStringIndex-first);
00347                                 }
00348                                 <font class="keywordflow">else</font>
00349                                 {
00350                                         <font class="comment">// Should have a name</font>
00351                                         <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentElement-&gt;name);
00352 
00353                                         <font class="comment">// Make an error message</font>
00354                                         <font class="keywordtype">char</font> tmp[512];
00355                                         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error in block line %d \nMissing keywords in text child node in the node %s"</font>, 
00356                                                 (<font class="keywordtype">int</font>)_CurrentElement-&gt;content, _CurrentElement-&gt;name);
00357                                         <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00358                                 }
00359                         }
00360                 }
00361                 <font class="keywordflow">else</font>
00362                 {
00363                         <font class="comment">// * Error, no current node present.</font>
00364                         <font class="comment">// * Check that your serial is initialy made between a xmlPushBegin and xmlPushEnd calls.</font>
00365                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Error, the stream don't use XML streaming properly"</font> );
00366                 }
00367         }
00368         <font class="keywordflow">else</font>
00369         {
00370                 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized"</font> );
00371         }
00372 }
00373 
00374 <font class="comment">// ***************************************************************************</font>
00375 
00376 <font class="keywordtype">void</font> CIXml::serial(uint8 &amp;b)
00377 {
00378         <font class="comment">// Read the number</font>
00379         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, uint8, 3, atoi );
00380 }
00381 
00382 <font class="comment">// ***************************************************************************</font>
00383 
00384 <font class="keywordtype">void</font> CIXml::serial(sint8 &amp;b)
00385 {
00386         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, sint8, 4, atoi );
00387 }
00388 
00389 <font class="comment">// ***************************************************************************</font>
00390 
00391 <font class="keywordtype">void</font> CIXml::serial(uint16 &amp;b)
00392 {
00393         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, uint16, 5, atoi );
00394 }
00395 
00396 <font class="comment">// ***************************************************************************</font>
00397 
00398 <font class="keywordtype">void</font> CIXml::serial(sint16 &amp;b)
00399 {
00400         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, sint16, 6, atoi );
00401 }
00402 
00403 <font class="comment">// ***************************************************************************</font>
00404 
00405 <font class="keyword">inline</font> uint32 <a class="code" href="namespaceNLMISC.html#a272">atoui</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *ident)
00406 {
00407         <font class="keywordflow">return</font> (uint32) strtoul (ident, NULL, 10);
00408 }
00409 
00410 <font class="keywordtype">void</font> CIXml::serial(uint32 &amp;b)
00411 {
00412         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, uint32, 10, <a class="code" href="namespaceNLMISC.html#a272">atoui</a> );
00413 }
00414 
00415 <font class="comment">// ***************************************************************************</font>
00416 
00417 <font class="keywordtype">void</font> CIXml::serial(sint32 &amp;b) 
00418 {
00419         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, sint32, 11, atoi );
00420 }
00421 
00422 <font class="comment">// ***************************************************************************</font>
00423 
00424 <font class="keywordtype">void</font> CIXml::serial(uint64 &amp;b) 
00425 {
00426         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, uint64, 20, atoiInt64 );
00427 }
00428 
00429 <font class="comment">// ***************************************************************************</font>
00430 
00431 <font class="keywordtype">void</font> CIXml::serial(sint64 &amp;b) 
00432 {
00433         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, sint64, 20, atoiInt64 );
00434 }
00435 
00436 <font class="comment">// ***************************************************************************</font>
00437 
00438 <font class="keywordtype">void</font> CIXml::serial(<font class="keywordtype">float</font> &amp;b) 
00439 {
00440         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, <font class="keywordtype">float</font>, 128, atof );
00441 }
00442 
00443 <font class="comment">// ***************************************************************************</font>
00444 
00445 <font class="keywordtype">void</font> CIXml::serial(<font class="keywordtype">double</font> &amp;b) 
00446 {
00447         <a class="code" href="mem__stream_8h.html#a0">readnumber</a>( b, <font class="keywordtype">double</font>, 128, atof );
00448 }
00449 
00450 <font class="comment">// ***************************************************************************</font>
00451 
00452 <font class="keywordtype">void</font> CIXml::serial(<font class="keywordtype">bool</font> &amp;b)
00453 {
00454         serialBit(b);
00455 }
00456 
00457 <font class="comment">// ***************************************************************************</font>
00458 
00459 <font class="keywordtype">void</font> CIXml::serialBit(<font class="keywordtype">bool</font> &amp;bit)
00460 {
00461         uint8 u = (uint8)bit;
00462         serial( u );
00463 }
00464 
00465 <font class="comment">// ***************************************************************************</font>
00466 
00467 <font class="preprocessor">#ifndef NL_OS_CYGWIN</font>
00468 <font class="preprocessor"></font><font class="keywordtype">void</font> CIXml::serial(<font class="keywordtype">char</font> &amp;b) 
00469 {
00470         string <a class="code" href="namespaceNLMISC.html#a294">toto</a>;
00471         serialSeparatedBufferIn ( <a class="code" href="namespaceNLMISC.html#a294">toto</a> );
00472 
00473         <font class="comment">// Good value ?</font>
00474         <font class="keywordflow">if</font> (<a class="code" href="namespaceNLMISC.html#a294">toto</a>.length()!=1)
00475         {
00476                 <font class="comment">// Protect error</font>
00477                 <font class="keywordflow">if</font> (_Parser)
00478                 {
00479                         <font class="comment">// Should have a name</font>
00480                         <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentElement-&gt;name);
00481 
00482                         <font class="comment">// Make an error message</font>
00483                         <font class="keywordtype">char</font> tmp[512];
00484                         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error in block line %d \nValue is not a char in the node named %s"</font>, 
00485                                 (<font class="keywordtype">int</font>)_CurrentElement-&gt;content, _CurrentElement-&gt;name);
00486                         <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00487                 }
00488                 <font class="keywordflow">else</font>
00489                 {
00490                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized"</font> );
00491                 }
00492         }
00493         <font class="keywordflow">else</font>
00494                 b=<a class="code" href="namespaceNLMISC.html#a294">toto</a>[0];
00495 }
00496 <font class="preprocessor">#endif // NL_OS_CYGWIN</font>
00497 <font class="preprocessor"></font>
00498 <font class="comment">// ***************************************************************************</font>
00499 
00500 <font class="keywordtype">void</font> CIXml::serial(std::string &amp;b)
00501 {
00502         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00503 
00504         <font class="comment">// Attibute ?</font>
00505         <font class="keywordflow">if</font> (_PushBegin)
00506         {
00507                 <font class="comment">// Only serial the string</font>
00508                 serialSeparatedBufferIn ( b, <font class="keyword">false</font> );
00509         }
00510         <font class="keywordflow">else</font>
00511         {
00512                 <font class="comment">// Open a string node</font>
00513                 xmlPush (<font class="stringliteral">"S"</font>);
00514 
00515                 <font class="comment">// Serial the string</font>
00516                 serialSeparatedBufferIn ( b, <font class="keyword">false</font> );
00517 
00518                 <font class="comment">// Close the node</font>
00519                 xmlPop ();
00520         }
00521 }
00522 
00523 <font class="comment">// ***************************************************************************</font>
00524 
00525 <font class="keywordtype">void</font> CIXml::serial(<a class="code" href="classucstring.html">ucstring</a> &amp;b)
00526 {
00527         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00528 
00530 
00531         <font class="comment">// Serial a simple string</font>
00532         string tmp;
00533 
00534         <font class="comment">// Serial this string</font>
00535         serial (tmp);
00536 
00537         <font class="comment">// Return a ucstring</font>
00538         b = tmp;
00539 }
00540 
00541 <font class="comment">// ***************************************************************************</font>
00542 
00543 <font class="keywordtype">void</font> CIXml::serialBuffer(uint8 *buf, uint len)
00544 {
00545         <font class="comment">// Open a node</font>
00546         xmlPush (<font class="stringliteral">"BUFFER"</font>);
00547 
00548         <font class="comment">// Serialize the buffer</font>
00549         <font class="keywordflow">for</font> (uint i=0; i&lt;len; i++)
00550         {
00551                 xmlPush (<font class="stringliteral">"ELM"</font>);
00552 
00553                 serial (buf[i]);
00554 
00555                 xmlPop ();
00556         }
00557 
00558         <font class="comment">// Close the node</font>
00559         xmlPop ();
00560 }
00561 
00562 <font class="comment">// ***************************************************************************</font>
00563 
00564 <font class="keywordtype">bool</font> CIXml::xmlPushBeginInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *nodeName)
00565 {
00566         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00567 
00568         <font class="comment">// Check _Parser</font>
00569         <font class="keywordflow">if</font> ( _Parser )
00570         {
00571                 <font class="comment">// Can make a xmlPushBegin ?</font>
00572                 <font class="keywordflow">if</font> ( ! _PushBegin )
00573                 {
00574                         <font class="comment">// Current node exist ?</font>
00575                         <font class="keywordflow">if</font> (_CurrentNode==NULL)
00576                         {
00577                                 <font class="comment">// Get the first node</font>
00578                                 _CurrentNode = xmlDocGetRootElement (_Parser-&gt;myDoc);
00579                                 
00580                                 <font class="comment">// Has a root node ?</font>
00581                                 <font class="keywordflow">if</font> (_CurrentNode)
00582                                 {
00583                                         <font class="comment">// Node name must not be NULL</font>
00584                                         <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentNode-&gt;name);
00585 
00586                                         <font class="comment">// Node element with the good name ?</font>
00587                                         <font class="keywordflow">if</font> ( (_CurrentNode-&gt;type != XML_ELEMENT_NODE) || ( (<font class="keyword">const</font> <font class="keywordtype">char</font>*)_CurrentNode-&gt;name != string(nodeName)) )
00588                                         {
00589                                                 <font class="comment">// Make an error message</font>
00590                                                 <font class="keywordtype">char</font> tmp[512];
00591                                                 <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error : root node has the wrong name : \"%s\" should have \"%s\""</font>,
00592                                                         _CurrentNode-&gt;name, nodeName);
00593                                                 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00594                                         }
00595                                 }
00596                                 <font class="keywordflow">else</font>
00597                                 {
00598                                         <font class="comment">// Make an error message</font>
00599                                         <font class="keywordtype">char</font> tmp[512];
00600                                         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error : no root node found."</font>);
00601                                         <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00602                                 }
00603                         }
00604 
00605                         <font class="comment">// Try to open the node</font>
00606                         <font class="keywordflow">do</font>
00607                         {
00608                                 <font class="comment">// Node name must not be NULL</font>
00609                                 <a class="code" href="debug_8h.html#a6">nlassert</a> (_CurrentNode-&gt;name);
00610 
00611                                 <font class="comment">// Node with the good name</font>
00612                                 <font class="keywordflow">if</font> ( (_CurrentNode-&gt;type == XML_ELEMENT_NODE) &amp;&amp; ( (<font class="keyword">const</font> <font class="keywordtype">char</font>*)_CurrentNode-&gt;name == string(nodeName)) )
00613                                 {
00614                                         <font class="comment">// Save current element</font>
00615                                         _CurrentElement = _CurrentNode;
00616 
00617                                         <font class="comment">// Stop searching</font>
00618                                         <font class="keywordflow">break</font>;
00619                                 }
00620                                 <font class="keywordflow">else</font>
00621                                         <font class="comment">// Get next</font>
00622                                         _CurrentNode = _CurrentNode-&gt;next;
00623                         }
00624                         <font class="keywordflow">while</font> (_CurrentNode);
00625 
00626                         <font class="comment">// Not found ?</font>
00627                         <font class="keywordflow">if</font> (_CurrentNode == NULL)
00628                         {
00629                                 <font class="comment">// Make an error message</font>
00630                                 <font class="keywordtype">char</font> tmp[512];
00631                                 <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (tmp, 512, <font class="stringliteral">"NeL XML Syntax error in block line %d \nCan't open the node named %s in node named %s"</font>, 
00632                                         (<font class="keywordtype">int</font>)_CurrentElement-&gt;content, nodeName, _CurrentElement-&gt;name);
00633                                 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00634                         }
00635                         
00636                         <font class="comment">// Get first child</font>
00637                         _CurrentNode = _CurrentNode-&gt;children;
00638 
00639                         <font class="comment">// Push begun</font>
00640                         _PushBegin = <font class="keyword">true</font>;
00641 
00642                         <font class="comment">// Flush current string</font>
00643                         flushContentString ();
00644                 }
00645                 <font class="keywordflow">else</font>
00646                 {
00647                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"You must close your xmlPushBegin - xmlPushEnd before calling a new xmlPushBegin."</font>);
00648                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00649                 }
00650         }
00651         <font class="keywordflow">else</font>
00652         {
00653                 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized."</font>);
00654                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00655         }
00656 
00657         <font class="comment">// Ok</font>
00658         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00659 }
00660 
00661 <font class="comment">// ***************************************************************************</font>
00662 
00663 <font class="keywordtype">bool</font> CIXml::xmlPushEndInternal ()
00664 {
00665         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00666 
00667         <font class="comment">// Check _Parser</font>
00668         <font class="keywordflow">if</font> ( _Parser )
00669         {
00670                 <font class="comment">// Can make a xmlPushEnd ?</font>
00671                 <font class="keywordflow">if</font> ( _PushBegin )
00672                 {
00673                         <font class="comment">// Push begun</font>
00674                         _PushBegin = <font class="keyword">false</font>;
00675                 }
00676                 <font class="keywordflow">else</font>
00677                 {
00678                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"You must call xmlPushBegin before calling xmlPushEnd."</font>);
00679                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00680                 }
00681         }
00682         <font class="keywordflow">else</font>
00683         {
00684                 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized."</font>);
00685                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00686         }
00687 
00688         <font class="comment">// Ok</font>
00689         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00690 }
00691 
00692 <font class="comment">// ***************************************************************************</font>
00693 
00694 <font class="keywordtype">bool</font> CIXml::xmlPopInternal ()
00695 {
00696         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00697 
00698         <font class="comment">// Check _Parser</font>
00699         <font class="keywordflow">if</font> ( _Parser )
00700         {
00701                 <font class="comment">// Not in the push mode ?</font>
00702                 <font class="keywordflow">if</font> ( ! _PushBegin )
00703                 {
00704                         <font class="comment">// Some content to write ?</font>
00705                         flushContentString ();
00706 
00707                         <font class="comment">// Get parents</font>
00708                         _CurrentNode = _CurrentElement;
00709                         _CurrentElement = _CurrentElement-&gt;parent;
00710                         _CurrentNode = _CurrentNode-&gt;next;
00711                 }
00712                 <font class="keywordflow">else</font>
00713                 {
00714                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"You must call xmlPop after xmlPushEnd."</font>);
00715                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00716                 }
00717         }
00718         <font class="keywordflow">else</font>
00719         {
00720                 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized."</font>);
00721                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00722         }
00723 
00724         <font class="comment">// Ok</font>
00725         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00726 }
00727 
00728 <font class="comment">// ***************************************************************************</font>
00729 
00730 <font class="keywordtype">bool</font> CIXml::xmlSetAttribInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *attribName)
00731 {
00732         <a class="code" href="debug_8h.html#a6">nlassert</a>( isReading() );
00733 
00734         <font class="comment">// Check _Parser</font>
00735         <font class="keywordflow">if</font> ( _Parser )
00736         {
00737                 <font class="comment">// Can make a xmlPushEnd ?</font>
00738                 <font class="keywordflow">if</font> ( _PushBegin )
00739                 {
00740                         <font class="comment">// Set attribute name</font>
00741                         _AttribName = attribName;
00742 
00743                         <font class="comment">// Attribute name is present</font>
00744                         _AttribPresent = <font class="keyword">true</font>;
00745                 }
00746                 <font class="keywordflow">else</font>
00747                 {
00748                         <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"You must call xmlSetAttrib between xmlPushBegin and xmlPushEnd calls."</font>);
00749                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00750                 }
00751         }
00752         <font class="keywordflow">else</font>
00753         {
00754                 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been initialized."</font>);
00755                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00756         }
00757 
00758         <font class="comment">// Ok</font>
00759         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00760 }
00761 
00762 <font class="comment">// ***************************************************************************</font>
00763 
00764 <font class="keywordtype">bool</font> CIXml::xmlBreakLineInternal ()
00765 {
00766         <font class="comment">// Ok</font>
00767         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00768 }
00769 
00770 <font class="comment">// ***************************************************************************</font>
00771 
00772 <font class="keywordtype">bool</font> CIXml::xmlCommentInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="cf__lexical_8cpp.html#a115">comment</a>)
00773 {
00774         <font class="comment">// Ok</font>
00775         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00776 }
00777 
00778 <font class="comment">// ***************************************************************************</font>
00779 
00780 xmlNodePtr CIXml::getFirstChildNode (xmlNodePtr parent, <font class="keyword">const</font> <font class="keywordtype">char</font> *childName)
00781 {
00782         xmlNodePtr child = parent-&gt;children;
00783         <font class="keywordflow">while</font> (child)
00784         {
00785                 <font class="keywordflow">if</font> (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)child-&gt;name, childName) == 0)
00786                         <font class="keywordflow">return</font> child;
00787                 child = child-&gt;next;
00788         }
00789         <font class="keywordflow">return</font> NULL;
00790 }
00791 
00792 <font class="comment">// ***************************************************************************</font>
00793 
00794 xmlNodePtr CIXml::getNextChildNode (xmlNodePtr last, <font class="keyword">const</font> <font class="keywordtype">char</font> *childName)
00795 {
00796         last = last-&gt;next;
00797         <font class="keywordflow">while</font> (last)
00798         {
00799                 <font class="keywordflow">if</font> (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)last-&gt;name, childName) == 0)
00800                         <font class="keywordflow">return</font> last;
00801                 last = last-&gt;next;
00802         }
00803         <font class="keywordflow">return</font> NULL;
00804 }
00805 
00806 <font class="comment">// ***************************************************************************</font>
00807 
00808 xmlNodePtr CIXml::getFirstChildNode (xmlNodePtr parent, xmlElementType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00809 {
00810         xmlNodePtr child = parent-&gt;children;
00811         <font class="keywordflow">while</font> (child)
00812         {
00813                 <font class="keywordflow">if</font> (child-&gt;type == <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00814                         <font class="keywordflow">return</font> child;
00815                 child = child-&gt;next;
00816         }
00817         <font class="keywordflow">return</font> NULL;
00818 }
00819 
00820 <font class="comment">// ***************************************************************************</font>
00821 
00822 xmlNodePtr CIXml::getNextChildNode (xmlNodePtr last, xmlElementType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00823 {
00824         last = last-&gt;next;
00825         <font class="keywordflow">while</font> (last)
00826         {
00827                 <font class="keywordflow">if</font> (last-&gt;type == <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00828                         <font class="keywordflow">return</font> last;
00829                 last = last-&gt;next;
00830         }
00831         <font class="keywordflow">return</font> NULL;
00832 }
00833 
00834 <font class="comment">// ***************************************************************************</font>
00835 
00836 uint CIXml::countChildren (xmlNodePtr node, <font class="keyword">const</font> <font class="keywordtype">char</font> *childName)
00837 {
00838         uint count=0;
00839         xmlNodePtr child = getFirstChildNode (node, childName);
00840         <font class="keywordflow">while</font> (child)
00841         {
00842                 count++;
00843                 child = getNextChildNode (child, childName);
00844         }
00845         <font class="keywordflow">return</font> count;
00846 }
00847 
00848 <font class="comment">// ***************************************************************************</font>
00849 
00850 uint CIXml::countChildren (xmlNodePtr node, xmlElementType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00851 {
00852         uint count=0;
00853         xmlNodePtr child = getFirstChildNode (node, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>);
00854         <font class="keywordflow">while</font> (child)
00855         {
00856                 count++;
00857                 child = getNextChildNode (child, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>);
00858         }
00859         <font class="keywordflow">return</font> count;
00860 }
00861 
00862 <font class="comment">// ***************************************************************************</font>
00863 
00864 xmlNodePtr CIXml::getRootNode ()<font class="keyword"> const</font>
00865 <font class="keyword"></font>{
00866         <font class="keywordflow">if</font> (_Parser)
00867                 <font class="keywordflow">if</font> (_Parser-&gt;myDoc)
00868                         <font class="keywordflow">return</font> xmlDocGetRootElement (_Parser-&gt;myDoc);
00869         <font class="keywordflow">return</font> NULL;
00870 }
00871 
00872 <font class="comment">// ***************************************************************************</font>
00873         
00874 <font class="keywordtype">bool</font> CIXml::getPropertyString (std::string &amp;result, xmlNodePtr node, <font class="keyword">const</font> <font class="keywordtype">char</font> *property)
00875 {
00876         <font class="comment">// Get the value</font>
00877         <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlGetProp (node, (xmlChar*)property);
00878         <font class="keywordflow">if</font> (value)
00879         {
00880                 <font class="comment">// Active value</font>
00881                 result = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
00882 
00883                 <font class="comment">// Delete the value</font>
00884                 xmlFree ((<font class="keywordtype">void</font>*)<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>);
00885 
00886                 <font class="comment">// Found</font>
00887                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00888         }
00889         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00890 }
00891 
00892 <font class="comment">// ***************************************************************************</font>
00893         
00894 <font class="keywordtype">bool</font> CIXml::getContentString (std::string &amp;result, xmlNodePtr node)
00895 {
00896         <font class="keyword">const</font> <font class="keywordtype">char</font> *valueText = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlNodeGetContent (node);
00897         <font class="keywordflow">if</font> (valueText)
00898         {
00899                 result = valueText;
00900 
00901                 <font class="comment">// Delete the value</font>
00902                 xmlFree ((<font class="keywordtype">void</font>*)valueText);
00903         
00904                 <font class="comment">// Found</font>
00905                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00906         }
00907         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00908 }
00909 
00910 <font class="comment">// ***************************************************************************</font>
00911         
00912 } <font class="comment">// NLMISC</font>
00913 
00914 <font class="preprocessor">#endif // NL_DONT_USE_EXTERNAL_CODE</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>