Click here to Skip to main content
15,895,799 members
Articles / Programming Languages / C#

An extensible math expression parser with plug-ins

Rate me:
Please Sign up or sign in to vote.
4.92/5 (147 votes)
13 Mar 2008CPOL51 min read 1.5M   29K   364  
Design and code for an extensible, maintainable, robust, and easy to use math parser.
<!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>MTParserLib: MTRegistrarI Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>MTRegistrarI Class Reference</h1><!-- doxytag: class="MTRegistrarI" --><!-- doxytag: inherits="MTRegistrarPublicI" --><code>#include &lt;<a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.h</a>&gt;</code>
<p>
<p>Inheritance diagram for MTRegistrarI:
<p><center><img src="classMTRegistrarI.png" usemap="#MTRegistrarI_map" border="0" alt=""></center>
<map name="MTRegistrarI_map">
<area href="classMTRegistrarPublicI.html" alt="MTRegistrarPublicI" shape="rect" coords="0,0,119,24">
<area href="classMTParserRegistrar.html" alt="MTParserRegistrar" shape="rect" coords="0,112,119,136">
</map>
<a href="classMTRegistrarI-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Private Registrar Interface. 
<p>
This is the whole registrar: client interface + interface services.
<p>

<p>
Definition at line <a class="el" href="MTParserPrivate_8h-source.html#l00099">99</a> of file <a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.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">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a0">setVarFactory</a> (<a class="el" href="classMTVariableFactoryI.html">MTVariableFactoryI</a> *pFactory)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the variable factory used to create variable object.  <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a1">defineVar</a> (const MTCHAR *symbol)=0  throw (MTParserException)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Use the variable factory to create a new variable object associated with this name.  <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a2">isVarDefined</a> (const MTCHAR *symbol) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether a variable is defined.  <a href="#a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a3">findOp</a> (const MTCHAR *symbol, bool unaryOp, unsigned int &amp;index) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find an operator with this symbol and this number of arguments.  <a href="#a3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a4">isAFunction</a> (const MTCHAR *word, unsigned int &amp;index) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether this name corresponds to a defined function.  <a href="#a4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a5">findFunction</a> (const MTCHAR *word, int nbArgs, unsigned int &amp;index) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find a function with this symbol and this number of arguments.  <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual std::vector&lt; <a class="el" href="classMTFunctionI.html">MTFunctionI</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a6">findFunctions</a> (const MTCHAR *symbol) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find all functions with this symbol.  <a href="#a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a7">findFunctionExact</a> (const MTCHAR *word, int nbArgs, unsigned int &amp;index) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find a function with this symbol and with this EXACT number of arguments.  <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a8">findConst</a> (const MTCHAR *constName, unsigned int &amp;index) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find a constant from its name.  <a href="#a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a9">areNextCharsOpString</a> (const MTCHAR *str, unsigned int strLength, MTSTRING &amp;symbol) const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Determine whether the string begins with an operator symbol.  <a href="#a9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classMTRegistrarI.html">MTRegistrarI</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a10">spawn</a> ()=0  throw (MTParserException)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new instance of itself.  <a href="#a10"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a11"></a><!-- doxytag: member="MTRegistrarI::~MTRegistrarI" ref="a11" args="()" -->
virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html#a11">~MTRegistrarI</a> ()</td></tr>

</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a9"></a><!-- doxytag: member="MTRegistrarI::areNextCharsOpString" ref="a9" args="(const MTCHAR *str, unsigned int strLength, MTSTRING &amp;symbol) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::areNextCharsOpString           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>str</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>strLength</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>MTSTRING &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>symbol</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Determine whether the string begins with an operator symbol. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>Source string </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>strLength</em>&nbsp;</td><td>Source string length. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>symbol</em>&nbsp;</td><td>[out] If the string begins with an operator symbol, this will be the symbol </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True is the string begins with an operator symbol</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a31">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a1"></a><!-- doxytag: member="MTRegistrarI::defineVar" ref="a1" args="(const MTCHAR *symbol)=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void MTRegistrarI::defineVar           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>symbol</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap>  throw (<a class="el" href="classMTChainedExceptions.html">MTParserException</a>)<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Use the variable factory to create a new variable object associated with this name. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>symbol,:</em>&nbsp;</td><td>variable symbol to define</td></tr>
  </table>
</dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a23">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a8"></a><!-- doxytag: member="MTRegistrarI::findConst" ref="a8" args="(const MTCHAR *constName, unsigned int &amp;index) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::findConst           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>constName</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find a constant from its name. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>constName</em>&nbsp;</td><td>Constant name </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>[out] If the constant is found, this will be the constant index </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True if the constant exists</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a30">MTParserRegistrar</a>.
<p>
Referenced by <a class="el" href="MTParserCompiler_8cpp-source.html#l00543">MTParserCompiler::parseWord()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a5"></a><!-- doxytag: member="MTRegistrarI::findFunction" ref="a5" args="(const MTCHAR *word, int nbArgs, unsigned int &amp;index) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::findFunction           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>word</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>nbArgs</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find a function with this symbol and this number of arguments. 
<p>
First try to find a function with this exact number of arguments. If there is a function with undefined number of args, then that function will be returned by default if no other overloaded function have nbArgs arguments.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>word</em>&nbsp;</td><td>Function name </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>nbArgs</em>&nbsp;</td><td>Function number of arguments </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>[out] If a function is found, this will be the function index </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True is the function exists</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a27">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a7"></a><!-- doxytag: member="MTRegistrarI::findFunctionExact" ref="a7" args="(const MTCHAR *word, int nbArgs, unsigned int &amp;index) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::findFunctionExact           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>word</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>nbArgs</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find a function with this symbol and with this EXACT number of arguments. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>word</em>&nbsp;</td><td>Function name </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>nbArgs</em>&nbsp;</td><td>Function number of arguments </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>[out] If a function is found, this will be the function index </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True is the function exists</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a29">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member="MTRegistrarI::findFunctions" ref="a6" args="(const MTCHAR *symbol) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual std::vector&lt;<a class="el" href="classMTFunctionI.html">MTFunctionI</a>*&gt; MTRegistrarI::findFunctions           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>symbol</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find all functions with this symbol. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>symbol</em>&nbsp;</td><td>Function symbol </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>all matching function objects</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a28">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a3"></a><!-- doxytag: member="MTRegistrarI::findOp" ref="a3" args="(const MTCHAR *symbol, bool unaryOp, unsigned int &amp;index) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::findOp           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>symbol</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>unaryOp</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find an operator with this symbol and this number of arguments. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>symbol</em>&nbsp;</td><td>Operator symbol </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>unaryOp</em>&nbsp;</td><td>Indicate if the operator must be a unaryOp </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>[out] If an operator is found, this will be the operator index </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True if the operator exists</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a25">MTParserRegistrar</a>.
<p>
Referenced by <a class="el" href="MTParserCompiler_8cpp-source.html#l01046">MTCompilerDefState::onOp()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a4"></a><!-- doxytag: member="MTRegistrarI::isAFunction" ref="a4" args="(const MTCHAR *word, unsigned int &amp;index) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::isAFunction           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname" nowrap> <em>word</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check whether this name corresponds to a defined function. 
<p>
There can be multiple functions with this name (overloaded functions). To find a specific function, use findFunction<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>word</em>&nbsp;</td><td>Function name </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>[out] If a function is found, this will be the function index </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True if the function exists</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a26">MTParserRegistrar</a>.
<p>
Referenced by <a class="el" href="MTParserCompiler_8cpp-source.html#l00543">MTParserCompiler::parseWord()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a2"></a><!-- doxytag: member="MTRegistrarI::isVarDefined" ref="a2" args="(const MTCHAR *symbol) const =0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool MTRegistrarI::isVarDefined           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const MTCHAR *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>symbol</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check whether a variable is defined. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>symbol</em>&nbsp;</td><td>Variable symbol </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>True if the variable is defined</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a24">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a0"></a><!-- doxytag: member="MTRegistrarI::setVarFactory" ref="a0" args="(MTVariableFactoryI *pFactory)=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void MTRegistrarI::setVarFactory           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classMTVariableFactoryI.html">MTVariableFactoryI</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>pFactory</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the variable factory used to create variable object. 
<p>
Allows automatic variable definition. The default factory creates variables with default values. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pFactory</em>&nbsp;</td><td>Variable factory object. This object will be automatically deleted at the end of the registrar life</td></tr>
  </table>
</dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a22">MTParserRegistrar</a>.
<p>
Referenced by <a class="el" href="MTParser_8cpp-source.html#l00218">MTParser::enableAutoVarDefinition()</a>, and <a class="el" href="MTParser_8cpp-source.html#l00019">MTParser::MTParser()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a10"></a><!-- doxytag: member="MTRegistrarI::spawn" ref="a10" args="()=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual <a class="el" href="classMTRegistrarI.html">MTRegistrarI</a>* MTRegistrarI::spawn           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap>  throw (<a class="el" href="classMTChainedExceptions.html">MTParserException</a>)<code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create a new instance of itself. 
<p>
This method is used to duplicate a parser object.<p>
<dl compact><dt><b>Returns:</b></dt><dd>A new independant object representing the same registrar object</dd></dl>

<p>
Implemented in <a class="el" href="classMTParserRegistrar.html#a32">MTParserRegistrar</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.h</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Sun Mar 9 17:39:37 2008 for MTParserLib by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
Software Engineer working at a fun and smart startup company

Comments and Discussions