classgenericvalues.html
来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 689 行 · 第 1/3 页
HTML
689 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>GenericValues class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>GenericValues Class Reference</h1><code>#include <<a class="el" href="GenericValues_8h-source.html">GenericValues.h</a>></code><p>Inheritance diagram for GenericValues:<p><center><img src="classGenericValues__inherit__graph.gif" border="0" usemap="#GenericValues__inherit__map" alt="Inheritance graph"></center><map name="GenericValues__inherit__map"><area href="classPlayerSettings.html" shape="rect" coords="14,81,105,99" alt=""><area href="classServerSettings.html" shape="rect" coords="129,81,219,99" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for GenericValues:<p><center><img src="classGenericValues__coll__graph.gif" border="0" usemap="#GenericValues__coll__map" alt="Collaboration graph"></center><map name="GenericValues__coll__map"><area href="classGenericValueT.html" shape="rect" coords="14,14,107,33" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classGenericValues-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classGenericValues.html#a0">GenericValues</a> (char *strName, int iMaxValues)</td></tr><tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="classGenericValues.html#a1">~GenericValues</a> ()</td></tr><tr><td nowrap align=right valign=top>char * </td><td valign=bottom><a class="el" href="classGenericValues.html#a2">getClassName</a> ()</td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classGenericValues.html#a3">getValuesTotal</a> ()</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classGenericValues.html#a4">addSetting</a> (const char *strName, void *vAddress, <a class="el" href="GenericValues_8h.html#a4">GenericValueKind</a> t)</td></tr><tr><td nowrap align=right valign=top>virtual char * </td><td valign=bottom><a class="el" href="classGenericValues.html#a5">getValue</a> (const char *strName, char *strValue)</td></tr><tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classGenericValues.html#a6">setValue</a> (const char *strName, const char *strValue)</td></tr><tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classGenericValues.html#a7">readValues</a> (const char *strFile, const char *strSeparator=0)</td></tr><tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classGenericValues.html#a8">saveValues</a> (const char *strFile, const char *strSeparator=0, bool bAppend=true)</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classGenericValues.html#a9">show</a> (ostream &out, const char *strSeparator)</td></tr><tr><td colspan=2><br><h2>Private Methods</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classGenericValueT.html">GenericValueT</a> * </td><td valign=bottom><a class="el" href="classGenericValues.html#c0">getValuePtr</a> (const char *strName)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td nowrap align=right valign=top>char * </td><td valign=bottom><a class="el" href="classGenericValues.html#o0">m_strClassName</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classGenericValueT.html">GenericValueT</a> ** </td><td valign=bottom><a class="el" href="classGenericValues.html#o1">m_values</a></td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classGenericValues.html#o2">m_iValuesTotal</a></td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classGenericValues.html#o3">m_iMaxGenericValues</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class contains a collection of <a class="el" href="classGenericValueT.html">GenericValueT</a> objects. This makes it possible to reference variables using string names. The class is an abstract class which should not be instantiated. It is the subclass of this class which contains the actual variables. In order to add a reference to a variable the method 'addSetting' must be used which associates the variables in the subclass with string names. The GenericValues class is used to read in configuration files. This now becomes very easy as long as one makes sure that the names in the configuration file match the string names associated with the corresponding variables <p><p>Definition at line <a class="el" href="GenericValues_8h-source.html#l00113">113</a> of file <a class="el" href="GenericValues_8h-source.html">GenericValues.h</a>.<hr><h2>Constructor & Destructor Documentation</h2><a name="a0" doxytag="GenericValues::GenericValues"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> GenericValues::GenericValues </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname" nowrap> <em>strName</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>iMaxValues</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>Constructor for the GenericValues class. It creates a GenericValues object. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strName</em> </td><td>a string denoting the name associated with this group of generic values (this is usually the name of the subclass which contains the actual generic variables) </td></tr><tr><td valign=top><em>iMaxValues</em> </td><td>an integer denoting the number of generic values in the current collection, i.e. the maximum number that can be stored </td></tr></table></dl><p>Definition at line <a class="el" href="GenericValues_8C-source.html#l00217">217</a> of file <a class="el" href="GenericValues_8C-source.html">GenericValues.C</a>.<p>References <a class="el" href="GenericValues_8h-source.html#l00125">m_iMaxGenericValues</a>, <a class="el" href="GenericValues_8h-source.html#l00123">m_iValuesTotal</a>, <a class="el" href="GenericValues_8h-source.html#l00118">m_strClassName</a>, and <a class="el" href="GenericValues_8h-source.html#l00121">m_values</a>. </td> </tr></table><a name="a1" doxytag="GenericValues::~GenericValues"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> GenericValues::~GenericValues </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </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>Destructor for the GenericValues class. It destroys a GenericValues object by freeing all memory allocated to it. <p>Definition at line <a class="el" href="GenericValues_8C-source.html#l00232">232</a> of file <a class="el" href="GenericValues_8C-source.html">GenericValues.C</a>.<p>References <a class="el" href="GenericValues_8C-source.html#l00252">getValuesTotal</a>(), <a class="el" href="GenericValues_8h-source.html#l00118">m_strClassName</a>, and <a class="el" href="GenericValues_8h-source.html#l00121">m_values</a>. </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="a4" doxytag="GenericValues::addSetting"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool GenericValues::addSetting </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const char * </td> <td class="mdname" nowrap> <em>strName</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>void * </td> <td class="mdname" nowrap> <em>vAddress</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="GenericValues_8h.html#a4">GenericValueKind</a> </td> <td class="mdname" nowrap> <em>type</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>This method adds a new generic value to the collection and provides a connection between a string name and the variable name of the generic value. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strName</em> </td><td>a string denoting the name associated with the variable of the generic value which is added (the variable can be reached through this name) </td></tr><tr><td valign=top><em>vAddress</em> </td><td>a (void) pointer to the actual variable itself </td></tr><tr><td valign=top><em>type</em> </td><td>the (generic) type of the variable which is added </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>a boolean indicating whether the generic value has been succesfully added </dl><p>Definition at line <a class="el" href="GenericValues_8C-source.html#l00266">266</a> of file <a class="el" href="GenericValues_8C-source.html">GenericValues.C</a>.<p>References <a class="el" href="GenericValues_8h-source.html#l00053">GenericValueKind</a>, <a class="el" href="GenericValues_8C-source.html#l00294">getValuePtr</a>(), <a class="el" href="GenericValues_8h-source.html#l00125">m_iMaxGenericValues</a>, <a class="el" href="GenericValues_8h-source.html#l00123">m_iValuesTotal</a>, <a class="el" href="GenericValues_8h-source.html#l00118">m_strClassName</a>, and <a class="el" href="GenericValues_8h-source.html#l00121">m_values</a>.<p>Referenced by <a class="el" href="PlayerSettings_8C-source.html#l00053">PlayerSettings::PlayerSettings</a>(), and <a class="el" href="ServerSettings_8C-source.html#l00059">ServerSettings::ServerSettings</a>(). </td> </tr></table><a name="a2" doxytag="GenericValues::getClassName"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char * GenericValues::getClassName </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </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>Get method for the 'm_strClassName' member variable. <dl compact><dt><b>Returns: </b><dd>the name associated with this group of generic values (this is usually the name of the subclass which contains the actual variables) </dl><p>Definition at line <a class="el" href="GenericValues_8C-source.html#l00245">245</a> of file <a class="el" href="GenericValues_8C-source.html">GenericValues.C</a>. </td> </tr></table><a name="a5" doxytag="GenericValues::getValue"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char * GenericValues::getValue </td>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?