diff options
Diffstat (limited to 'docs/doxygen/nel/a04778.html')
-rw-r--r-- | docs/doxygen/nel/a04778.html | 446 |
1 files changed, 446 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a04778.html b/docs/doxygen/nel/a04778.html new file mode 100644 index 00000000..fb3bf2c6 --- /dev/null +++ b/docs/doxygen/nel/a04778.html @@ -0,0 +1,446 @@ +<!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: primitive_class.cpp File 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>primitive_class.cpp File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> +Ligo primitive class description. Give access at common properties for a primitive class. Properties are given in an XML file<p> +<dl compact><dt><b>Id</b></dt><dd><a class="el" href="a04778.html">primitive_class.cpp</a>,v 1.11 2004/01/23 13:39:13 corvazier Exp </dd></dl> + +<p> +Definition in file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +<code>#include <<a class="el" href="a06202.html">nel/ligo/primitive_class.h</a>></code><br> +<code>#include <<a class="el" href="a06196.html">nel/ligo/primitive.h</a>></code><br> +<code>#include <<a class="el" href="a05904.html">nel/ligo/ligo_config.h</a>></code><br> +<code>#include <<a class="el" href="a05801.html">nel/misc/i_xml.h</a>></code><br> +<code>#include <<a class="el" href="a06168.html">nel/misc/path.h</a>></code><br> + +<p> +<a href="a06201.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a04778.html#a2">ReadBool</a> (const char *propName, bool &result, xmlNodePtr xmlNode, const char *<a class="el" href="a04560.html#a1">filename</a>, CLigoConfig &config)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a04778.html#a4">ReadChild</a> (<a class="el" href="a03108.html">CPrimitiveClass::CChild</a> &child, xmlNodePtr childNode, const char *<a class="el" href="a04560.html#a1">filename</a>, bool _static, CLigoConfig &config)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a04778.html#a3">ReadColor</a> (<a class="el" href="a03337.html">CRGBA</a> &color, xmlNodePtr node)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a04778.html#a0">ReadFloat</a> (const char *propName, float &result, xmlNodePtr xmlNode)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a04778.html#a1">ReadInt</a> (const char *propName, int &result, xmlNodePtr xmlNode)</td></tr> + +</table> +<hr><h2>Function Documentation</h2> +<a class="anchor" name="a2" doxytag="primitive_class.cpp::ReadBool" ></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"> bool ReadBool </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>propName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>result</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>xmlNodePtr </td> + <td class="mdname" nowrap> <em>xmlNode</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>filename</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>CLigoConfig & </td> + <td class="mdname" nowrap> <em>config</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="a06201.html#l00070">70</a> of file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +Referenced by <a class="el" href="a06201.html#l00193">NLLIGO::CPrimitiveClass::read()</a>. +<p> +<div class="fragment"><pre>00071 { +00072 string str; +00073 <span class="keywordflow">if</span> (CIXml::getPropertyString (str, xmlNode, propName)) +00074 { +00075 <span class="keywordflow">if</span> (str == <span class="stringliteral">"true"</span>) +00076 result = <span class="keyword">true</span>; +00077 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (str == <span class="stringliteral">"false"</span>) +00078 result = <span class="keyword">false</span>; +00079 <span class="keywordflow">else</span> +00080 { +00081 config.syntaxError (filename, xmlNode, <span class="stringliteral">"Unknown (%s) parameter (%s), should be false or true"</span>, propName, str.c_str ()); +00082 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00083 } +00084 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00085 } +00086 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00087 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="a4" doxytag="primitive_class.cpp::ReadChild" ></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"> bool ReadChild </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03108.html">CPrimitiveClass::CChild</a> & </td> + <td class="mdname" nowrap> <em>child</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>xmlNodePtr </td> + <td class="mdname" nowrap> <em>childNode</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>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>_static</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>CLigoConfig & </td> + <td class="mdname" nowrap> <em>config</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="a06201.html#l00122">122</a> of file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +References <a class="el" href="a06202.html#l00211">NLLIGO::CPrimitiveClass::CChild::ClassName</a>, <a class="el" href="a06202.html#l00128">NLLIGO::CPrimitiveClass::CInitParameters::DefaultValue</a>, <a class="el" href="a06202.html#l00125">NLLIGO::CPrimitiveClass::CInitParameters::Name</a>, <a class="el" href="a06202.html#l00208">NLLIGO::CPrimitiveClass::CChild::Name</a>, <a class="el" href="a06202.html#l00214">NLLIGO::CPrimitiveClass::CChild::Parameters</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l01132">value</a>. +<p> +Referenced by <a class="el" href="a06201.html#l00193">NLLIGO::CPrimitiveClass::read()</a>. +<p> +<div class="fragment"><pre>00123 { +00124 <span class="comment">// Read the class name</span> +00125 <span class="keywordflow">if</span> (config.getPropertyString (child.<a class="code" href="a03108.html#NLLIGO_1_1CPrimitiveClass_1_1CChildo0">ClassName</a>, filename, childNode, <span class="stringliteral">"CLASS_NAME"</span>)) +00126 { +00127 <span class="comment">// Read the name</span> +00128 <span class="keywordflow">if</span> (!_static || config.getPropertyString (child.<a class="code" href="a03108.html#NLLIGO_1_1CPrimitiveClass_1_1CChildo1">Name</a>, filename, childNode, <span class="stringliteral">"NAME"</span>)) +00129 { +00130 <span class="comment">// Read the parameters</span> +00131 xmlNodePtr childParamNode = CIXml::getFirstChildNode (childNode, <span class="stringliteral">"PARAMETER"</span>); +00132 child.<a class="code" href="a03108.html#NLLIGO_1_1CPrimitiveClass_1_1CChildo2">Parameters</a>.reserve (CIXml::countChildren (childNode, <span class="stringliteral">"PARAMETER"</span>)); +00133 <span class="keywordflow">if</span> (childParamNode) +00134 { +00135 <span class="keywordflow">do</span> +00136 { +00137 <span class="comment">// Add a static child</span> +00138 child.<a class="code" href="a03108.html#NLLIGO_1_1CPrimitiveClass_1_1CChildo2">Parameters</a>.push_back (<a class="code" href="a03109.html">CPrimitiveClass::CInitParameters</a> ()); +00139 +00140 <span class="comment">// Child ref</span> +00141 <a class="code" href="a03109.html">CPrimitiveClass::CInitParameters</a> &childParam = child.<a class="code" href="a03108.html#NLLIGO_1_1CPrimitiveClass_1_1CChildo2">Parameters</a>.back (); +00142 +00143 <span class="comment">// Read the class name</span> +00144 <span class="keywordflow">if</span> (config.getPropertyString (childParam.<a class="code" href="a03109.html#NLLIGO_1_1CPrimitiveClass_1_1CParametero8">Name</a>, filename, childParamNode, <span class="stringliteral">"NAME"</span>)) +00145 { +00146 <span class="comment">// Read the parameters</span> +00147 xmlNodePtr childParamValueNode = CIXml::getFirstChildNode (childParamNode, <span class="stringliteral">"DEFAULT_VALUE"</span>); +00148 childParam.<a class="code" href="a03109.html#NLLIGO_1_1CPrimitiveClass_1_1CParametero2">DefaultValue</a>.resize (CIXml::countChildren (childParamNode, <span class="stringliteral">"DEFAULT_VALUE"</span>)); +00149 <a class="code" href="a04558.html#a15">uint</a> defaultId = 0; +00150 <span class="keywordflow">if</span> (childParamValueNode) +00151 { +00152 <span class="keywordflow">do</span> +00153 { +00154 <span class="comment">// Gen id flag</span> +00155 childParam.<a class="code" href="a03109.html#NLLIGO_1_1CPrimitiveClass_1_1CParametero2">DefaultValue</a>[defaultId].GenID = <span class="keyword">false</span>; +00156 +00157 <span class="comment">// Read the gen id flag</span> +00158 string <a class="code" href="a04223.html#a658">value</a>; +00159 <span class="keywordflow">if</span> (CIXml::getPropertyString (value, childParamValueNode, <span class="stringliteral">"GEN_ID"</span>) && (<a class="code" href="a04223.html#a658">value</a> != <span class="stringliteral">"false"</span>)) +00160 { +00161 childParam.<a class="code" href="a03109.html#NLLIGO_1_1CPrimitiveClass_1_1CParametero2">DefaultValue</a>[defaultId].GenID = <span class="keyword">true</span>; +00162 } +00163 <span class="keywordflow">else</span> +00164 { +00165 <span class="keywordflow">if</span> (config.getPropertyString (value, filename, childParamValueNode, <span class="stringliteral">"VALUE"</span>)) +00166 { +00167 childParam.<a class="code" href="a03109.html#NLLIGO_1_1CPrimitiveClass_1_1CParametero2">DefaultValue</a>[defaultId].Name = <a class="code" href="a04223.html#a658">value</a>; +00168 } +00169 <span class="keywordflow">else</span> +00170 <span class="keywordflow">goto</span> failed; +00171 } +00172 defaultId++; +00173 } +00174 <span class="keywordflow">while</span> ((childParamValueNode = CIXml::getNextChildNode (childParamValueNode, <span class="stringliteral">"DEFAULT_VALUE"</span>))); +00175 } +00176 } +00177 <span class="keywordflow">else</span> +00178 <span class="keywordflow">goto</span> failed; +00179 } +00180 <span class="keywordflow">while</span> ((childParamNode = CIXml::getNextChildNode (childParamNode, <span class="stringliteral">"PARAMETER"</span>))); +00181 } +00182 +00183 <span class="comment">// Ok</span> +00184 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00185 } +00186 } +00187 failed: +00188 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00189 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="a3" doxytag="primitive_class.cpp::ReadColor" ></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"> bool ReadColor </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03337.html">CRGBA</a> & </td> + <td class="mdname" nowrap> <em>color</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>xmlNodePtr </td> + <td class="mdname" nowrap> <em>node</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="a06201.html#l00091">91</a> of file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +References <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05904.html#l00033">DEFAULT_PRIMITIVE_COLOR</a>, <a class="el" href="a05646.html#l00993">r</a>, <a class="el" href="a06195.html#l00103">NLLIGO::ReadFloat()</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06201.html#l00193">NLLIGO::CPrimitiveClass::read()</a>, and <a class="el" href="a06203.html#l00039">NLLIGO::CPrimitiveConfigurations::read()</a>. +<p> +<div class="fragment"><pre>00092 { +00093 <span class="comment">// Read the color</span> +00094 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a628">r</a> = <a class="code" href="a04481.html#a0">DEFAULT_PRIMITIVE_COLOR</a>.R; +00095 <span class="keywordtype">float</span> g = <a class="code" href="a04481.html#a0">DEFAULT_PRIMITIVE_COLOR</a>.G; +00096 <span class="keywordtype">float</span> b = <a class="code" href="a04481.html#a0">DEFAULT_PRIMITIVE_COLOR</a>.B; +00097 <span class="keywordtype">float</span> a = <a class="code" href="a04481.html#a0">DEFAULT_PRIMITIVE_COLOR</a>.A; +00098 +00099 <span class="comment">// Read the value</span> +00100 <span class="keywordflow">if</span> (!<a class="code" href="a04778.html#a0">ReadFloat</a> (<span class="stringliteral">"R"</span>, r, node)) +00101 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00102 <span class="keywordflow">if</span> (!<a class="code" href="a04778.html#a0">ReadFloat</a> (<span class="stringliteral">"G"</span>, g, node)) +00103 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00104 <span class="keywordflow">if</span> (!<a class="code" href="a04778.html#a0">ReadFloat</a> (<span class="stringliteral">"B"</span>, b, node)) +00105 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00106 <span class="keywordflow">if</span> (!<a class="code" href="a04778.html#a0">ReadFloat</a> (<span class="stringliteral">"A"</span>, a, node)) +00107 a = 255; +00108 +00109 <span class="comment">// Clamp</span> +00110 <a class="code" href="a05378.html#a374">clamp</a> (r, 0.f, 255.f); +00111 <a class="code" href="a05378.html#a374">clamp</a> (g, 0.f, 255.f); +00112 <a class="code" href="a05378.html#a374">clamp</a> (b, 0.f, 255.f); +00113 <a class="code" href="a05378.html#a374">clamp</a> (a, 0.f, 255.f); +00114 +00115 <span class="comment">// Set</span> +00116 color.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa14">set</a>((<a class="code" href="a04558.html#a7">uint8</a>)r, (<a class="code" href="a04558.html#a7">uint8</a>)g, (<a class="code" href="a04558.html#a7">uint8</a>)b, (<a class="code" href="a04558.html#a7">uint8</a>)a); +00117 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00118 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="a0" doxytag="primitive_class.cpp::ReadFloat" ></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"> bool ReadFloat </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>propName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float & </td> + <td class="mdname" nowrap> <em>result</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>xmlNodePtr </td> + <td class="mdname" nowrap> <em>xmlNode</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="a06201.html#l00044">44</a> of file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01132">value</a>. +<p> +<div class="fragment"><pre>00045 { +00046 string <a class="code" href="a04223.html#a658">value</a>; +00047 <span class="keywordflow">if</span> (CIXml::getPropertyString (value, xmlNode, propName)) +00048 { +00049 result = (<span class="keywordtype">float</span>)atof (<a class="code" href="a04223.html#a658">value</a>.c_str ()); +00050 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00051 } +00052 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00053 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="a1" doxytag="primitive_class.cpp::ReadInt" ></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"> bool ReadInt </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>propName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>int & </td> + <td class="mdname" nowrap> <em>result</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>xmlNodePtr </td> + <td class="mdname" nowrap> <em>xmlNode</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="a06201.html#l00057">57</a> of file <a class="el" href="a06201.html">primitive_class.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01132">value</a>. +<p> +Referenced by <a class="el" href="a06201.html#l00193">NLLIGO::CPrimitiveClass::read()</a>. +<p> +<div class="fragment"><pre>00058 { +00059 string <a class="code" href="a04223.html#a658">value</a>; +00060 <span class="keywordflow">if</span> (CIXml::getPropertyString (value, xmlNode, propName)) +00061 { +00062 result = atoi (<a class="code" href="a04223.html#a658">value</a>.c_str ()); +00063 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00064 } +00065 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00066 } +</pre></div> </td> + </tr> +</table> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:43:12 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> |