aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/config__file_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/config__file_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/config__file_8cpp-source.html731
1 files changed, 731 insertions, 0 deletions
diff --git a/docs/doxygen/nel/config__file_8cpp-source.html b/docs/doxygen/nel/config__file_8cpp-source.html
new file mode 100644
index 00000000..a3e662ad
--- /dev/null
+++ b/docs/doxygen/nel/config__file_8cpp-source.html
@@ -0,0 +1,731 @@
+<!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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="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>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>config_file.cpp</h1><a href="config__file_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="stdmisc_8h.html">../stdmisc.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include &lt;time.h&gt;</font>
+00029 <font class="preprocessor">#include &lt;sys/types.h&gt;</font>
+00030 <font class="preprocessor">#include &lt;sys/stat.h&gt;</font>
+00031
+00032 <font class="preprocessor">#include "<a class="code" href="file_8h.html">nel/misc/file.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="config__file_8h.html">nel/misc/config_file.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
+00036
+00037 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00038 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00039
+00040 <font class="keyword">extern</font> <font class="keywordtype">void</font> <a class="code" href="config__file_8cpp.html#a4">cfrestart</a> (FILE *); <font class="comment">// used to reinit the file</font>
+00041 <font class="keyword">extern</font> <font class="keywordtype">int</font> <a class="code" href="config__file_8cpp.html#a5">cfparse</a> (<font class="keywordtype">void</font> *); <font class="comment">// used to parse the file</font>
+00042 <font class="comment">//extern FILE *cfin;</font>
+<a name="l00043"></a><a class="code" href="config__file_8cpp.html#a0">00043</a> <font class="keyword">extern</font> <font class="keywordtype">int</font> <a class="code" href="config__file_8cpp.html#a0">cf_CurrentLine</a>;
+<a name="l00044"></a><a class="code" href="config__file_8cpp.html#a1">00044</a> <font class="keyword">extern</font> <font class="keywordtype">bool</font> <a class="code" href="config__file_8cpp.html#a1">cf_OverwriteExistingVariable</a>;
+<a name="l00045"></a><a class="code" href="config__file_8cpp.html#a2">00045</a> <font class="keyword">extern</font> CIFile <a class="code" href="config__file_8cpp.html#a2">cf_ifile</a>;
+00046
+00047 <font class="comment">// put true if you want that the config file class check type when you call asFunctions</font>
+00048 <font class="comment">// (for example, check when you call asInt() that the variable is an int).</font>
+00049 <font class="comment">// when it's false, the function will convert to the wanted type (if he can)</font>
+<a name="l00050"></a><a class="code" href="config__file_8cpp.html#a3">00050</a> <font class="keyword">const</font> <font class="keywordtype">bool</font> <a class="code" href="config__file_8cpp.html#a3">CheckType</a> = <font class="keyword">false</font>;
+00051
+00052 <font class="keyword">namespace </font>NLMISC
+00053 {
+00054
+<a name="l00055"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_8">00055</a> <font class="keywordtype">char</font> *CConfigFile::CVar::TypeName[] = { <font class="stringliteral">"Integer"</font>, <font class="stringliteral">"String"</font>, <font class="stringliteral">"Float"</font> };
+00056
+<a name="l00057"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z280_0">00057</a> <font class="keywordtype">int</font> CConfigFile::CVar::asInt (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+00058 <font class="keyword"></font>{
+00059 <font class="keywordflow">if</font> (<a class="code" href="config__file_8cpp.html#a3">CheckType</a> &amp;&amp; <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>);
+00060 <font class="keywordflow">switch</font> (Type)
+00061 {
+00062 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>:
+00063 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00064 <font class="keywordflow">return</font> atoi(<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].c_str());
+00065 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>:
+00066 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00067 <font class="keywordflow">return</font> (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00068 <font class="keywordflow">default</font>:
+00069 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00070 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00071 }
+00072 }
+00073
+<a name="l00074"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z280_1">00074</a> <font class="keywordtype">double</font> CConfigFile::CVar::asDouble (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+00075 <font class="keyword"></font>{
+00076 <font class="keywordflow">if</font> (<a class="code" href="config__file_8cpp.html#a3">CheckType</a> &amp;&amp; <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>);
+00077 <font class="keywordflow">switch</font> (Type)
+00078 {
+00079 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>:
+00080 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00081 <font class="keywordflow">return</font> (double)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00082 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>:
+00083 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00084 <font class="keywordflow">return</font> atof(<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].c_str());
+00085 <font class="keywordflow">default</font>:
+00086 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00087 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00088 }
+00089 }
+00090
+<a name="l00091"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z280_2">00091</a> <font class="keywordtype">float</font> CConfigFile::CVar::asFloat (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+00092 <font class="keyword"></font>{
+00093 <font class="keywordflow">return</font> (float) <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z280_1">asDouble</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00094 }
+00095
+<a name="l00096"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z280_3">00096</a> <font class="keyword">const</font> std::string &amp;CConfigFile::CVar::asString (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+00097 <font class="keyword"></font>{
+00098 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>);
+00099 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt;= (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00100 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00101 }
+00102
+00103
+00104
+<a name="l00105"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_0">00105</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsInt (<font class="keywordtype">int</font> val, <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00106 {
+00107 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>);
+00108 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt; (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00109 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size ()) <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.push_back(val);
+00110 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = val;
+00111 }
+00112
+<a name="l00113"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_1">00113</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsDouble (<font class="keywordtype">double</font> val, <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00114 {
+00115 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>);
+00116 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt; (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00117 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size ()) <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.push_back(val);
+00118 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = val;
+00119 }
+00120
+<a name="l00121"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_2">00121</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsFloat (<font class="keywordtype">float</font> val, <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00122 {
+00123 <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_1">setAsDouble</a> (val, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00124 }
+00125
+<a name="l00126"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_3">00126</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsString (std::string val, <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00127 {
+00128 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>);
+00129 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &gt; (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size () || <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 0) <font class="keywordflow">throw</font> EBadSize (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size (), <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00130 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == (int)<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size ()) <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.push_back(val);
+00131 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = val;
+00132 }
+00133
+<a name="l00134"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_4">00134</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsInt (std::vector&lt;int&gt; vals)
+00135 {
+00136 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>);
+00137 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a> = vals;
+00138 }
+00139
+<a name="l00140"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_5">00140</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsDouble (std::vector&lt;double&gt; vals)
+00141 {
+00142 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>);
+00143 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a> = vals;
+00144 }
+00145
+<a name="l00146"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_6">00146</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsFloat (std::vector&lt;float&gt; vals)
+00147 {
+00148 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>);
+00149 <font class="keywordflow">else</font>
+00150 {
+00151 <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.clear ();
+00152 <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.resize (vals.size ());
+00153 <font class="keywordflow">for</font> (uint i = 0; i &lt; vals.size (); i++)
+00154 <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>[i] = (double)vals[i];
+00155 }
+00156 }
+00157
+<a name="l00158"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z281_7">00158</a> <font class="keywordtype">void</font> CConfigFile::CVar::setAsString (std::vector&lt;std::string&gt; vals)
+00159 {
+00160 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> != <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>) <font class="keywordflow">throw</font> EBadType (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_1">Name</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a>, <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>);
+00161 <font class="keywordflow">else</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a> = vals;
+00162 }
+00163
+<a name="l00164"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#a1">00164</a> <font class="keywordtype">bool</font> CConfigFile::CVar::operator== (<font class="keyword">const</font> CVar&amp; var)<font class="keyword"> const</font>
+00165 <font class="keyword"></font>{
+00166 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> == var.Type)
+00167 {
+00168 <font class="keywordflow">switch</font> (Type)
+00169 {
+00170 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a> == var.IntValues; <font class="keywordflow">break</font>;
+00171 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a> == var.RealValues; <font class="keywordflow">break</font>;
+00172 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a> == var.StrValues; <font class="keywordflow">break</font>;
+00173 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00174 }
+00175 }
+00176 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00177 }
+00178
+<a name="l00179"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#a2">00179</a> <font class="keywordtype">bool</font> CConfigFile::CVar::operator!= (<font class="keyword">const</font> CVar&amp; var)<font class="keyword"> const</font>
+00180 <font class="keyword"></font>{
+00181 <font class="keywordflow">return</font> !(*<font class="keyword">this</font>==var);
+00182 }
+00183
+<a name="l00184"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#a3">00184</a> <font class="keywordtype">void</font> CConfigFile::CVar::add (<font class="keyword">const</font> CVar &amp;var)
+00185 {
+00186 <font class="keywordflow">if</font> (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_2">Type</a> == var.Type)
+00187 {
+00188 <font class="keywordflow">switch</font> (Type)
+00189 {
+00190 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>: <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.insert (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.end(), var.IntValues.begin(), var.IntValues.end()); <font class="keywordflow">break</font>;
+00191 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>: <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.insert (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.end(), var.RealValues.begin(), var.RealValues.end()); <font class="keywordflow">break</font>;
+00192 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>: <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.insert (<a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.end(), var.StrValues.begin(), var.StrValues.end()); <font class="keywordflow">break</font>;
+00193 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00194 }
+00195 }
+00196 }
+00197
+<a name="l00198"></a><a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#a4">00198</a> <font class="keywordtype">int</font> <a class="code" href="cf__lexical_8cpp.html#a94">CConfigFile::CVar::size</a> ()<font class="keyword"> const</font>
+00199 <font class="keyword"></font>{
+00200 <font class="keywordflow">switch</font> (Type)
+00201 {
+00202 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s1">T_INT</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_4">IntValues</a>.size ();
+00203 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s3">T_REAL</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_5">RealValues</a>.size ();
+00204 <font class="keywordflow">case</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_0s2">T_STRING</a>: <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CConfigFile_1_1CVar.html#z282_6">StrValues</a>.size ();
+00205 <font class="keywordflow">default</font>: <font class="keywordflow">return</font> 0;
+00206 }
+00207 }
+00208
+<a name="l00209"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a1">00209</a> CConfigFile::~CConfigFile ()
+00210 {
+00211 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a> == NULL || (*_ConfigFiles).empty ()) <font class="keywordflow">return</font>;
+00212
+00213 vector&lt;CConfigFile *&gt;::iterator it = find ((*_ConfigFiles).begin (), (*_ConfigFiles).end (), <font class="keyword">this</font>);
+00214 <font class="keywordflow">if</font> (it != (*_ConfigFiles).end ())
+00215 {
+00216 (*_ConfigFiles).erase (it);
+00217 }
+00218
+00219 <font class="keywordflow">if</font> ((*_ConfigFiles).empty())
+00220 {
+00221 <font class="keyword">delete</font> <a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a>;
+00222 <a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a> = NULL;
+00223 }
+00224 }
+00225
+<a name="l00226"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a5">00226</a> <font class="keywordtype">void</font> CConfigFile::load (<font class="keyword">const</font> string &amp;fileName)
+00227 {
+00228 <font class="keywordflow">if</font>(fileName.empty())
+00229 {
+00230 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Can't load a empty file name configfile"</font>);
+00231 <font class="keywordflow">return</font>;
+00232 }
+00233
+00234 <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a> = fileName;
+00235
+00236 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a> == NULL)
+00237 {
+00238 <a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a> = <font class="keyword">new</font> std::vector&lt;CConfigFile *&gt;;
+00239 }
+00240 (*CConfigFile::_ConfigFiles).push_back (<font class="keyword">this</font>);
+00241 <a class="code" href="classNLMISC_1_1CConfigFile.html#a8">reparse</a> ();
+00242
+00243 <font class="comment">// If we find a linked config file, load it but don't overload already existant variable</font>
+00244 CVar *var = <a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"RootConfigFilename"</font>);
+00245 <font class="keywordflow">if</font> (var)
+00246 {
+00247 string RootConfigFilename = var-&gt;asString();
+00248 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"RootConfigFilename variable found in the '%s' config file, parse it (%s)"</font>, fileName.c_str(), RootConfigFilename.c_str());
+00249
+00250 string path = CFile::getPath(fileName);
+00251
+00252 <font class="keywordflow">if</font> (!path.empty())
+00253 path += <font class="stringliteral">"/"</font>;
+00254
+00255 path += RootConfigFilename;
+00256
+00257 <a class="code" href="classNLMISC_1_1CConfigFile.html#a8">reparse</a> (path.c_str());
+00258 }
+00259
+00260 <font class="comment">// print ();</font>
+00261 }
+00262
+00263
+<a name="l00264"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a7">00264</a> <font class="keywordtype">bool</font> CConfigFile::loaded()
+00265 {
+00266 <font class="keywordflow">return</font> !CConfigFile::_FileName.empty();
+00267 }
+00268
+00269
+<a name="l00270"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a8">00270</a> <font class="keywordtype">void</font> CConfigFile::reparse (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keywordtype">bool</font> callingCallback)
+00271 {
+00272 <font class="keywordflow">if</font> (filename == NULL)
+00273 {
+00274 <a class="code" href="classNLMISC_1_1CConfigFile.html#o3">_LastModified</a> = <a class="code" href="classNLMISC_1_1CConfigFile.html#c0">getLastModified</a> ();
+00275
+00276 <a class="code" href="debug_8h.html#a6">nlassert</a> (!<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.empty());
+00277
+00278 <font class="keywordflow">if</font> (<a class="code" href="config__file_8cpp.html#a2">cf_ifile</a>.open (<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>))
+00279 {
+00280 <font class="comment">// if we clear all the array, we'll lost the callback on variable and all information</font>
+00281 <font class="comment">// _Vars.clear();</font>
+00282 <a class="code" href="config__file_8cpp.html#a4">cfrestart</a> (NULL);
+00283 <a class="code" href="config__file_8cpp.html#a1">cf_OverwriteExistingVariable</a> = <font class="keyword">true</font>;
+00284 <font class="keywordtype">bool</font> parsingOK = (<a class="code" href="config__file_8cpp.html#a5">cfparse</a> (&amp;(<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>)) == 0);
+00285 <a class="code" href="config__file_8cpp.html#a2">cf_ifile</a>.close();
+00286 <font class="keywordflow">if</font> (!parsingOK)
+00287 {
+00288 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Parsing error in file %s line %d"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str(), <a class="code" href="config__file_8cpp.html#a0">cf_CurrentLine</a>);
+00289 <font class="keywordflow">throw</font> EParseError (<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>, <a class="code" href="config__file_8cpp.html#a0">cf_CurrentLine</a>);
+00290 }
+00291 }
+00292 <font class="keywordflow">else</font>
+00293 {
+00294 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"ConfigFile '%s' not found in the path '%s'"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str(), CPath::getCurrentPath().c_str());
+00295 <font class="keywordflow">throw</font> EFileNotFound (<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>);
+00296 }
+00297
+00298 <font class="comment">/*</font>
+00299 <font class="comment"> cfin = fopen (_FileName.c_str (), "r");</font>
+00300 <font class="comment"> if (cfin != NULL)</font>
+00301 <font class="comment"> {</font>
+00302 <font class="comment"> // if we clear all the array, we'll lost the callback on variable and all information</font>
+00303 <font class="comment"> // _Vars.clear();</font>
+00304 <font class="comment"> cfrestart (cfin);</font>
+00305 <font class="comment"> cf_OverwriteExistingVariable = true;</font>
+00306 <font class="comment"> bool parsingOK = (cfparse (&amp;(_Vars)) == 0);</font>
+00307 <font class="comment"> fclose (cfin);</font>
+00308 <font class="comment"> if (!parsingOK) throw EParseError (_FileName, cf_CurrentLine);</font>
+00309 <font class="comment"> }</font>
+00310 <font class="comment"> else</font>
+00311 <font class="comment"> {</font>
+00312 <font class="comment"> nlwarning ("ConfigFile '%s' not found in the path '%s'", _FileName.c_str(), CPath::getCurrentPath().c_str());</font>
+00313 <font class="comment"> throw EFileNotFound (_FileName);</font>
+00314 <font class="comment"> }</font>
+00315 <font class="comment"> */</font>
+00316 }
+00317 <font class="keywordflow">else</font>
+00318 {
+00319 <a class="code" href="debug_8h.html#a6">nlassert</a> (strlen(filename)&gt;0);
+00320
+00321 <font class="comment">// load external config filename, don't overwrite existant variable</font>
+00322 <font class="keywordflow">if</font> (<a class="code" href="config__file_8cpp.html#a2">cf_ifile</a>.open (filename))
+00323 {
+00324 <a class="code" href="config__file_8cpp.html#a4">cfrestart</a> (NULL);
+00325 <a class="code" href="config__file_8cpp.html#a1">cf_OverwriteExistingVariable</a> = <font class="keyword">false</font>;
+00326 <font class="keywordtype">bool</font> parsingOK = (<a class="code" href="config__file_8cpp.html#a5">cfparse</a> (&amp;(<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>)) == 0);
+00327 <a class="code" href="config__file_8cpp.html#a2">cf_ifile</a>.close ();
+00328 <font class="keywordflow">if</font> (!parsingOK)
+00329 {
+00330 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Parsing error in file %s line %d"</font>, filename, <a class="code" href="config__file_8cpp.html#a0">cf_CurrentLine</a>);
+00331 <font class="keywordflow">throw</font> EParseError (filename, <a class="code" href="config__file_8cpp.html#a0">cf_CurrentLine</a>);
+00332 }
+00333 }
+00334 <font class="keywordflow">else</font>
+00335 {
+00336 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"RootConfigFilename '%s' not found"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str());
+00337 }
+00338
+00339 <font class="comment">/* cfin = fopen (filename, "r");</font>
+00340 <font class="comment"> if (cfin != NULL)</font>
+00341 <font class="comment"> {</font>
+00342 <font class="comment"> cfrestart (cfin);</font>
+00343 <font class="comment"> cf_OverwriteExistingVariable = false;</font>
+00344 <font class="comment"> bool parsingOK = (cfparse (&amp;(_Vars)) == 0);</font>
+00345 <font class="comment"> fclose (cfin);</font>
+00346 <font class="comment"> if (!parsingOK) throw EParseError (_FileName, cf_CurrentLine);</font>
+00347 <font class="comment"> }</font>
+00348 <font class="comment"> else</font>
+00349 <font class="comment"> {</font>
+00350 <font class="comment"> nlwarning ("RootConfigFilename '%s' not found", _FileName.c_str());</font>
+00351 <font class="comment"> }</font>
+00352 <font class="comment">*/</font> }
+00353
+00354 <font class="keywordflow">if</font> (callingCallback)
+00355 {
+00356 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Callback ptr : %p"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o0">_Callback</a>);
+00357 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o0">_Callback</a> != NULL)
+00358 <a class="code" href="classNLMISC_1_1CConfigFile.html#o0">_Callback</a>();
+00359 }
+00360 }
+00361
+00362
+00363
+<a name="l00364"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a2">00364</a> CConfigFile::CVar &amp;CConfigFile::getVar (<font class="keyword">const</font> std::string &amp;varName)
+00365 {
+00366 uint i;
+00367 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size(); i++)
+00368 {
+00369 <font class="comment">// the type could be T_UNKNOWN if we add a callback on this name but this var is not in the config file</font>
+00370 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name == varName &amp;&amp; (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type != CVar::T_UNKNOWN || <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Comp))
+00371 {
+00372 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i];
+00373 <font class="keywordflow">break</font>;
+00374 }
+00375 }
+00376
+00377 <font class="comment">// if not found, add it in the array if necessary</font>
+00378 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.size(); i++)
+00379 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>[i] == varName)
+00380 <font class="keywordflow">break</font>;
+00381 <font class="keywordflow">if</font> (i == <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.size())
+00382 <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.push_back(varName);
+00383
+00384 <font class="keywordflow">throw</font> EUnknownVar (<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>, varName);
+00385 }
+00386
+00387
+<a name="l00388"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a3">00388</a> CConfigFile::CVar *CConfigFile::getVarPtr (<font class="keyword">const</font> std::string &amp;varName)
+00389 {
+00390 uint i;
+00391 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size(); i++)
+00392 {
+00393 <font class="comment">// the type could be T_UNKNOWN if we add a callback on this name but this var is not in the config file</font>
+00394 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name == varName &amp;&amp; (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type != CVar::T_UNKNOWN || <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Comp))
+00395 {
+00396 <font class="keywordflow">return</font> &amp;(<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i]);
+00397 }
+00398 }
+00399
+00400 <font class="comment">// if not found, add it in the array if necessary</font>
+00401 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.size(); i++)
+00402 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>[i] == varName)
+00403 <font class="keywordflow">break</font>;
+00404 <font class="keywordflow">if</font> (i == <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.size())
+00405 <a class="code" href="classNLMISC_1_1CConfigFile.html#m0">UnknownVariables</a>.push_back(varName);
+00406
+00407 <font class="keywordflow">return</font> NULL;
+00408 }
+00409
+<a name="l00410"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a4">00410</a> <font class="keywordtype">bool</font> CConfigFile::exists (<font class="keyword">const</font> std::string &amp;varName)
+00411 {
+00412 <font class="keywordflow">for</font> (uint i = 0; i &lt; <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size(); i++)
+00413 {
+00414 <font class="comment">// the type could be T_UNKNOWN if we add a callback on this name but this var is not in the config file</font>
+00415 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name == varName &amp;&amp; (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type != CVar::T_UNKNOWN || <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Comp))
+00416 {
+00417 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00418 }
+00419 }
+00420 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00421 }
+00422
+<a name="l00423"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a6">00423</a> <font class="keywordtype">void</font> CConfigFile::save ()<font class="keyword"> const</font>
+00424 <font class="keyword"></font>{
+00425 FILE *fp = fopen (<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str (), <font class="stringliteral">"w"</font>);
+00426 <font class="keywordflow">if</font> (fp == NULL)
+00427 {
+00428 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Couldn't create %s file"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str ());
+00429 <font class="keywordflow">return</font>;
+00430 }
+00431
+00432 <font class="keywordflow">for</font>(<font class="keywordtype">int</font> i = 0; i &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size(); i++)
+00433 {
+00434 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Comp)
+00435 {
+00436 fprintf(fp, <font class="stringliteral">"%-20s = { "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00437 <font class="keywordflow">switch</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type)
+00438 {
+00439 <font class="keywordflow">case</font> CConfigFile::CVar::T_INT:
+00440 {
+00441 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> it=0; it &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues.size(); it++)
+00442 {
+00443 fprintf(fp, <font class="stringliteral">"%d%s"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues[it], it&lt;(<font class="keywordtype">int</font>)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues.size()-1?<font class="stringliteral">", "</font>:<font class="stringliteral">" "</font>);
+00444 }
+00445 <font class="keywordflow">break</font>;
+00446 }
+00447 <font class="keywordflow">case</font> CConfigFile::CVar::T_STRING:
+00448 {
+00449 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> st=0; st &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues.size(); st++)
+00450 {
+00451 fprintf(fp, <font class="stringliteral">"\"%s\"%s"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues[st].c_str(), st&lt;(<font class="keywordtype">int</font>)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues.size()-1?<font class="stringliteral">", "</font>:<font class="stringliteral">" "</font>);
+00452 }
+00453 <font class="keywordflow">break</font>;
+00454 }
+00455 <font class="keywordflow">case</font> CConfigFile::CVar::T_REAL:
+00456 {
+00457 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> rt=0; rt &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues.size(); rt++)
+00458 {
+00459 fprintf(fp, <font class="stringliteral">"%.10f%s"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues[rt], rt&lt;(<font class="keywordtype">int</font>)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues.size()-1?<font class="stringliteral">", "</font>:<font class="stringliteral">" "</font>);
+00460 }
+00461 <font class="keywordflow">break</font>;
+00462 }
+00463 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00464 }
+00465 fprintf(fp, <font class="stringliteral">"};\n"</font>);
+00466 }
+00467 <font class="keywordflow">else</font>
+00468 {
+00469 <font class="keywordflow">switch</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type)
+00470 {
+00471 <font class="keywordflow">case</font> CConfigFile::CVar::T_INT:
+00472 fprintf(fp, <font class="stringliteral">"%-20s = %d;\n"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues[0]);
+00473 <font class="keywordflow">break</font>;
+00474 <font class="keywordflow">case</font> CConfigFile::CVar::T_STRING:
+00475 fprintf(fp, <font class="stringliteral">"%-20s = \"%s\";\n"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues[0].c_str());
+00476 <font class="keywordflow">break</font>;
+00477 <font class="keywordflow">case</font> CConfigFile::CVar::T_REAL:
+00478 fprintf(fp, <font class="stringliteral">"%-20s = %.10f;\n"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues[0]);
+00479 <font class="keywordflow">break</font>;
+00480 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00481 }
+00482 }
+00483 }
+00484 fclose (fp);
+00485 }
+00486
+<a name="l00487"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a9">00487</a> <font class="keywordtype">void</font> CConfigFile::print ()<font class="keyword"> const</font>
+00488 <font class="keyword"></font>{
+00489 <a class="code" href="classNLMISC_1_1CConfigFile.html#a9">print</a>(<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>);
+00490 }
+00491
+<a name="l00492"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a10">00492</a> <font class="keywordtype">void</font> CConfigFile::print (CLog *log)<font class="keyword"> const</font>
+00493 <font class="keyword"></font>{
+00494 <a class="code" href="namespaceNLMISC.html#a247">createDebug</a> ();
+00495
+00496 log-&gt;displayRawNL (<font class="stringliteral">"ConfigFile %s have %d variables:"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size());
+00497 log-&gt;displayRawNL (<font class="stringliteral">"------------------------------------------------------"</font>);
+00498 <font class="keywordflow">for</font>(<font class="keywordtype">int</font> i = 0; i &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.size(); i++)
+00499 {
+00500 log-&gt;displayRaw ((<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Callback==NULL)?<font class="stringliteral">" "</font>:<font class="stringliteral">"CB "</font>);
+00501 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Comp)
+00502 {
+00503 <font class="keywordflow">switch</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type)
+00504 {
+00505 <font class="keywordflow">case</font> CConfigFile::CVar::T_INT:
+00506 {
+00507 log-&gt;displayRaw (<font class="stringliteral">"%-20s { "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00508 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> it=0; it &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues.size(); it++)
+00509 {
+00510 log-&gt;displayRaw (<font class="stringliteral">"'%d' "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues[it]);
+00511 }
+00512 log-&gt;displayRawNL (<font class="stringliteral">"}"</font>);
+00513 <font class="keywordflow">break</font>;
+00514 }
+00515 <font class="keywordflow">case</font> CConfigFile::CVar::T_STRING:
+00516 {
+00517 log-&gt;displayRaw (<font class="stringliteral">"%-20s { "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00518 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> st=0; st &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues.size(); st++)
+00519 {
+00520 log-&gt;displayRaw (<font class="stringliteral">"\"%s\" "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues[st].c_str());
+00521 }
+00522 log-&gt;displayRawNL (<font class="stringliteral">"}"</font>);
+00523 <font class="keywordflow">break</font>;
+00524 }
+00525 <font class="keywordflow">case</font> CConfigFile::CVar::T_REAL:
+00526 {
+00527 log-&gt;displayRaw (<font class="stringliteral">"%-20s { "</font> , <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00528 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> rt=0; rt &lt; (int)<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues.size(); rt++)
+00529 {
+00530 log-&gt;displayRaw (<font class="stringliteral">"`%f` "</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues[rt]);
+00531 }
+00532 log-&gt;displayRawNL (<font class="stringliteral">"}"</font>);
+00533 <font class="keywordflow">break</font>;
+00534 }
+00535 <font class="keywordflow">case</font> CConfigFile::CVar::T_UNKNOWN:
+00536 {
+00537 log-&gt;displayRawNL (<font class="stringliteral">"%-20s { }"</font> , <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00538 <font class="keywordflow">break</font>;
+00539 }
+00540 <font class="keywordflow">default</font>:
+00541 {
+00542 log-&gt;displayRawNL (<font class="stringliteral">"%-20s &lt;default case&gt;"</font> , <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00543 <font class="keywordflow">break</font>;
+00544 }
+00545 }
+00546 }
+00547 <font class="keywordflow">else</font>
+00548 {
+00549 <font class="keywordflow">switch</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Type)
+00550 {
+00551 <font class="keywordflow">case</font> CConfigFile::CVar::T_INT:
+00552 log-&gt;displayRawNL (<font class="stringliteral">"%-20s '%d'"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].IntValues[0]);
+00553 <font class="keywordflow">break</font>;
+00554 <font class="keywordflow">case</font> CConfigFile::CVar::T_STRING:
+00555 log-&gt;displayRawNL (<font class="stringliteral">"%-20s \"%s\""</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].StrValues[0].c_str());
+00556 <font class="keywordflow">break</font>;
+00557 <font class="keywordflow">case</font> CConfigFile::CVar::T_REAL:
+00558 log-&gt;displayRawNL (<font class="stringliteral">"%-20s `%f`"</font>, <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str(), <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].RealValues[0]);
+00559 <font class="keywordflow">break</font>;
+00560 <font class="keywordflow">default</font>:
+00561 {
+00562 log-&gt;displayRawNL (<font class="stringliteral">"%-20s &lt;default case&gt;"</font> , <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>[i].Name.c_str());
+00563 <font class="keywordflow">break</font>;
+00564 }
+00565 }
+00566 }
+00567 }
+00568 }
+00569
+<a name="l00570"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a11">00570</a> <font class="keywordtype">void</font> CConfigFile::setCallback (<font class="keywordtype">void</font> (*cb)())
+00571 {
+00572 <a class="code" href="classNLMISC_1_1CConfigFile.html#o0">_Callback</a> = cb;
+00573 }
+00574
+<a name="l00575"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a12">00575</a> <font class="keywordtype">void</font> CConfigFile::setCallback (<font class="keyword">const</font> string &amp;VarName, <font class="keywordtype">void</font> (*cb)(CConfigFile::CVar &amp;var))
+00576 {
+00577 <font class="keywordflow">for</font> (vector&lt;CVar&gt;::iterator it = <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.begin (); it != <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.end (); it++)
+00578 {
+00579 <font class="keywordflow">if</font> (VarName == (*it).Name)
+00580 {
+00581 (*it).Callback = cb;
+00582 <font class="keywordflow">return</font>;
+00583 }
+00584 }
+00585 <font class="comment">// VarName doesn't exist, add it now for the futur</font>
+00586 CVar Var;
+00587 Var.Name = VarName;
+00588 Var.Callback = cb;
+00589 Var.Type = CVar::T_UNKNOWN;
+00590 <a class="code" href="classNLMISC_1_1CConfigFile.html#o1">_Vars</a>.push_back (Var);
+00591 }
+00592
+<a name="l00593"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#a13">00593</a> <font class="keywordtype">void</font> CConfigFile::setLastModifiedNow ()
+00594 {
+00595 <a class="code" href="classNLMISC_1_1CConfigFile.html#o3">_LastModified</a> = <a class="code" href="classNLMISC_1_1CConfigFile.html#c0">getLastModified</a> ();
+00596 }
+00597
+00598
+00599 <font class="comment">// ***************************************************************************</font>
+00600
+00601
+<a name="l00602"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#r1">00602</a> vector&lt;CConfigFile *&gt; *CConfigFile::_ConfigFiles = NULL;
+00603
+<a name="l00604"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#r0">00604</a> uint32 CConfigFile::_Timeout = 1000;
+00605
+<a name="l00606"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#c0">00606</a> uint32 CConfigFile::getLastModified ()
+00607 {
+00608 uint pos;
+00609 string fn;
+00610 <font class="keywordflow">if</font> ((pos=<a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.find(<font class="charliteral">'@'</font>)) != string::npos)
+00611 {
+00612 fn = <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>.substr (0, pos);
+00613 }
+00614 <font class="keywordflow">else</font>
+00615 {
+00616 fn = <a class="code" href="classNLMISC_1_1CConfigFile.html#o2">_FileName</a>;
+00617 }
+00618 <font class="preprocessor">#if defined (NL_OS_WINDOWS)</font>
+00619 <font class="preprocessor"></font> <font class="keyword">struct </font>_stat buf;
+00620 <font class="keywordtype">int</font> result = _stat (fn.c_str (), &amp;buf);
+00621 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font>
+00622 <font class="preprocessor"></font> <font class="keyword">struct </font>stat buf;
+00623 <font class="keywordtype">int</font> result = stat (fn.c_str (), &amp;buf);
+00624 <font class="preprocessor">#endif</font>
+00625 <font class="preprocessor"></font>
+00626 <font class="keywordflow">if</font> (result != 0) <font class="keywordflow">return</font> 0;
+00627 <font class="keywordflow">else</font> <font class="keywordflow">return</font> buf.st_mtime;
+00628 }
+00629
+00630
+<a name="l00631"></a><a class="code" href="classNLMISC_1_1CConfigFile.html#d1">00631</a> <font class="keywordtype">void</font> CConfigFile::checkConfigFiles ()
+00632 {
+00633 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#r1">_ConfigFiles</a> == NULL) <font class="keywordflow">return</font>;
+00634
+00635 <font class="keyword">static</font> time_t LastCheckTime = time (NULL);
+00636 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CConfigFile.html#r0">_Timeout</a> &gt; 0 &amp;&amp; (float)(time (NULL) - LastCheckTime)*1000.0f &lt; (float)<a class="code" href="classNLMISC_1_1CConfigFile.html#r0">_Timeout</a>) <font class="keywordflow">return</font>;
+00637
+00638 LastCheckTime = time (NULL);
+00639
+00640 <font class="keywordflow">for</font> (vector&lt;CConfigFile *&gt;::iterator it = (*_ConfigFiles).begin (); it != (*_ConfigFiles).end (); it++)
+00641 {
+00642 <font class="keywordflow">if</font> ((*it)-&gt;_LastModified != (*it)-&gt;getLastModified ())
+00643 {
+00644 <font class="keywordflow">try</font>
+00645 {
+00646 (*it)-&gt;reparse ();
+00647 }
+00648 <font class="keywordflow">catch</font> (EConfigFile &amp;e)
+00649 {
+00650 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Exception will rereading modified config file: %s"</font>, e.what ());
+00651 }
+00652 }
+00653 }
+00654 }
+00655
+00656 <font class="keywordtype">void</font> CConfigFile::setTimeout (uint32 timeout)
+00657 {
+00658 <a class="code" href="debug_8h.html#a6">nlassert</a> (timeout&gt;=0);
+00659 <a class="code" href="classNLMISC_1_1CConfigFile.html#r0">_Timeout</a> = timeout;
+00660 }
+00661
+00662 } <font class="comment">// NLMISC</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>