diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/form__loader_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/form__loader_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/form__loader_8cpp-source.html | 400 |
1 files changed, 400 insertions, 0 deletions
diff --git a/docs/doxygen/nel/form__loader_8cpp-source.html b/docs/doxygen/nel/form__loader_8cpp-source.html new file mode 100644 index 00000000..b6c65664 --- /dev/null +++ b/docs/doxygen/nel/form__loader_8cpp-source.html @@ -0,0 +1,400 @@ +<!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>form_loader.cpp</h1><a href="form__loader_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000-2002 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="stdgeorges_8h.html">stdgeorges.h</a>"</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="file_8h.html">nel/misc/file.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="i__xml_8h.html">nel/misc/i_xml.h</a>"</font> +00031 +00032 <font class="preprocessor">#include "<a class="code" href="u__form_8h.html">nel/georges/u_form.h</a>"</font> +00033 +00034 <font class="preprocessor">#include "<a class="code" href="form__loader_8h.html">form_loader.h</a>"</font> +00035 <font class="preprocessor">#include "<a class="code" href="type_8h.html">type.h</a>"</font> +00036 <font class="preprocessor">#include "<a class="code" href="form_8h.html">form.h</a>"</font> +00037 <font class="preprocessor">#include "<a class="code" href="form__dfn_8h.html">form_dfn.h</a>"</font> +00038 +00039 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00040 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00041 +00042 <font class="keyword">namespace </font>NLGEORGES +00043 { +00044 +00045 <font class="comment">// ***************************************************************************</font> +00046 +00047 <font class="keywordtype">void</font> <a class="code" href="namespaceNLGEORGES.html#a0">warning</a> (<font class="keywordtype">bool</font> exception, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ... ); +00048 +00049 <font class="comment">// ***************************************************************************</font> +00050 <font class="comment">// UFormLoader</font> +00051 <font class="comment">// ***************************************************************************</font> +00052 +<a name="l00053"></a><a class="code" href="classNLGEORGES_1_1UFormLoader.html#d0">00053</a> UFormLoader *UFormLoader::createLoader () +00054 { +00055 <font class="keywordflow">return</font> <font class="keyword">new</font> CFormLoader; +00056 } +00057 +00058 <font class="comment">// ***************************************************************************</font> +00059 +<a name="l00060"></a><a class="code" href="classNLGEORGES_1_1UFormLoader.html#d1">00060</a> <font class="keywordtype">void</font> UFormLoader::releaseLoader (UFormLoader *loader) +00061 { +00062 <font class="keyword">delete</font> loader; +00063 } +00064 +00065 <font class="comment">// ***************************************************************************</font> +00066 <font class="comment">// CFormLoader</font> +00067 <font class="comment">// ***************************************************************************</font> +00068 +<a name="l00069"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#a3">00069</a> CType *CFormLoader::loadType (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename) +00070 { +00071 <font class="comment">// Lower string filename</font> +00072 string lowerStr = strlwr ((string)filename); +00073 lowerStr = CFile::getFilename (lowerStr); +00074 +00075 <font class="comment">// Already in the map ?</font> +00076 TTypeMap::iterator ite = <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o0">_MapType</a>.find (lowerStr); +00077 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o0">_MapType</a>.end() && (ite->second != NULL) ) +00078 { +00079 <font class="comment">// Return the pointer</font> +00080 <font class="keywordflow">return</font> ite->second; +00081 } +00082 <font class="keywordflow">else</font> +00083 { +00084 <font class="comment">// Create the type</font> +00085 CType *<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> = <font class="keyword">new</font> CType; +00086 +00087 <font class="comment">// Load the type</font> +00088 <font class="keywordflow">try</font> +00089 { +00090 <font class="comment">// Open the file</font> +00091 string name = CPath::lookup (filename, <font class="keyword">false</font>, <font class="keyword">false</font>); +00092 <font class="keywordflow">if</font> (name.empty()) +00093 name = filename; +00094 CIFile <a class="code" href="cf__lexical_8cpp.html#a95">file</a>; +00095 <font class="keywordflow">if</font> (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.open (name)) +00096 { +00097 <font class="comment">// Init an xml stream</font> +00098 CIXml read; +00099 read.init (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>); +00100 +00101 <font class="comment">// Read the type</font> +00102 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>->read (read.getRootNode ()); +00103 } +00104 <font class="keywordflow">else</font> +00105 { +00106 <font class="comment">// Output error</font> +00107 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadType"</font>, <font class="stringliteral">"Can't open the form file (%s)."</font>, filename); +00108 +00109 <font class="comment">// Delete the type</font> +00110 <font class="keyword">delete</font> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00111 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> = NULL; +00112 } +00113 } +00114 <font class="keywordflow">catch</font> (Exception &e) +00115 { +00116 <font class="comment">// Output error</font> +00117 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadType"</font>, <font class="stringliteral">"Error while loading the form (%s): %s"</font>, filename, e.what()); +00118 +00119 <font class="comment">// Delete the type</font> +00120 <font class="keyword">delete</font> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00121 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> = NULL; +00122 } +00123 +00124 <font class="comment">// Loaded ?</font> +00125 <font class="keywordflow">if</font> (type) +00126 { +00127 <font class="comment">// Insert a new entry</font> +00128 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o0">_MapType</a>[lowerStr]= <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00129 ite = <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o0">_MapType</a>.find (lowerStr); +00130 CType *typeType = ite->second; +00131 <font class="keywordtype">int</font> <a class="code" href="namespaceNLMISC.html#a294">toto</a> = 0; +00132 } +00133 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00134 } +00135 } +00136 +00137 <font class="comment">// ***************************************************************************</font> +00138 +<a name="l00139"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#a4">00139</a> CFormDfn *CFormLoader::loadFormDfn (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keywordtype">bool</font> forceLoad) +00140 { +00141 <font class="comment">// Lower string filename</font> +00142 string lowerStr = strlwr ((string)filename); +00143 lowerStr = CFile::getFilename (lowerStr); +00144 +00145 <font class="comment">// Already in the map ?</font> +00146 TFormDfnMap::iterator ite = <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o1">_MapFormDfn</a>.find (lowerStr); +00147 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o1">_MapFormDfn</a>.end() && ite->second) +00148 { +00149 <font class="comment">// Return the pointer</font> +00150 <font class="keywordflow">return</font> ite->second; +00151 } +00152 <font class="keywordflow">else</font> +00153 { +00154 <font class="comment">// Create the formDfn</font> +00155 CFormDfn *formDfn = <font class="keyword">new</font> CFormDfn; +00156 +00157 <font class="comment">// Insert the form first</font> +00158 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o1">_MapFormDfn</a>[lowerStr] = formDfn; +00159 +00160 <font class="comment">// Load the type</font> +00161 <font class="keywordflow">try</font> +00162 { +00163 <font class="comment">// Open the file</font> +00164 string name = CPath::lookup (filename, <font class="keyword">false</font>, <font class="keyword">false</font>); +00165 <font class="keywordflow">if</font> (name.empty()) +00166 name = filename; +00167 CIFile <a class="code" href="cf__lexical_8cpp.html#a95">file</a>; +00168 <font class="keywordflow">if</font> (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.open (name)) +00169 { +00170 <font class="comment">// Init an xml stream</font> +00171 CIXml read; +00172 read.init (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>); +00173 +00174 <font class="comment">// Read the type</font> +00175 formDfn->read (read.getRootNode (), *<font class="keyword">this</font>, forceLoad, filename); +00176 } +00177 <font class="keywordflow">else</font> +00178 { +00179 <font class="comment">// Output error</font> +00180 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadFormDfn"</font>, <font class="stringliteral">"Can't open the form file (%s)."</font>, filename); +00181 +00182 <font class="comment">// Delete the formDfn</font> +00183 <font class="keyword">delete</font> formDfn; +00184 formDfn = NULL; +00185 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o1">_MapFormDfn</a>.erase (lowerStr); +00186 } +00187 } +00188 <font class="keywordflow">catch</font> (Exception &e) +00189 { +00190 <font class="comment">// Output error</font> +00191 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadFormDfn"</font>, <font class="stringliteral">"Error while loading the form (%s): %s"</font>, filename, e.what()); +00192 +00193 <font class="comment">// Delete the formDfn</font> +00194 <font class="keyword">delete</font> formDfn; +00195 formDfn = NULL; +00196 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o1">_MapFormDfn</a>.erase (lowerStr); +00197 } +00198 +00199 <font class="keywordflow">return</font> formDfn; +00200 } +00201 } +00202 +00203 <font class="comment">// ***************************************************************************</font> +00204 +<a name="l00205"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#a0">00205</a> UForm *<a class="code" href="load__form_8h.html#a3">CFormLoader::loadForm</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename) +00206 { +00207 <font class="comment">// Lower string filename</font> +00208 string lowerStr = strlwr ((string)filename); +00209 lowerStr = CFile::getFilename (lowerStr); +00210 +00211 <font class="comment">// Already in the map ?</font> +00212 TFormMap::iterator ite = <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.find (lowerStr); +00213 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.end() && ite->second) +00214 { +00215 <font class="comment">// Return the pointer</font> +00216 <font class="keywordflow">return</font> (CForm*)ite->second; +00217 } +00218 <font class="keywordflow">else</font> +00219 { +00220 <font class="comment">// Create the form</font> +00221 CForm *form = <font class="keyword">new</font> CForm; +00222 +00223 <font class="comment">// Insert the form first</font> +00224 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>[lowerStr] = form; +00225 +00226 <font class="comment">// Load the type</font> +00227 <font class="keywordflow">try</font> +00228 { +00229 <font class="comment">// Get the form DFN filename</font> +00230 string name = CFile::getFilename (filename); +00231 uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = name.rfind (<font class="charliteral">'.'</font>); +00232 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == string::npos) +00233 { +00234 <font class="comment">// Output error</font> +00235 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadForm"</font>, <font class="stringliteral">"Form name is invalid (%s). It should have the extension of its DFN type."</font>, name.c_str ()); +00236 +00237 <font class="comment">// Delete the form</font> +00238 <font class="keyword">delete</font> form; +00239 form = NULL; +00240 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.erase (lowerStr); +00241 } +00242 name = name.substr (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>+1); +00243 name += <font class="stringliteral">".dfn"</font>; +00244 +00245 <font class="comment">// Load the dfn</font> +00246 CFormDfn *dfn = <a class="code" href="classNLGEORGES_1_1CFormLoader.html#a1">loadFormDfn</a> (name.c_str (), <font class="keyword">false</font>); +00247 <font class="keywordflow">if</font> (dfn) +00248 { +00249 <font class="comment">// Open the file</font> +00250 name = CPath::lookup (filename, <font class="keyword">false</font>, <font class="keyword">false</font>); +00251 <font class="keywordflow">if</font> (name.empty()) +00252 name = filename; +00253 CIFile <a class="code" href="cf__lexical_8cpp.html#a95">file</a>; +00254 <font class="keywordflow">if</font> (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.open (name)) +00255 { +00256 <font class="comment">// Init an xml stream</font> +00257 CIXml read; +00258 read.init (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>); +00259 +00260 <font class="comment">// Read the form</font> +00261 form->read (read.getRootNode (), *<font class="keyword">this</font>, dfn, filename); +00262 } +00263 <font class="keywordflow">else</font> +00264 { +00265 <font class="comment">// Output error</font> +00266 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadForm"</font>, <font class="stringliteral">"Can't open the form file (%s)."</font>, filename); +00267 +00268 <font class="comment">// Delete the form</font> +00269 <font class="keyword">delete</font> form; +00270 form = NULL; +00271 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.erase (lowerStr); +00272 } +00273 } +00274 <font class="keywordflow">else</font> +00275 { +00276 <font class="comment">// Output error</font> +00277 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadForm"</font>, <font class="stringliteral">"Can't open the dfn file (%s)."</font>, name.c_str ()); +00278 +00279 <font class="comment">// Delete the form</font> +00280 <font class="keyword">delete</font> form; +00281 form = NULL; +00282 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.erase (lowerStr); +00283 } +00284 } +00285 <font class="keywordflow">catch</font> (Exception &e) +00286 { +00287 <font class="comment">// Output error</font> +00288 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">warning</a> (<font class="keyword">false</font>, <font class="stringliteral">"loadForm"</font>, <font class="stringliteral">"Error while loading the form (%s): %s"</font>, filename, e.what()); +00289 +00290 <font class="comment">// Delete the form</font> +00291 <font class="keyword">delete</font> form; +00292 form = NULL; +00293 <a class="code" href="classNLGEORGES_1_1CFormLoader.html#o2">_MapForm</a>.erase (lowerStr); +00294 } +00295 +00296 <font class="keywordflow">return</font> form; +00297 } +00298 } +00299 +00300 <font class="comment">// ***************************************************************************</font> +00301 +<a name="l00302"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#a1">00302</a> UFormDfn *CFormLoader::loadFormDfn (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename) +00303 { +00304 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CFormLoader.html#a1">loadFormDfn</a> (filename, <font class="keyword">false</font>); +00305 } +00306 +00307 <font class="comment">// ***************************************************************************</font> +00308 +<a name="l00309"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#a2">00309</a> UType *CFormLoader::loadFormType (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename) +00310 { +00311 <font class="keywordflow">return</font> <a class="code" href="classNLGEORGES_1_1CFormLoader.html#a3">loadType</a> (filename); +00312 } +00313 +00314 <font class="comment">// ***************************************************************************</font> +00315 +<a name="l00316"></a><a class="code" href="classNLGEORGES_1_1CFormLoader.html#c0">00316</a> <font class="keywordtype">void</font> CFormLoader::warning (<font class="keywordtype">bool</font> exception, <font class="keyword">const</font> <font class="keywordtype">char</font> *function, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ... )<font class="keyword"> const</font> +00317 <font class="keyword"></font>{ +00318 <font class="comment">// Make a buffer string</font> +00319 va_list args; +00320 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a> ); +00321 <font class="keywordtype">char</font> buffer[1024]; +00322 sint ret = vsnprintf( buffer, 1024, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, args ); +00323 va_end( args ); +00324 +00325 <font class="comment">// Set the warning</font> +00326 <a class="code" href="namespaceNLGEORGES.html#a0">NLGEORGES::warning</a> (exception, <font class="stringliteral">"(CFormLoader::%s) : %s"</font>, function, buffer); +00327 } +00328 +00329 <font class="comment">// ***************************************************************************</font> +00330 +00331 } <font class="comment">// NLGEORGES</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> |