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
|
<!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>form.cpp</h1><a href="form_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2000 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="stdgeorges_8h.html">stdgeorges.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 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
00031
00032 <font class="preprocessor">#include "<a class="code" href="form_8h.html">form.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="form__loader_8h.html">form_loader.h</a>"</font>
00034
00035 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00036
00037 <font class="keyword">namespace </font>NLGEORGES
00038 {
00039
00040 <font class="comment">// ***************************************************************************</font>
00041 <font class="comment">// Misc</font>
00042 <font class="comment">// ***************************************************************************</font>
00043
00044 <font class="keywordtype">void</font> <a class="code" href="namespaceNLGEORGES.html#a0">warning</a> (<font class="keywordtype">bool</font> exception, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a>, ... )
00045 {
00046 <font class="comment">// Make a buffer string</font>
00047 va_list args;
00048 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a> );
00049 <font class="keywordtype">char</font> <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>[1024];
00050 <a class="code" href="types__nl_8h.html#a13">sint</a> ret = vsnprintf( <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>, 1024, <a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a>, args );
00051 va_end( args );
00052
00053 <font class="comment">// Set the warning</font>
00054 <font class="keywordflow">if</font> (exception)
00055 {
00056 <font class="comment">// Make an error message</font>
00057 <font class="keywordtype">char</font> tmp[1024];
00058 <a class="code" href="namespaceNLMISC.html#a203">smprintf</a> (tmp, 1024, <font class="stringliteral">"NeL::Georges %s"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>);
00059 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00060 }
00061 <font class="keywordflow">else</font>
00062 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NeL::Georges %s"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>);
00063 }
00064
00065 <font class="comment">// ***************************************************************************</font>
00066 <font class="comment">// UForm</font>
00067 <font class="comment">// ***************************************************************************</font>
00068
<a name="l00069"></a><a class="code" href="classNLGEORGES_1_1UForm.html#a0">00069</a> UForm::~UForm ()
00070 {
00071 }
00072
00073 <font class="comment">// ***************************************************************************</font>
00074
<a name="l00075"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a0">00075</a> UFormElm& CForm::getRootNode ()
00076 {
00077 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#m1">Elements</a>;
00078 }
00079
00080 <font class="comment">// ***************************************************************************</font>
00081
<a name="l00082"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a1">00082</a> <font class="keyword">const</font> UFormElm& CForm::getRootNode ()<font class="keyword"> const</font>
00083 <font class="keyword"></font>{
00084 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#m1">Elements</a>;
00085 }
00086
00087 <font class="comment">// ***************************************************************************</font>
00088 <font class="comment">// CForm</font>
00089 <font class="comment">// ***************************************************************************</font>
00090
<a name="l00091"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a3">00091</a> CForm::CForm () : Elements (this, NULL, NULL, 0xffffffff)
00092 {
00093 <a class="code" href="types__nl_8h.html#a14">uint</a> i;
00094 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLGEORGES_1_1CForm.html#s1s0">HeldElementCount</a>; i++)
00095 {
00096 <a class="code" href="classNLGEORGES_1_1CForm.html#m2">HeldElements</a>[i] = <font class="keyword">new</font> CFormElmStruct (<font class="keyword">this</font>, NULL, NULL, 0xffffffff);
00097 }
00098 }
00099
00100 <font class="comment">// ***************************************************************************</font>
00101
<a name="l00102"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a4">00102</a> CForm::~CForm ()
00103 {
00104 <a class="code" href="types__nl_8h.html#a14">uint</a> i;
00105 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLGEORGES_1_1CForm.html#s1s0">HeldElementCount</a>; i++)
00106 {
00107 <font class="keyword">delete</font> <a class="code" href="classNLGEORGES_1_1CForm.html#m2">HeldElements</a>[i];
00108 }
00109 }
00110
00111 <font class="comment">// ***************************************************************************</font>
00112
<a name="l00113"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a6">00113</a> <font class="keywordtype">void</font> CForm::write (xmlDocPtr doc, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keywordtype">bool</font> georges4CVS)
00114 {
00115 <font class="comment">// Save the filename</font>
00116 <a class="code" href="classNLGEORGES_1_1CForm.html#o1">_Filename</a> = CFile::getFilename (filename);
00117
00118 <font class="comment">// Create the first node</font>
00119 xmlNodePtr node = xmlNewDocNode (doc, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"FORM"</font>, NULL);
00120 xmlDocSetRootElement (doc, node);
00121
00122 <font class="comment">// List of parent</font>
00123 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> parent=0; parent<<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.size (); parent++)
00124 {
00125 <font class="comment">// Parent name not empty ?</font>
00126 <font class="keywordflow">if</font> (!(<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>[parent].ParentFilename.empty()))
00127 {
00128 <font class="comment">// Add a parent node</font>
00129 xmlNodePtr parentNode = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PARENT"</font>, NULL );
00130 xmlSetProp (parentNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Filename"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>[parent].ParentFilename.c_str());
00131 }
00132 }
00133
00134 <font class="comment">// Write elements</font>
00135 <a class="code" href="classNLGEORGES_1_1CForm.html#m1">Elements</a>.write (node, <font class="keyword">this</font>, NULL, <font class="keyword">true</font>);
00136
00137 <font class="comment">// Write held elements</font>
00138 <a class="code" href="types__nl_8h.html#a14">uint</a> i;
00139 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLGEORGES_1_1CForm.html#s1s0">HeldElementCount</a>; i++)
00140 {
00141 <a class="code" href="classNLGEORGES_1_1CForm.html#m2">HeldElements</a>[i]->write (node, <font class="keyword">this</font>, NULL, <font class="keyword">true</font>);
00142 }
00143
00144 <font class="comment">// Header</font>
00145 <a class="code" href="classNLGEORGES_1_1CForm.html#m0">Header</a>.write (node, georges4CVS);
00146 }
00147
00148 <font class="comment">// ***************************************************************************</font>
00149
<a name="l00150"></a><a class="code" href="classNLGEORGES_1_1CForm.html#c1">00150</a> <font class="keywordtype">void</font> CForm::readParent (<font class="keyword">const</font> <font class="keywordtype">char</font> *parent, CFormLoader &loader)
00151 {
00152 <font class="comment">// Load the parent</font>
00153 <a class="code" href="classNLGEORGES_1_1CForm.html#a3">CForm</a> *theParent = (<a class="code" href="classNLGEORGES_1_1CForm.html#a3">CForm</a>*)loader.loadForm (parent);
00154 <font class="keywordflow">if</font> (theParent != NULL)
00155 {
00156 <font class="comment">// Set the parent</font>
00157 <font class="keywordflow">if</font> (!<a class="code" href="classNLGEORGES_1_1CForm.html#a7">insertParent</a> (<a class="code" href="classNLGEORGES_1_1CForm.html#a11">getParentCount</a> (), parent, theParent))
00158 {
00159 <font class="comment">// Make an error message</font>
00160 std::string parentName = parent;
00161
00162 <font class="comment">// Delete the value</font>
00163 xmlFree ((<font class="keywordtype">void</font>*)parent);
00164
00165 <font class="comment">// Throw exception</font>
00166 <a class="code" href="classNLGEORGES_1_1CForm.html#a14">warning</a> (<font class="keyword">true</font>, <font class="stringliteral">"readParent"</font>, <font class="stringliteral">"Can't set the parent FORM named (%s). Check if it is the same form or if it use a differnt formDfn."</font>, parentName.c_str ());
00167 }
00168 }
00169 <font class="keywordflow">else</font>
00170 {
00171 <font class="comment">// Make an error message</font>
00172 std::string parentName = parent;
00173
00174 <font class="comment">// Delete the value</font>
00175 xmlFree ((<font class="keywordtype">void</font>*)parent);
00176
00177 <font class="comment">// Throw exception</font>
00178 <a class="code" href="classNLGEORGES_1_1CForm.html#a14">warning</a> (<font class="keyword">true</font>, <font class="stringliteral">"readParent"</font>, <font class="stringliteral">"Can't load the parent FORM named (%s)."</font>, parentName.c_str ());
00179 }
00180 }
00181
00182 <font class="comment">// ***************************************************************************</font>
00183
<a name="l00184"></a><a class="code" href="classNLGEORGES_1_1CForm.html#c0">00184</a> <font class="keywordtype">void</font> CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)
00185 {
00186 <font class="comment">// Save the filename</font>
00187 <a class="code" href="classNLGEORGES_1_1CForm.html#o1">_Filename</a> = CFile::getFilename (filename);
00188
00189 <font class="comment">// Reset form</font>
00190 <a class="code" href="classNLGEORGES_1_1CForm.html#a5">clean</a> ();
00191
00192 <font class="comment">// Check node name</font>
00193 <font class="keywordflow">if</font> ( ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node->name == NULL) || (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node->name, <font class="stringliteral">"FORM"</font>) != 0) )
00194 {
00195 <font class="comment">// Make an error message</font>
00196 <a class="code" href="classNLGEORGES_1_1CForm.html#a14">warning</a> (<font class="keyword">true</font>, <font class="stringliteral">"read"</font>, <font class="stringliteral">"XML Syntax error in block line %d, node (%s) should be FORM."</font>,
00197 (<font class="keywordtype">int</font>)node->content, node->name);
00198 }
00199
00200 <font class="comment">// Get first struct node</font>
00201 xmlNodePtr child = CIXml::getFirstChildNode (node, <font class="stringliteral">"STRUCT"</font>);
00202 <font class="keywordflow">if</font> (child == NULL)
00203 {
00204 <font class="comment">// Throw exception</font>
00205 <a class="code" href="classNLGEORGES_1_1CForm.html#a14">warning</a> (<font class="keyword">true</font>, <font class="stringliteral">"read"</font>, <font class="stringliteral">"Syntax error in block line %d, node (%s) should have a STRUCT child node."</font>,
00206 (<font class="keywordtype">int</font>)node->content, node->name);
00207 }
00208
00209 <font class="comment">// Read the struct</font>
00210 <a class="code" href="classNLGEORGES_1_1CForm.html#m1">Elements</a>.read (child, loader, dfn, <font class="keyword">this</font>);
00211
00212 <font class="comment">// Get next struct node</font>
00213 child = CIXml::getNextChildNode (node, <font class="stringliteral">"STRUCT"</font>);
00214 <a class="code" href="types__nl_8h.html#a14">uint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a> = 0;
00215 <font class="keywordflow">while</font> ( (child != NULL) && (<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a> < <a class="code" href="classNLGEORGES_1_1CForm.html#s1s0">HeldElementCount</a>))
00216 {
00217 <a class="code" href="classNLGEORGES_1_1CForm.html#m2">HeldElements</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>]->read (child, loader, dfn, <font class="keyword">this</font>);
00218 <a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>++;
00219 }
00220 <font class="keywordflow">while</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a> < <a class="code" href="classNLGEORGES_1_1CForm.html#s1s0">HeldElementCount</a>)
00221 {
00222 <font class="comment">// Build the Form</font>
00223 <a class="code" href="classNLGEORGES_1_1CForm.html#m2">HeldElements</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>]->build (dfn);
00224 <a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>++;
00225 }
00226
00227 <font class="comment">// Get the old parent parameter</font>
00228 <font class="keyword">const</font> <font class="keywordtype">char</font> *parent = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlGetProp (node, (xmlChar*)<font class="stringliteral">"Parent"</font>);
00229 <font class="keywordflow">if</font> (parent)
00230 {
00231 <font class="comment">// Add a parent, xmlFree is done by readParent</font>
00232 <a class="code" href="classNLGEORGES_1_1CForm.html#c1">readParent</a> (parent, loader);
00233 }
00234
00235 <font class="comment">// Read the new parent nodes</font>
00236 <a class="code" href="types__nl_8h.html#a14">uint</a> parentCount = CIXml::countChildren (node, <font class="stringliteral">"PARENT"</font>);
00237
00238 <font class="comment">// Reserve some parents</font>
00239 <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.reserve (<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.size () + parentCount);
00240
00241 <font class="comment">// Enum children node</font>
00242 child = CIXml::getFirstChildNode (node, <font class="stringliteral">"PARENT"</font>);
00243 <font class="keywordflow">while</font> (child)
00244 {
00245 parent = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlGetProp (child, (xmlChar*)<font class="stringliteral">"Filename"</font>);
00246
00247 <font class="comment">// Add a parent, xmlFree is done by readParent</font>
00248 <a class="code" href="classNLGEORGES_1_1CForm.html#c1">readParent</a> (parent, loader);
00249
00250 <font class="comment">// Next node <PARENT></font>
00251 child = CIXml::getNextChildNode (child, <font class="stringliteral">"PARENT"</font>);
00252 }
00253
00254 <font class="comment">// Read the header</font>
00255 <a class="code" href="classNLGEORGES_1_1CForm.html#m0">Header</a>.read (node);
00256 }
00257
00258 <font class="comment">// ***************************************************************************</font>
00259
<a name="l00260"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a2">00260</a> <font class="keyword">const</font> std::string &CForm::getComment ()<font class="keyword"> const</font>
00261 <font class="keyword"></font>{
00262 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#m0">Header</a>.Comments;
00263 }
00264
00265 <font class="comment">// ***************************************************************************</font>
00266
<a name="l00267"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a7">00267</a> <font class="keywordtype">bool</font> CForm::insertParent (<a class="code" href="types__nl_8h.html#a14">uint</a> before, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, CForm *parent)
00268 {
00269 <font class="comment">// Set or reset ?</font>
00270 <a class="code" href="debug_8h.html#a6">nlassert</a> (parent)
00271
00272 <font class="comment">// Must have the same DFN</font>
00273 <font class="keywordflow">if</font> (parent->Elements.FormDfn == <a class="code" href="classNLGEORGES_1_1CForm.html#m1">Elements</a>.FormDfn)
00274 {
00275 <font class="comment">// Set members</font>
00276 std::vector<CParent>::iterator ite = <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.insert (<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.begin() + before);
00277 ite->Parent = parent;
00278 ite->ParentFilename = filename;
00279
00280 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00281 }
00282 <font class="keywordflow">else</font>
00283 {
00284 <font class="comment">// Output an error</font>
00285 <a class="code" href="classNLGEORGES_1_1CForm.html#a14">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"insertParent"</font>, <font class="stringliteral">"Can't insert parent form (%s) that has not the same DFN."</font>, filename);
00286 }
00287
00288 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00289 }
00290
00291 <font class="comment">// ***************************************************************************</font>
00292
<a name="l00293"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a8">00293</a> <font class="keywordtype">void</font> CForm::removeParent (<a class="code" href="types__nl_8h.html#a14">uint</a> parent)
00294 {
00295 <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.erase (<a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.begin() + parent);
00296 }
00297
00298 <font class="comment">// ***************************************************************************</font>
00299
<a name="l00300"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a9">00300</a> CForm *CForm::getParent (<a class="code" href="types__nl_8h.html#a14">uint</a> parent)<font class="keyword"> const</font>
00301 <font class="keyword"></font>{
00302 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>[parent].Parent;
00303 }
00304
00305 <font class="comment">// ***************************************************************************</font>
00306
<a name="l00307"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a10">00307</a> <font class="keyword">const</font> std::string &CForm::getParentFilename (<a class="code" href="types__nl_8h.html#a14">uint</a> parent)<font class="keyword"> const</font>
00308 <font class="keyword"></font>{
00309 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>[parent].ParentFilename;
00310 }
00311
00312 <font class="comment">// ***************************************************************************</font>
00313
<a name="l00314"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a11">00314</a> <a class="code" href="types__nl_8h.html#a14">uint</a> CForm::getParentCount ()<font class="keyword"> const</font>
00315 <font class="keyword"></font>{
00316 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.size ();
00317 }
00318
00319 <font class="comment">// ***************************************************************************</font>
00320
<a name="l00321"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a5">00321</a> <font class="keywordtype">void</font> CForm::clean ()
00322 {
00323 <a class="code" href="classNLGEORGES_1_1CForm.html#a12">clearParents</a> ();
00324 }
00325
00326 <font class="comment">// ***************************************************************************</font>
00327
<a name="l00328"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a12">00328</a> <font class="keywordtype">void</font> CForm::clearParents ()
00329 {
00330 <a class="code" href="classNLGEORGES_1_1CForm.html#o0">ParentList</a>.clear ();
00331 }
00332
00333 <font class="comment">// ***************************************************************************</font>
00334
<a name="l00335"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a13">00335</a> <font class="keyword">const</font> std::string &CForm::getFilename ()<font class="keyword"> const</font>
00336 <font class="keyword"></font>{
00337 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CForm.html#o1">_Filename</a>;
00338 }
00339
00340 <font class="comment">// ***************************************************************************</font>
00341
<a name="l00342"></a><a class="code" href="classNLGEORGES_1_1CForm.html#a14">00342</a> <font class="keywordtype">void</font> CForm::warning (<font class="keywordtype">bool</font> exception, <font class="keyword">const</font> <font class="keywordtype">char</font> *function, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a>, ... )<font class="keyword"> const</font>
00343 <font class="keyword"></font>{
00344 <font class="comment">// Make a buffer string</font>
00345 va_list args;
00346 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a> );
00347 <font class="keywordtype">char</font> <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>[1024];
00348 <a class="code" href="types__nl_8h.html#a13">sint</a> ret = vsnprintf( <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>, 1024, <a class="code" href="driver__opengl__extension__def_8h.html#a275">format</a>, args );
00349 va_end( args );
00350
00351 <font class="comment">// Set the warning</font>
00352 <a class="code" href="namespaceNLGEORGES.html#a0">NLGEORGES::warning</a> (exception, <font class="stringliteral">"(CForm::%s) in form (%s) : %s"</font>, function, <a class="code" href="classNLGEORGES_1_1CForm.html#o1">_Filename</a>.c_str (), <a class="code" href="driver__opengl__extension__def_8h.html#a259">buffer</a>);
00353 }
00354
00355 <font class="comment">// ***************************************************************************</font>
00356
00357 } <font class="comment">// NLGEORGES</font>
00358
</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>
|