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
|
<!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> <A CLASS=uplinks HREF=><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>nevrax.com</B></FONT></A> </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>
<!-- 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> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>o_xml.cpp</h1><a href="o__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="o__xml_8h.html">nel/misc/o_xml.h</a>"</font>
00029
00030 <font class="preprocessor">#ifndef NL_DONT_USE_EXTERNAL_CODE</font>
00031 <font class="preprocessor"></font>
00032 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00033
00034 <font class="keyword">namespace </font>NLMISC
00035 {
00036
00037 <font class="comment">// ***************************************************************************</font>
00038
00039 <font class="keyword">const</font> <font class="keywordtype">char</font> <a class="code" href="namespaceNLMISC.html#a169">SEPARATOR</a> = <font class="charliteral">' '</font>;
00040
00041 <font class="comment">// ***************************************************************************</font>
00042
<a name="l00043"></a><a class="code" href="o__xml_8cpp.html#a0">00043</a> <font class="preprocessor">#define writenumber(src,format,digits) \</font>
00044 <font class="preprocessor"> char number_as_cstring [digits+1]; \</font>
00045 <font class="preprocessor"> sprintf( number_as_cstring, format, src ); \</font>
00046 <font class="preprocessor"> serialSeparatedBufferOut( number_as_cstring );</font>
00047 <font class="preprocessor"></font>
00048 <font class="comment">// ***************************************************************************</font>
00049
<a name="l00050"></a><a class="code" href="classNLMISC_1_1COXml.html#c23">00050</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> COXml::flushContentString ()
00051 {
00052 <font class="comment">// Current node must exist here</font>
00053 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>);
00054
00055 <font class="comment">// String size</font>
00056 uint size=<a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a>.length();
00057
00058 <font class="comment">// Some content to write ?</font>
00059 <font class="keywordflow">if</font> (size)
00060 {
00061 <font class="comment">// Write it in the current node</font>
00062 xmlNodePtr textNode = xmlNewText ((<font class="keyword">const</font> xmlChar *)<a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a>.c_str());
00063 xmlAddChild (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>, textNode);
00064
00065 <font class="comment">// Empty the string</font>
00066 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a>.erase ();
00067 }
00068 }
00069
00070 <font class="comment">// ***************************************************************************</font>
00071
<a name="l00072"></a><a class="code" href="classNLMISC_1_1COXml.html#a0">00072</a> COXml::COXml () : IStream (false <font class="comment">/* Output mode */</font>)
00073 {
00074 <font class="comment">// Set XML mode</font>
00075 <a class="code" href="classNLMISC_1_1IStream.html#b0">setXMLMode</a> (<font class="keyword">true</font>);
00076
00077 <font class="comment">// Set the stream</font>
00078 <a class="code" href="classNLMISC_1_1COXml.html#o3">_InternalStream</a> = NULL;
00079
00080 <font class="comment">// Set the version</font>
00081 <a class="code" href="classNLMISC_1_1COXml.html#o5">_Version</a> = <font class="stringliteral">"1.0"</font>;
00082
00083 <font class="comment">// Initialise the document</font>
00084 <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> = NULL;
00085
00086 <font class="comment">// Current node</font>
00087 <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a> = NULL;
00088
00089 <font class="comment">// Content string</font>
00090 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a> = <font class="stringliteral">""</font>;
00091
00092 <font class="comment">// Push begin</font>
00093 <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> = <font class="keyword">false</font>;
00094 }
00095
00096 <font class="comment">// ***************************************************************************</font>
00097
<a name="l00098"></a><a class="code" href="classNLMISC_1_1COXml.html#a1">00098</a> <font class="keywordtype">bool</font> COXml::init (IStream *stream, <font class="keyword">const</font> <font class="keywordtype">char</font> *version)
00099 {
00100 <font class="comment">// Output stream ?</font>
00101 <font class="keywordflow">if</font> (!stream->isReading())
00102 {
00103 <font class="comment">// Set XML mode</font>
00104 <a class="code" href="classNLMISC_1_1IStream.html#b0">setXMLMode</a> (<font class="keyword">true</font>);
00105
00106 <font class="comment">// Set the stream</font>
00107 <a class="code" href="classNLMISC_1_1COXml.html#o3">_InternalStream</a> = stream;
00108
00109 <font class="comment">// Set the version</font>
00110 <a class="code" href="classNLMISC_1_1COXml.html#o5">_Version</a> = version;
00111
00112 <font class="comment">// Initialise the document</font>
00113 <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> = NULL;
00114
00115 <font class="comment">// Current node</font>
00116 <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a> = NULL;
00117
00118 <font class="comment">// Content string</font>
00119 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a> = <font class="stringliteral">""</font>;
00120
00121 <font class="comment">// Push begin</font>
00122 <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> = <font class="keyword">false</font>;
00123
00124 <font class="comment">// Ok</font>
00125 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00126 }
00127 <font class="keywordflow">else</font>
00128 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00129 }
00130
00131 <font class="comment">// ***************************************************************************</font>
00132
<a name="l00133"></a><a class="code" href="classNLMISC_1_1COXml.html#a2">00133</a> COXml::~COXml ()
00134 {
00135 <font class="comment">// Flush document to the internal stream</font>
00136 <a class="code" href="classNLMISC_1_1COXml.html#a3">flush</a> ();
00137 }
00138
00139 <font class="comment">// ***************************************************************************</font>
00140
<a name="l00141"></a><a class="code" href="classNLMISC_1_1COXml.html#c22">00141</a> <font class="keywordtype">void</font> COXml::serialSeparatedBufferOut( <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> )
00142 {
00143 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00144
00145 <font class="comment">// Output stream has been setuped ?</font>
00146 <font class="keywordflow">if</font> ( _InternalStream )
00147 {
00148 <font class="comment">// Current node presents ?</font>
00149 <font class="keywordflow">if</font> (_CurrentNode)
00150 {
00151 <font class="comment">// Write a push attribute ?</font>
00152 <font class="keywordflow">if</font> (_PushBegin)
00153 {
00154 <font class="comment">// Current attrib is set ?</font>
00155 <font class="keywordflow">if</font> (_AttribPresent)
00156 {
00157 <font class="comment">// Set the attribute</font>
00158 xmlSetProp (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLMISC_1_1COXml.html#o2">_AttribName</a>.c_str(), (<font class="keyword">const</font> xmlChar*)<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>);
00159
00160 <font class="comment">// The attribute has been used </font>
00161 <a class="code" href="classNLMISC_1_1COXml.html#o1">_AttribPresent</a> = <font class="keyword">false</font>;
00162 }
00163 <font class="keywordflow">else</font>
00164 {
00165 <font class="comment">// * Error, the stream don't use XML streaming properly</font>
00166 <font class="comment">// * You must take care of this in your last serial call:</font>
00167 <font class="comment">// * - Between xmlPushBegin() and xmlPushEnd(), before each serial, you must set the attribute name with xmlSetAttrib.</font>
00168 <font class="comment">// * - Between xmlPushBegin() and xmlPushEnd(), you must serial only basic objects (numbers and strings).</font>
00169 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Error, the stream don't use XML streaming properly"</font> );
00170 }
00171 }
00172 <font class="keywordflow">else</font>
00173 {
00174 <font class="comment">// Get the content buffer size</font>
00175 uint size=<a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a>.length();
00176
00177 <font class="comment">// Add a separator</font>
00178 <font class="keywordflow">if</font> ((size) && (<a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a>[size-1]!=<font class="charliteral">'\n'</font>))
00179 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a> += <a class="code" href="namespaceNLMISC.html#a169">SEPARATOR</a>;
00180
00181 <font class="comment">// Concat the strings</font>
00182 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a> += <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
00183 }
00184 }
00185 <font class="keywordflow">else</font>
00186 {
00187 <font class="comment">// * Error, no current node present.</font>
00188 <font class="comment">// * Check that your serial is initialy made between a xmlPushBegin and xmlPushEnd calls.</font>
00189 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Error, the stream don't use XML streaming properly"</font> );
00190 }
00191 }
00192 <font class="keywordflow">else</font>
00193 {
00194 <a class="code" href="debug_8h.html#a3">nlerror</a> ( <font class="stringliteral">"Output stream has not been setuped"</font> );
00195 }
00196 }
00197
00198 <font class="comment">// ***************************************************************************</font>
00199
<a name="l00200"></a><a class="code" href="classNLMISC_1_1COXml.html#c0">00200</a> <font class="keywordtype">void</font> COXml::serial(uint8 &b)
00201 {
00202 <font class="comment">// Write the number</font>
00203 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( (uint16)b,<font class="stringliteral">"%hu"</font>, 3 );
00204 }
00205
00206 <font class="comment">// ***************************************************************************</font>
00207
<a name="l00208"></a><a class="code" href="classNLMISC_1_1COXml.html#c1">00208</a> <font class="keywordtype">void</font> COXml::serial(sint8 &b)
00209 {
00210 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( (sint16)b, <font class="stringliteral">"%hd"</font>, 4 );
00211 }
00212
00213 <font class="comment">// ***************************************************************************</font>
00214
<a name="l00215"></a><a class="code" href="classNLMISC_1_1COXml.html#c2">00215</a> <font class="keywordtype">void</font> COXml::serial(uint16 &b)
00216 {
00217 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%hu"</font>, 5 );
00218 }
00219
00220 <font class="comment">// ***************************************************************************</font>
00221
<a name="l00222"></a><a class="code" href="classNLMISC_1_1COXml.html#c3">00222</a> <font class="keywordtype">void</font> COXml::serial(sint16 &b)
00223 {
00224 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%hd"</font>, 6 );
00225 }
00226
00227 <font class="comment">// ***************************************************************************</font>
00228
<a name="l00229"></a><a class="code" href="classNLMISC_1_1COXml.html#c4">00229</a> <font class="keywordtype">void</font> COXml::serial(uint32 &b)
00230 {
00231 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%u"</font>, 10 );
00232 }
00233
00234 <font class="comment">// ***************************************************************************</font>
00235
<a name="l00236"></a><a class="code" href="classNLMISC_1_1COXml.html#c5">00236</a> <font class="keywordtype">void</font> COXml::serial(sint32 &b)
00237 {
00238 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%d"</font>, 11 );
00239 }
00240
00241 <font class="comment">// ***************************************************************************</font>
00242
<a name="l00243"></a><a class="code" href="classNLMISC_1_1COXml.html#c6">00243</a> <font class="keywordtype">void</font> COXml::serial(uint64 &b)
00244 {
00245 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%"</font>NL_I64<font class="stringliteral">"u"</font>, 20 );
00246 }
00247
00248 <font class="comment">// ***************************************************************************</font>
00249
<a name="l00250"></a><a class="code" href="classNLMISC_1_1COXml.html#c7">00250</a> <font class="keywordtype">void</font> COXml::serial(sint64 &b)
00251 {
00252 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%"</font>NL_I64<font class="stringliteral">"d"</font>, 20 );
00253 }
00254
00255 <font class="comment">// ***************************************************************************</font>
00256
<a name="l00257"></a><a class="code" href="classNLMISC_1_1COXml.html#c8">00257</a> <font class="keywordtype">void</font> COXml::serial(<font class="keywordtype">float</font> &b)
00258 {
00259 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( (<font class="keywordtype">double</font>)b, <font class="stringliteral">"%f"</font>, 128 );
00260 }
00261
00262 <font class="comment">// ***************************************************************************</font>
00263
<a name="l00264"></a><a class="code" href="classNLMISC_1_1COXml.html#c9">00264</a> <font class="keywordtype">void</font> COXml::serial(<font class="keywordtype">double</font> &b)
00265 {
00266 <a class="code" href="mem__stream_8h.html#a1">writenumber</a>( b, <font class="stringliteral">"%f"</font>, 128 );
00267 }
00268
00269 <font class="comment">// ***************************************************************************</font>
00270
<a name="l00271"></a><a class="code" href="classNLMISC_1_1COXml.html#c10">00271</a> <font class="keywordtype">void</font> COXml::serial(<font class="keywordtype">bool</font> &b)
00272 {
00273 <a class="code" href="classNLMISC_1_1COXml.html#c15">serialBit</a>(b);
00274 }
00275
00276 <font class="comment">// ***************************************************************************</font>
00277
<a name="l00278"></a><a class="code" href="classNLMISC_1_1COXml.html#c15">00278</a> <font class="keywordtype">void</font> COXml::serialBit(<font class="keywordtype">bool</font> &bit)
00279 {
00280 uint8 u = (uint8)bit;
00281 <a class="code" href="classNLMISC_1_1COXml.html#c0">serial</a>( u );
00282 }
00283
00284 <font class="comment">// ***************************************************************************</font>
00285
00286 <font class="preprocessor">#ifndef NL_OS_CYGWIN</font>
<a name="l00287"></a><a class="code" href="classNLMISC_1_1COXml.html#c11">00287</a> <font class="preprocessor"></font><font class="keywordtype">void</font> COXml::serial(<font class="keywordtype">char</font> &b)
00288 {
00289 <font class="keywordtype">char</font> tmp[2] = {b , 0};
00290 <a class="code" href="classNLMISC_1_1COXml.html#c22">serialSeparatedBufferOut</a>( tmp );
00291 }
00292 <font class="preprocessor">#endif // NL_OS_CYGWIN</font>
00293 <font class="preprocessor"></font>
00294 <font class="comment">// ***************************************************************************</font>
00295
<a name="l00296"></a><a class="code" href="classNLMISC_1_1COXml.html#c12">00296</a> <font class="keywordtype">void</font> COXml::serial(std::string &b)
00297 {
00298 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00299
00300 <font class="comment">// Attibute ?</font>
00301 <font class="keywordflow">if</font> (_PushBegin)
00302 {
00303 <font class="comment">// Only serial the string</font>
00304 <a class="code" href="classNLMISC_1_1COXml.html#c22">serialSeparatedBufferOut</a>( b.c_str() );
00305 }
00306 <font class="keywordflow">else</font>
00307 {
00308 <font class="comment">// Open a string node</font>
00309 <a class="code" href="classNLMISC_1_1IStream.html#a38">xmlPush</a> (<font class="stringliteral">"S"</font>);
00310
00311 <font class="comment">// Serial the string</font>
00312 <a class="code" href="classNLMISC_1_1COXml.html#c22">serialSeparatedBufferOut</a>( b.c_str() );
00313
00314 <font class="comment">// Close the node</font>
00315 <a class="code" href="classNLMISC_1_1IStream.html#a41">xmlPop</a> ();
00316 }
00317 }
00318
00319 <font class="comment">// ***************************************************************************</font>
00320
<a name="l00321"></a><a class="code" href="classNLMISC_1_1COXml.html#c13">00321</a> <font class="keywordtype">void</font> COXml::serial(<a class="code" href="classucstring.html">ucstring</a> &b)
00322 {
00323 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00324
00325 <font class="comment">// Iniput size</font>
00326 uint size=b.length();
00327
00328 <font class="comment">// Output string</font>
00329 string output;
00330 output.resize (b.length());
00331
00332 <font class="comment">// For each character</font>
00333 <font class="keywordflow">for</font> (uint i=0; i<size; i++)
00334 {
00335 <font class="comment">// 7 bits code ?</font>
00336 <font class="keywordflow">if</font> (b[i]<0x7F)
00337 {
00338 output[i]=(char)b[i];
00339 }
00340 <font class="keywordflow">else</font>
00341 {
00343 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"handle ucstring to utf-8"</font>);
00344 output[i]=(b[i]&0xff);
00345 }
00346 }
00347
00348 <font class="comment">// Serial this string</font>
00349 <a class="code" href="classNLMISC_1_1COXml.html#c0">serial</a> (output);
00350 }
00351
00352 <font class="comment">// ***************************************************************************</font>
00353
<a name="l00354"></a><a class="code" href="classNLMISC_1_1COXml.html#c14">00354</a> <font class="keywordtype">void</font> COXml::serialBuffer(uint8 *buf, uint len)
00355 {
00356 <font class="comment">// Open a node</font>
00357 <a class="code" href="classNLMISC_1_1IStream.html#a38">xmlPush</a> (<font class="stringliteral">"BUFFER"</font>);
00358
00359 <font class="comment">// Serialize the buffer</font>
00360 <font class="keywordflow">for</font> (uint i=0; i<len; i++)
00361 {
00362 <a class="code" href="classNLMISC_1_1IStream.html#a38">xmlPush</a> (<font class="stringliteral">"ELM"</font>);
00363
00364 <a class="code" href="classNLMISC_1_1COXml.html#c0">serial</a> (buf[i]);
00365
00366 <a class="code" href="classNLMISC_1_1IStream.html#a41">xmlPop</a> ();
00367 }
00368
00369 <font class="comment">// Close the node</font>
00370 <a class="code" href="classNLMISC_1_1IStream.html#a41">xmlPop</a> ();
00371 }
00372
00373 <font class="comment">// ***************************************************************************</font>
00374
<a name="l00375"></a><a class="code" href="classNLMISC_1_1COXml.html#c16">00375</a> <font class="keywordtype">bool</font> COXml::xmlPushBeginInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *nodeName)
00376 {
00377 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00378
00379 <font class="comment">// Check _InternalStream</font>
00380 <font class="keywordflow">if</font> ( _InternalStream )
00381 {
00382 <font class="comment">// Can make a xmlPushBegin ?</font>
00383 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> )
00384 {
00385 <font class="comment">// Current node exist ?</font>
00386 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>==NULL)
00387 {
00388 <font class="comment">// No document ?</font>
00389 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> == NULL)
00390 {
00391 <font class="comment">// Initialise the document</font>
00392 <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> = xmlNewDoc ((<font class="keyword">const</font> xmlChar *)<a class="code" href="classNLMISC_1_1COXml.html#o5">_Version</a>.c_str());
00393
00394 <font class="comment">// Return NULL if error</font>
00395 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>);
00396 }
00397
00398 <font class="comment">// Create the first node</font>
00399 <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>=xmlNewDocNode (<a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>, NULL, (<font class="keyword">const</font> xmlChar*)nodeName, NULL);
00400 xmlDocSetRootElement (<a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>, <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>);
00401
00402 <font class="comment">// Return NULL if error</font>
00403 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>);
00404 }
00405 <font class="keywordflow">else</font>
00406 {
00407 <font class="comment">// Flush current content string ?</font>
00408 <a class="code" href="classNLMISC_1_1COXml.html#c23">flushContentString</a> ();
00409
00410 <font class="comment">// Create a new node</font>
00411 <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>=xmlNewChild (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>, NULL, (<font class="keyword">const</font> xmlChar*)nodeName, NULL);
00412
00413 <font class="comment">// Return NULL if error</font>
00414 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>);
00415 }
00416
00417 <font class="comment">// Push begun</font>
00418 <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> = <font class="keyword">true</font>;
00419 }
00420 <font class="keywordflow">else</font>
00421 {
00422 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must close your xmlPushBegin - xmlPushEnd before calling a new xmlPushBegin."</font>);
00423 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00424 }
00425 }
00426 <font class="keywordflow">else</font>
00427 {
00428 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00429 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00430 }
00431
00432 <font class="comment">// Ok</font>
00433 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00434 }
00435
00436 <font class="comment">// ***************************************************************************</font>
00437
<a name="l00438"></a><a class="code" href="classNLMISC_1_1COXml.html#c17">00438</a> <font class="keywordtype">bool</font> COXml::xmlPushEndInternal ()
00439 {
00440 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00441
00442 <font class="comment">// Check _InternalStream</font>
00443 <font class="keywordflow">if</font> ( _InternalStream )
00444 {
00445 <font class="comment">// Can make a xmlPushEnd ?</font>
00446 <font class="keywordflow">if</font> ( _PushBegin )
00447 {
00448 <font class="comment">// Push begun</font>
00449 <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> = <font class="keyword">false</font>;
00450 }
00451 <font class="keywordflow">else</font>
00452 {
00453 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must call xmlPushBegin before calling xmlPushEnd."</font>);
00454 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00455 }
00456 }
00457 <font class="keywordflow">else</font>
00458 {
00459 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00460 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00461 }
00462
00463 <font class="comment">// Ok</font>
00464 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00465 }
00466
00467 <font class="comment">// ***************************************************************************</font>
00468
<a name="l00469"></a><a class="code" href="classNLMISC_1_1COXml.html#c18">00469</a> <font class="keywordtype">bool</font> COXml::xmlPopInternal ()
00470 {
00471 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00472
00473 <font class="comment">// Check _InternalStream</font>
00474 <font class="keywordflow">if</font> ( _InternalStream )
00475 {
00476 <font class="comment">// Not in the push mode ?</font>
00477 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> )
00478 {
00479 <font class="comment">// Some content to write ?</font>
00480 <a class="code" href="classNLMISC_1_1COXml.html#c23">flushContentString</a> ();
00481
00482 <font class="comment">// Get parent</font>
00483 <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>=<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>->parent;
00484 }
00485 <font class="keywordflow">else</font>
00486 {
00487 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must call xmlPop after xmlPushEnd."</font>);
00488 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00489 }
00490 }
00491 <font class="keywordflow">else</font>
00492 {
00493 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00494 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00495 }
00496
00497 <font class="comment">// Ok</font>
00498 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00499 }
00500
00501 <font class="comment">// ***************************************************************************</font>
00502
<a name="l00503"></a><a class="code" href="classNLMISC_1_1COXml.html#c19">00503</a> <font class="keywordtype">bool</font> COXml::xmlSetAttribInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *attribName)
00504 {
00505 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00506
00507 <font class="comment">// Check _InternalStream</font>
00508 <font class="keywordflow">if</font> ( _InternalStream )
00509 {
00510 <font class="comment">// Can make a xmlPushEnd ?</font>
00511 <font class="keywordflow">if</font> ( _PushBegin )
00512 {
00513 <font class="comment">// Set attribute name</font>
00514 <a class="code" href="classNLMISC_1_1COXml.html#o2">_AttribName</a> = attribName;
00515
00516 <font class="comment">// Attribute name is present</font>
00517 <a class="code" href="classNLMISC_1_1COXml.html#o1">_AttribPresent</a> = <font class="keyword">true</font>;
00518 }
00519 <font class="keywordflow">else</font>
00520 {
00521 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must call xmlSetAttrib between xmlPushBegin and xmlPushEnd calls."</font>);
00522 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00523 }
00524 }
00525 <font class="keywordflow">else</font>
00526 {
00527 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00528 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00529 }
00530
00531 <font class="comment">// Ok</font>
00532 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00533 }
00534
00535 <font class="comment">// ***************************************************************************</font>
00536
<a name="l00537"></a><a class="code" href="classNLMISC_1_1COXml.html#c20">00537</a> <font class="keywordtype">bool</font> COXml::xmlBreakLineInternal ()
00538 {
00539 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00540
00541 <font class="comment">// Check _InternalStream</font>
00542 <font class="keywordflow">if</font> ( _InternalStream )
00543 {
00544 <font class="comment">// Not in the push mode ?</font>
00545 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLMISC_1_1COXml.html#o0">_PushBegin</a> )
00546 {
00547 <font class="comment">// Add a break line</font>
00548 <a class="code" href="classNLMISC_1_1COXml.html#o7">_ContentString</a> += <font class="charliteral">'\n'</font>;
00549 }
00550 <font class="keywordflow">else</font>
00551 {
00552 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must call xmlNBreakLine after xmlPushEnd."</font>);
00553 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00554 }
00555 }
00556 <font class="keywordflow">else</font>
00557 {
00558 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00559 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00560 }
00561
00562 <font class="comment">// Ok</font>
00563 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00564 }
00565
00566 <font class="comment">// ***************************************************************************</font>
00567
<a name="l00568"></a><a class="code" href="classNLMISC_1_1COXml.html#c21">00568</a> <font class="keywordtype">bool</font> COXml::xmlCommentInternal (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="cf__lexical_8cpp.html#a115">comment</a>)
00569 {
00570 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! <a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
00571
00572 <font class="comment">// Check _InternalStream</font>
00573 <font class="keywordflow">if</font> ( _InternalStream )
00574 {
00575 <font class="comment">// Not in the push mode ?</font>
00576 <font class="keywordflow">if</font> ( <a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a> != NULL)
00577 {
00578 <font class="comment">// Add a comment node</font>
00579 xmlNodePtr commentPtr = xmlNewComment ((<font class="keyword">const</font> xmlChar *)<a class="code" href="cf__lexical_8cpp.html#a115">comment</a>);
00580
00581 <font class="comment">// Add the node</font>
00582 xmlAddChild (<a class="code" href="classNLMISC_1_1COXml.html#o6">_CurrentNode</a>, commentPtr);
00583 }
00584 <font class="keywordflow">else</font>
00585 {
00586 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"You must call xmlCommentInternal between xmlPushBegin and xmlPushEnd."</font>);
00587 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00588 }
00589 }
00590 <font class="keywordflow">else</font>
00591 {
00592 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"Output stream has not been setuped."</font>);
00593 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00594 }
00595 <font class="comment">// Ok</font>
00596 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00597 }
00598
00599 <font class="comment">// ***************************************************************************</font>
00600
<a name="l00601"></a><a class="code" href="classNLMISC_1_1COXml.html#a3">00601</a> <font class="keywordtype">void</font> COXml::flush ()
00602 {
00603 <font class="keywordflow">if</font> (_Document)
00604 {
00605 <font class="comment">// Generate indentation</font>
00606 xmlKeepBlanksDefault (0);
00607
00608 <font class="comment">// Create a output context</font>
00609 xmlOutputBufferPtr outputBuffer = xmlOutputBufferCreateIO ( <a class="code" href="classNLMISC_1_1COXml.html#a303">xmlOutputWriteCallbackForNeL</a>, <a class="code" href="classNLMISC_1_1COXml.html#a304">xmlOutputCloseCallbackForNeL</a>, <font class="keyword">this</font>, NULL );
00610
00611 <font class="comment">// Save the file</font>
00612 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = xmlSaveFormatFileTo (outputBuffer, <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>, NULL, 1);
00613
00614 <font class="comment">// No error should be returned because, exception should be raised by the internal stream</font>
00615 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>!=-1);
00616
00617 <font class="comment">// Free the document</font>
00618 xmlFreeDoc (<a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>);
00619 <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> = NULL;
00620 }
00621 }
00622
00623 <font class="comment">// ***************************************************************************</font>
00624
00625 <font class="comment">// XML callbacks</font>
00626
00627 <font class="comment">// ***************************************************************************</font>
00628
<a name="l00629"></a><a class="code" href="classNLMISC_1_1COXml.html#a303">00629</a> <font class="keywordtype">int</font> <a class="code" href="namespaceNLMISC.html#a303">xmlOutputWriteCallbackForNeL</a> ( <font class="keywordtype">void</font> *context, <font class="keyword">const</font> <font class="keywordtype">char</font> *buffer, <font class="keywordtype">int</font> len)
00630 {
00631 <font class="comment">// Get the object</font>
00632 COXml *object = (COXml*) context;
00633
00634 <font class="comment">// Serialise the buffer</font>
00635 object->_InternalStream->serialBuffer ((uint8*)buffer, len);
00636
00637 <font class="comment">// Return the value</font>
00638 <font class="keywordflow">return</font> len;
00639 }
00640
00641 <font class="comment">// ***************************************************************************</font>
00642
<a name="l00643"></a><a class="code" href="classNLMISC_1_1COXml.html#a304">00643</a> <font class="keywordtype">int</font> <a class="code" href="namespaceNLMISC.html#a304">xmlOutputCloseCallbackForNeL</a> ( <font class="keywordtype">void</font> *context )
00644 {
00645 <font class="comment">// Get the object</font>
00646 <font class="comment">// COXml *object = (COXml*) context;</font>
00647
00648 <font class="comment">// Does nothing</font>
00649 <font class="keywordflow">return</font> 1;
00650 }
00651
00652 <font class="comment">// ***************************************************************************</font>
00653
<a name="l00654"></a><a class="code" href="classNLMISC_1_1COXml.html#a4">00654</a> xmlDocPtr COXml::getDocument ()
00655 {
00656 <font class="keywordflow">if</font> (_Document)
00657 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>;
00658
00659 <font class="comment">// Initialise the document</font>
00660 <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a> = xmlNewDoc ((<font class="keyword">const</font> xmlChar *)<a class="code" href="classNLMISC_1_1COXml.html#o5">_Version</a>.c_str());
00661
00662 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1COXml.html#o4">_Document</a>;
00663 }
00664
00665 <font class="comment">// ***************************************************************************</font>
00666
<a name="l00667"></a><a class="code" href="classNLMISC_1_1COXml.html#d0">00667</a> <font class="keywordtype">bool</font> COXml::isStringValidForProperties (<font class="keyword">const</font> <font class="keywordtype">char</font> *str)
00668 {
00669 <font class="keywordflow">while</font> (*str)
00670 {
00671 <font class="keywordflow">if</font> (*str == <font class="charliteral">'\n'</font>)
00672 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00673 str++;
00674 }
00675 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00676 }
00677
00678 <font class="comment">// ***************************************************************************</font>
00679
00680 } <font class="comment">// NLMISC</font>
00681
00682 <font class="preprocessor">#endif // NL_DONT_USE_EXTERNAL_CODE</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|