diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/i__xml_8cpp-source.html | 982 |
1 files changed, 982 insertions, 0 deletions
diff --git a/docs/doxygen/nel/i__xml_8cpp-source.html b/docs/doxygen/nel/i__xml_8cpp-source.html new file mode 100644 index 00000000..641ea88e --- /dev/null +++ b/docs/doxygen/nel/i__xml_8cpp-source.html @@ -0,0 +1,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="http://www.nevrax.org/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="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><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="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/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:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </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 <libxml/xmlerror.h></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->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)->_ErrorString += str; +00116 } +00117 +00118 <font class="comment">// ***************************************************************************</font> +00119 +00120 <font class="keywordtype">bool</font> CIXml::init (IStream &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>=<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 &<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->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->content, _AttribName.c_str(), _CurrentElement->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->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->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 < 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 < 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->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->content, _CurrentElement->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 &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 &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 &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 &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 &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 &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 &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 &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> &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> &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> &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> &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> &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->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->content, _CurrentElement->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 &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> &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<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->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->name); +00585 +00586 <font class="comment">// Node element with the good name ?</font> +00587 <font class="keywordflow">if</font> ( (_CurrentNode->type != XML_ELEMENT_NODE) || ( (<font class="keyword">const</font> <font class="keywordtype">char</font>*)_CurrentNode->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->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->name); +00610 +00611 <font class="comment">// Node with the good name</font> +00612 <font class="keywordflow">if</font> ( (_CurrentNode->type == XML_ELEMENT_NODE) && ( (<font class="keyword">const</font> <font class="keywordtype">char</font>*)_CurrentNode->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->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->content, nodeName, _CurrentElement->name); +00633 <font class="keywordflow">throw</font> EXmlParsingError (tmp); +00634 } +00635 +00636 <font class="comment">// Get first child</font> +00637 _CurrentNode = _CurrentNode->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->parent; +00710 _CurrentNode = _CurrentNode->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->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->name, childName) == 0) +00786 <font class="keywordflow">return</font> child; +00787 child = child->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->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->name, childName) == 0) +00800 <font class="keywordflow">return</font> last; +00801 last = last->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->children; +00811 <font class="keywordflow">while</font> (child) +00812 { +00813 <font class="keywordflow">if</font> (child->type == <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>) +00814 <font class="keywordflow">return</font> child; +00815 child = child->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->next; +00825 <font class="keywordflow">while</font> (last) +00826 { +00827 <font class="keywordflow">if</font> (last->type == <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>) +00828 <font class="keywordflow">return</font> last; +00829 last = last->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->myDoc) +00868 <font class="keywordflow">return</font> xmlDocGetRootElement (_Parser->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 &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 &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> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |