diff options
Diffstat (limited to 'docs/doxygen/nel/a02558.html')
-rw-r--r-- | docs/doxygen/nel/a02558.html | 798 |
1 files changed, 798 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02558.html b/docs/doxygen/nel/a02558.html new file mode 100644 index 00000000..f2436f4e --- /dev/null +++ b/docs/doxygen/nel/a02558.html @@ -0,0 +1,798 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLGEORGES::CFormLoader class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.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">Data Structures</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">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLGEORGES::CFormLoader Class Reference</h1><code>#include <<a class="el" href="a05731.html">form_loader.h</a>></code> +<p> +<p>Inheritance diagram for NLGEORGES::CFormLoader: +<p><center><img src="a02558.png" usemap="#NLGEORGES::CFormLoader_map" border="0" alt=""></center> +<map name="NLGEORGES::CFormLoader_map"> +<area href="a02559.html" alt="NLGEORGES::UFormLoader" shape="rect" coords="0,0,172,24"> +</map> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Georges form loader implementation<p> +<dl compact><dt><b>Author:</b></dt><dd>Cyril 'Hulud' Corvazier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00049">49</a> of file <a class="el" href="a05731.html">form_loader.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03926.html">UForm</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadera0">loadForm</a> (const char *<a class="el" href="a04560.html#a1">filename</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02546.html">CFormDfn</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadera1">loadFormDfn</a> (const char *<a class="el" href="a04560.html#a1">filename</a>, bool forceLoad)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02547.html">UFormDfn</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadera2">loadFormDfn</a> (const char *<a class="el" href="a04560.html#a1">filename</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03623.html">UType</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadera3">loadFormType</a> (const char *<a class="el" href="a04560.html#a1">filename</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03622.html">CType</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadera4">loadType</a> (const char *<a class="el" href="a04560.html#a1">filename</a>)</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02559.html">UFormLoader</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadere0">createLoader</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a form loader. <a href="#NLGEORGES_1_1UFormLoadere0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadere1">releaseLoader</a> (<a class="el" href="a02559.html">UFormLoader</a> *loader)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a form loader. <a href="#NLGEORGES_1_1UFormLoadere1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< std::string,<br> + <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< <a class="el" href="a02546.html">CFormDfn</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery0">TFormDfnMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< std::string,<br> + <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< <a class="el" href="a02544.html">CForm</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery1">TFormMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< std::string,<br> + <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< <a class="el" href="a03622.html">CType</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery2">TTypeMap</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (bool exception, const char *function, const char *<a class="el" href="a04223.html#a641">format</a>,...) const </td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery1">TFormMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery0">TFormDfnMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery2">TTypeMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">_MapType</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLGEORGES_1_1CFormLoadery0" doxytag="NLGEORGES::CFormLoader::TFormDfnMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<std::string, <a class="el" href="a03321.html">NLMISC::CRefPtr</a><<a class="el" href="a02546.html">CFormDfn</a>> > <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery0">NLGEORGES::CFormLoader::TFormDfnMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00068">68</a> of file <a class="el" href="a05731.html">form_loader.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadery1" doxytag="NLGEORGES::CFormLoader::TFormMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<std::string, <a class="el" href="a03321.html">NLMISC::CRefPtr</a><<a class="el" href="a02544.html">CForm</a>> > <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery1">NLGEORGES::CFormLoader::TFormMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00069">69</a> of file <a class="el" href="a05731.html">form_loader.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadery2" doxytag="NLGEORGES::CFormLoader::TTypeMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<std::string, <a class="el" href="a03321.html">NLMISC::CRefPtr</a><<a class="el" href="a03622.html">CType</a>> > <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery2">NLGEORGES::CFormLoader::TTypeMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00067">67</a> of file <a class="el" href="a05731.html">form_loader.h</a>. </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLGEORGES_1_1UFormLoadere0" doxytag="NLGEORGES::CFormLoader::createLoader" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02559.html">UFormLoader</a> * NLGEORGES::UFormLoader::createLoader </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Create a form loader. +<p> + +<p> +Definition at line <a class="el" href="a05730.html#l00053">53</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +Referenced by <a class="el" href="a05465.html#l00358">NLSOUND::CAudioMixerUser::init()</a>, and <a class="el" href="a05926.html#l00145">loadForm()</a>. +<p> +<div class="fragment"><pre>00054 { +00055 <span class="keywordflow">return</span> <span class="keyword">new</span> CFormLoader; +00056 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadera0" doxytag="NLGEORGES::CFormLoader::loadForm" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03926.html">UForm</a> * NLGEORGES::CFormLoader::loadForm </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>filename</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Load a form, use NMISC::CPath to find the file.<p> +The pointer on the form must be held in a CSmartPtr<UForm>. Returns NULL if the form can't be loaded. +<p> +Implements <a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadera0">NLGEORGES::UFormLoader</a>. +<p> +Definition at line <a class="el" href="a05730.html#l00205">205</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +References <a class="el" href="a05731.html#l00078">_MapForm</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05730.html#l00302">loadFormDfn()</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05730.html#l00316">warning()</a>. +<p> +Referenced by <a class="el" href="a05724.html#l00154">NLGEORGES::CForm::readParent()</a>. +<p> +<div class="fragment"><pre>00206 { +00207 <span class="comment">// Lower string filename</span> +00208 string lowerStr = <a class="code" href="a05378.html#a273">strlwr</a> ((string)filename); +00209 lowerStr = CFile::getFilename (lowerStr); +00210 +00211 <span class="comment">// Already in the map ?</span> +00212 TFormMap::iterator ite = <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.find (lowerStr); +00213 <span class="keywordflow">if</span> (ite != <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.end() && ite->second) +00214 { +00215 <span class="comment">// Return the pointer</span> +00216 <span class="keywordflow">return</span> (CForm*)ite->second; +00217 } +00218 <span class="keywordflow">else</span> +00219 { +00220 <span class="comment">// Create the form</span> +00221 CForm *form = <span class="keyword">new</span> CForm; +00222 +00223 <span class="comment">// Insert the form first</span> +00224 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>[lowerStr] = form; +00225 +00226 <span class="comment">// Load the type</span> +00227 <span class="keywordflow">try</span> +00228 { +00229 <span class="comment">// Get the form DFN filename</span> +00230 string name = CFile::getFilename (filename); +00231 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = name.rfind (<span class="charliteral">'.'</span>); +00232 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> == string::npos) +00233 { +00234 <span class="comment">// Output error</span> +00235 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadForm"</span>, <span class="stringliteral">"Form name is invalid (%s). It should have the extension of its DFN type."</span>, name.c_str ()); +00236 +00237 <span class="comment">// Delete the form</span> +00238 <span class="keyword">delete</span> form; +00239 form = NULL; +00240 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.erase (lowerStr); +00241 } +00242 name = name.substr (index+1); +00243 name += <span class="stringliteral">".dfn"</span>; +00244 +00245 <span class="comment">// Load the dfn</span> +00246 CFormDfn *dfn = <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoadera2">loadFormDfn</a> (name.c_str (), <span class="keyword">false</span>); +00247 <span class="keywordflow">if</span> (dfn) +00248 { +00249 <span class="comment">// Open the file</span> +00250 name = CPath::lookup (filename, <span class="keyword">false</span>, <span class="keyword">false</span>); +00251 <span class="keywordflow">if</span> (name.empty()) +00252 name = <a class="code" href="a05377.html#a2">filename</a>; +00253 <a class="code" href="a02653.html">CIFile</a> <a class="code" href="a04115.html#a95">file</a>; +00254 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>.open (name)) +00255 { +00256 <span class="comment">// Init an xml stream</span> +00257 CIXml read; +00258 read.init (file); +00259 +00260 <span class="comment">// Read the form</span> +00261 form->read (read.getRootNode (), *<span class="keyword">this</span>, dfn, <a class="code" href="a05377.html#a2">filename</a>); +00262 } +00263 <span class="keywordflow">else</span> +00264 { +00265 <span class="comment">// Output error</span> +00266 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadForm"</span>, <span class="stringliteral">"Can't open the form file (%s)."</span>, filename); +00267 +00268 <span class="comment">// Delete the form</span> +00269 <span class="keyword">delete</span> form; +00270 form = NULL; +00271 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.erase (lowerStr); +00272 } +00273 } +00274 <span class="keywordflow">else</span> +00275 { +00276 <span class="comment">// Output error</span> +00277 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadForm"</span>, <span class="stringliteral">"Can't open the dfn file (%s)."</span>, name.c_str ()); +00278 +00279 <span class="comment">// Delete the form</span> +00280 <span class="keyword">delete</span> form; +00281 form = NULL; +00282 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.erase (lowerStr); +00283 } +00284 } +00285 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">Exception</a> &e) +00286 { +00287 <span class="comment">// Output error</span> +00288 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadForm"</span>, <span class="stringliteral">"Error while loading the form (%s): %s"</span>, filename, e.what()); +00289 +00290 <span class="comment">// Delete the form</span> +00291 <span class="keyword">delete</span> form; +00292 form = NULL; +00293 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">_MapForm</a>.erase (lowerStr); +00294 } +00295 +00296 <span class="keywordflow">return</span> form; +00297 } +00298 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadera1" doxytag="NLGEORGES::CFormLoader::loadFormDfn" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02546.html">CFormDfn</a> * NLGEORGES::CFormLoader::loadFormDfn </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>filename</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>forceLoad</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05730.html#l00139">139</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +References <a class="el" href="a05731.html#l00075">_MapFormDfn</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, and <a class="el" href="a05730.html#l00316">warning()</a>. +<p> +<div class="fragment"><pre>00140 { +00141 <span class="comment">// Lower string filename</span> +00142 string lowerStr = <a class="code" href="a05378.html#a273">strlwr</a> ((string)filename); +00143 lowerStr = CFile::getFilename (lowerStr); +00144 +00145 <span class="comment">// Already in the map ?</span> +00146 TFormDfnMap::iterator ite = <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a>.find (lowerStr); +00147 <span class="keywordflow">if</span> (ite != <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a>.end() && ite->second) +00148 { +00149 <span class="comment">// Return the pointer</span> +00150 <span class="keywordflow">return</span> ite->second; +00151 } +00152 <span class="keywordflow">else</span> +00153 { +00154 <span class="comment">// Create the formDfn</span> +00155 CFormDfn *formDfn = <span class="keyword">new</span> CFormDfn; +00156 +00157 <span class="comment">// Insert the form first</span> +00158 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a>[lowerStr] = formDfn; +00159 +00160 <span class="comment">// Load the type</span> +00161 <span class="keywordflow">try</span> +00162 { +00163 <span class="comment">// Open the file</span> +00164 string name = CPath::lookup (filename, <span class="keyword">false</span>, <span class="keyword">false</span>); +00165 <span class="keywordflow">if</span> (name.empty()) +00166 name = <a class="code" href="a05377.html#a2">filename</a>; +00167 <a class="code" href="a02653.html">CIFile</a> <a class="code" href="a04115.html#a95">file</a>; +00168 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>.open (name)) +00169 { +00170 <span class="comment">// Init an xml stream</span> +00171 CIXml read; +00172 read.init (file); +00173 +00174 <span class="comment">// Read the type</span> +00175 formDfn->read (read.getRootNode (), *<span class="keyword">this</span>, forceLoad, <a class="code" href="a05377.html#a2">filename</a>); +00176 } +00177 <span class="keywordflow">else</span> +00178 { +00179 <span class="comment">// Output error</span> +00180 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadFormDfn"</span>, <span class="stringliteral">"Can't open the form file (%s)."</span>, filename); +00181 +00182 <span class="comment">// Delete the formDfn</span> +00183 <span class="keyword">delete</span> formDfn; +00184 formDfn = NULL; +00185 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a>.erase (lowerStr); +00186 } +00187 } +00188 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">Exception</a> &e) +00189 { +00190 <span class="comment">// Output error</span> +00191 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadFormDfn"</span>, <span class="stringliteral">"Error while loading the form (%s): %s"</span>, filename, e.what()); +00192 +00193 <span class="comment">// Delete the formDfn</span> +00194 <span class="keyword">delete</span> formDfn; +00195 formDfn = NULL; +00196 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">_MapFormDfn</a>.erase (lowerStr); +00197 } +00198 +00199 <span class="keywordflow">return</span> formDfn; +00200 } +00201 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadera2" doxytag="NLGEORGES::CFormLoader::loadFormDfn" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02547.html">UFormDfn</a> * NLGEORGES::CFormLoader::loadFormDfn </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>filename</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Load a DFN, use NMISC::CPath to find the file.<p> +The pointer on the form must be held in a CSmartPtr<UFormDfn>. Returns NULL if the DFN can't be loaded. +<p> +Implements <a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadera1">NLGEORGES::UFormLoader</a>. +<p> +Definition at line <a class="el" href="a05730.html#l00302">302</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00205">loadForm()</a>, <a class="el" href="a05728.html#l02175">NLGEORGES::CFormElmVirtualStruct::read()</a>, <a class="el" href="a05726.html#l00118">NLGEORGES::CFormDfn::read()</a>, <a class="el" href="a05726.html#l00477">NLGEORGES::CFormDfn::CEntry::setDfn()</a>, and <a class="el" href="a05726.html#l00456">NLGEORGES::CFormDfn::setParent()</a>. +<p> +<div class="fragment"><pre>00303 { +00304 <span class="keywordflow">return</span> <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoadera2">loadFormDfn</a> (filename, <span class="keyword">false</span>); +00305 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadera3" doxytag="NLGEORGES::CFormLoader::loadFormType" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03623.html">UType</a> * NLGEORGES::CFormLoader::loadFormType </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>filename</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Load a type, use NMISC::CPath to find the file.<p> +The pointer on the form must be held in a CSmartPtr<UType>. Returns NULL if the type can't be loaded. +<p> +Implements <a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadera2">NLGEORGES::UFormLoader</a>. +<p> +Definition at line <a class="el" href="a05730.html#l00309">309</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +References <a class="el" href="a05730.html#l00069">loadType()</a>. +<p> +<div class="fragment"><pre>00310 { +00311 <span class="keywordflow">return</span> <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoadera4">loadType</a> (filename); +00312 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoadera4" doxytag="NLGEORGES::CFormLoader::loadType" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03622.html">CType</a> * NLGEORGES::CFormLoader::loadType </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>filename</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05730.html#l00069">69</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +References <a class="el" href="a05731.html#l00072">_MapType</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05646.html#l00244">type</a>, and <a class="el" href="a05730.html#l00316">warning()</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00309">loadFormType()</a>, <a class="el" href="a05726.html#l00118">NLGEORGES::CFormDfn::read()</a>, and <a class="el" href="a05726.html#l00467">NLGEORGES::CFormDfn::CEntry::setType()</a>. +<p> +<div class="fragment"><pre>00070 { +00071 <span class="comment">// Lower string filename</span> +00072 string lowerStr = <a class="code" href="a05378.html#a273">strlwr</a> ((string)filename); +00073 lowerStr = CFile::getFilename (lowerStr); +00074 +00075 <span class="comment">// Already in the map ?</span> +00076 TTypeMap::iterator ite = <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">_MapType</a>.find (lowerStr); +00077 <span class="keywordflow">if</span> (ite != <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">_MapType</a>.end() && (ite->second != NULL) ) +00078 { +00079 <span class="comment">// Return the pointer</span> +00080 <span class="keywordflow">return</span> ite->second; +00081 } +00082 <span class="keywordflow">else</span> +00083 { +00084 <span class="comment">// Create the type</span> +00085 CType *<a class="code" href="a04223.html#a581">type</a> = <span class="keyword">new</span> CType; +00086 +00087 <span class="comment">// Load the type</span> +00088 <span class="keywordflow">try</span> +00089 { +00090 <span class="comment">// Open the file</span> +00091 string name = CPath::lookup (filename, <span class="keyword">false</span>, <span class="keyword">false</span>); +00092 <span class="keywordflow">if</span> (name.empty()) +00093 name = <a class="code" href="a05377.html#a2">filename</a>; +00094 <a class="code" href="a02653.html">CIFile</a> <a class="code" href="a04115.html#a95">file</a>; +00095 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>.open (name)) +00096 { +00097 <span class="comment">// Init an xml stream</span> +00098 CIXml read; +00099 read.init (file); +00100 +00101 <span class="comment">// Read the type</span> +00102 <a class="code" href="a04223.html#a581">type</a>->read (read.getRootNode ()); +00103 } +00104 <span class="keywordflow">else</span> +00105 { +00106 <span class="comment">// Output error</span> +00107 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadType"</span>, <span class="stringliteral">"Can't open the form file (%s)."</span>, filename); +00108 +00109 <span class="comment">// Delete the type</span> +00110 <span class="keyword">delete</span> <a class="code" href="a04223.html#a581">type</a>; +00111 <a class="code" href="a04223.html#a581">type</a> = NULL; +00112 } +00113 } +00114 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">Exception</a> &e) +00115 { +00116 <span class="comment">// Output error</span> +00117 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderd0">warning</a> (<span class="keyword">false</span>, <span class="stringliteral">"loadType"</span>, <span class="stringliteral">"Error while loading the form (%s): %s"</span>, filename, e.what()); +00118 +00119 <span class="comment">// Delete the type</span> +00120 <span class="keyword">delete</span> <a class="code" href="a04223.html#a581">type</a>; +00121 <a class="code" href="a04223.html#a581">type</a> = NULL; +00122 } +00123 +00124 <span class="comment">// Loaded ?</span> +00125 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a581">type</a>) +00126 { +00127 <span class="comment">// Insert a new entry</span> +00128 <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">_MapType</a>[lowerStr]= <a class="code" href="a04223.html#a581">type</a>; +00129 ite = <a class="code" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">_MapType</a>.find (lowerStr); +00130 <span class="comment">//CType *typeType = ite->second;</span> +00131 <span class="comment">// int toto = 0;</span> +00132 } +00133 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a581">type</a>; +00134 } +00135 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1UFormLoadere1" doxytag="NLGEORGES::CFormLoader::releaseLoader" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLGEORGES::UFormLoader::releaseLoader </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02559.html">UFormLoader</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>loader</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Create a form loader. +<p> + +<p> +Definition at line <a class="el" href="a05730.html#l00060">60</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +Referenced by <a class="el" href="a05465.html#l00358">NLSOUND::CAudioMixerUser::init()</a>, and <a class="el" href="a05926.html#l00145">loadForm()</a>. +<p> +<div class="fragment"><pre>00061 { +00062 <span class="keyword">delete</span> ((CFormLoader*)loader); +00063 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoaderd0" doxytag="NLGEORGES::CFormLoader::warning" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLGEORGES::CFormLoader::warning </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname" nowrap> <em>exception</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>function</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>format</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>... </td> + <td class="mdname" nowrap></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private, virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05730.html#l00316">316</a> of file <a class="el" href="a05730.html">form_loader.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05646.html#l01016">format</a>, and <a class="el" href="a05724.html#l00045">NLGEORGES::warning()</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00205">loadForm()</a>, <a class="el" href="a05730.html#l00139">loadFormDfn()</a>, and <a class="el" href="a05730.html#l00069">loadType()</a>. +<p> +<div class="fragment"><pre>00317 { +00318 <span class="comment">// Make a buffer string</span> +00319 va_list args; +00320 va_start( args, format ); +00321 <span class="keywordtype">char</span> <a class="code" href="a04223.html#a589">buffer</a>[1024]; +00322 vsnprintf( buffer, 1024, format, args ); +00323 va_end( args ); +00324 +00325 <span class="comment">// Set the warning</span> +00326 <a class="code" href="a05374.html#a0">NLGEORGES::warning</a> (exception, <span class="stringliteral">"(CFormLoader::%s) : %s"</span>, function, buffer); +00327 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLGEORGES_1_1CFormLoaderr0" doxytag="NLGEORGES::CFormLoader::_MapForm" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery1">TFormMap</a> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr0">NLGEORGES::CFormLoader::_MapForm</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00078">78</a> of file <a class="el" href="a05731.html">form_loader.h</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00205">loadForm()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoaderr1" doxytag="NLGEORGES::CFormLoader::_MapFormDfn" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery0">TFormDfnMap</a> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr1">NLGEORGES::CFormLoader::_MapFormDfn</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00075">75</a> of file <a class="el" href="a05731.html">form_loader.h</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00139">loadFormDfn()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLGEORGES_1_1CFormLoaderr2" doxytag="NLGEORGES::CFormLoader::_MapType" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoadery2">TTypeMap</a> <a class="el" href="a02558.html#NLGEORGES_1_1CFormLoaderr2">NLGEORGES::CFormLoader::_MapType</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05731.html#l00072">72</a> of file <a class="el" href="a05731.html">form_loader.h</a>. +<p> +Referenced by <a class="el" href="a05730.html#l00069">loadType()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05731.html">form_loader.h</a><li><a class="el" href="a05730.html">form_loader.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 12:45:16 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |