<!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: MTParserPrivate.h Source File</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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<h1>MTParserPrivate.h</h1><a href="MTParserPrivate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/** @file MTParserPrivate.h</span>
<a name="l00002"></a>00002 <span class="comment"> @brief Internal declarations</span>
<a name="l00003"></a>00003 <span class="comment"> @author (c) 2008 Mathieu Jacques</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> Put the implementation in this file (if needed) in order to avoid to</span>
<a name="l00006"></a>00006 <span class="comment"> have to use a .cpp file. Clients of this file (like plug-ins) should</span>
<a name="l00007"></a>00007 <span class="comment"> not have to link with the library only to use basic services.</span>
<a name="l00008"></a>00008 <span class="comment">*/</span>
<a name="l00009"></a>00009
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef _MTPARSERPRIVATE_INCLUDED</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define _MTPARSERPRIVATE_INCLUDED</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="MTParserPublic_8h.html">MTParserPublic.h</a>"</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="MTParserExcepStrEng_8h.html">MTParserExcepStrEng.h</a>"</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include <windows.h></span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="comment"></span>
<a name="l00018"></a>00018 <span class="comment">/** @brief Throw a first exception without parent exception</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment"> This macro puts the line number, the source file and a default description.</span>
<a name="l00021"></a>00021 <span class="comment"> </span>
<a name="l00022"></a>00022 <span class="comment"> @param data The data exception</span>
<a name="l00023"></a>00023 <span class="comment">*/</span>
<a name="l00024"></a><a class="code" href="MTParserPrivate_8h.html#a0">00024</a> <span class="preprocessor">#define MTTHROW(</span><span class="comment">/*MTExcepData */</span> data ) \
<a name="l00025"></a>00025 { \
<a name="l00026"></a>00026 MTSTRING desc = MTParserExcepStrEng::format(data); \
<a name="l00027"></a>00027 throw( MTChainedExceptions<MTExcepData>( __LINE__, _T(__FILE__), \
<a name="l00028"></a>00028 0, data, desc.c_str()) ); \
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">/** @brief Throw an exception with its parent exceptions</span>
<a name="l00032"></a>00032 <span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment"> This macro puts the line number, the source file and a default description.</span>
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment"> @param data The exception date to add to the chain</span>
<a name="l00036"></a>00036 <span class="comment"> @param e The parent exception</span>
<a name="l00037"></a>00037 <span class="comment">*/</span>
<a name="l00038"></a><a class="code" href="MTParserPrivate_8h.html#a1">00038</a> <span class="preprocessor">#define MTRETHROW(</span><span class="comment">/*MTExcepData */</span> data, <span class="comment">/*parent MTChainedExceptions*/</span> e) \
<a name="l00039"></a>00039 { \
<a name="l00040"></a>00040 MTSTRING desc = MTParserExcepStrEng::format(data); \
<a name="l00041"></a>00041 e.add(__LINE__, _T(__FILE__), 0, data, desc.c_str()); throw(e); \
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043
<a name="l00044"></a>00044
<a name="l00045"></a>00045 <span class="comment">/* @brief Structure that contains information about an expression item</span>
<a name="l00046"></a>00046 <span class="comment"></span>
<a name="l00047"></a>00047 <span class="comment"> This structure is filled during the expression compilation and used by</span>
<a name="l00048"></a>00048 <span class="comment"> the evaluator. So, this is a common structure between the compiler and the evaluator.</span>
<a name="l00049"></a>00049 <span class="comment">*/</span>
<a name="l00050"></a><a class="code" href="structSItemInfo.html">00050</a> <span class="keyword">struct </span><a class="code" href="structSItemInfo.html">SItemInfo</a>
<a name="l00051"></a>00051 {
<a name="l00052"></a><a class="code" href="structSItemInfo.html#o0">00052</a> <a class="code" href="classMTParserItemI.html">MTParserItemI</a> *<a class="code" href="structSItemInfo.html#o0">pEval</a>; <span class="comment">// item </span>
<a name="l00053"></a>00053
<a name="l00054"></a><a class="code" href="structSItemInfo.html#o1">00054</a> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> <a class="code" href="structSItemInfo.html#o1">val</a>; <span class="comment">// if evaluated, the cached result</span>
<a name="l00055"></a>00055
<a name="l00056"></a><a class="code" href="structSItemInfo.html#o2">00056</a> <span class="keywordtype">bool</span> <a class="code" href="structSItemInfo.html#o2">isEvaluated</a>; <span class="comment">// indicate whether this item has already been evaluated</span>
<a name="l00057"></a>00057 <span class="comment">// if yes, then no need to evaluate it: just take the</span>
<a name="l00058"></a>00058 <span class="comment">// cached value</span>
<a name="l00059"></a>00059
<a name="l00060"></a>00060
<a name="l00061"></a><a class="code" href="structSItemInfo.html#o3">00061</a> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> *<a class="code" href="structSItemInfo.html#o3">pArg</a>; <span class="comment">// argument buffer</span>
<a name="l00062"></a><a class="code" href="structSItemInfo.html#o4">00062</a> <span class="keywordtype">int</span> <a class="code" href="structSItemInfo.html#o4">nbArgs</a>; <span class="comment">// number of arguments</span>
<a name="l00063"></a>00063
<a name="l00064"></a><a class="code" href="structSItemInfo.html#o5">00064</a> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> *<a class="code" href="structSItemInfo.html#o5">pParentItemArg</a>; <span class="comment">// pointer to the "parent" item argument that need the value</span>
<a name="l00065"></a>00065 <span class="comment">// of this item to compute its value</span>
<a name="l00066"></a>00066
<a name="l00067"></a><a class="code" href="structSItemInfo.html#o6">00067</a> <span class="keywordtype">bool</span> <a class="code" href="structSItemInfo.html#o6">canDelete</a>; <span class="comment">// indicate whether the object pointed by pEval must be deleted after use</span>
<a name="l00068"></a>00068
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <span class="comment">//****************************</span>
<a name="l00071"></a>00071 <span class="comment">// variables used only during the validation step </span>
<a name="l00072"></a>00072
<a name="l00073"></a><a class="code" href="structSItemInfo.html#o7">00073</a> <span class="keywordtype">int</span> <a class="code" href="structSItemInfo.html#o7">exprStrPos</a>; <span class="comment">// for information purpose, the position of this item</span>
<a name="l00074"></a>00074 <span class="comment">// in the expression string</span>
<a name="l00075"></a>00075
<a name="l00076"></a><a class="code" href="structSItemInfo.html#o8">00076</a> <span class="keywordtype">bool</span> <a class="code" href="structSItemInfo.html#o8">ignore</a>;
<a name="l00077"></a>00077
<a name="l00078"></a>00078 <span class="comment">//**************************** </span>
<a name="l00079"></a>00079
<a name="l00080"></a><a class="code" href="structSItemInfo.html#a0">00080</a> <a class="code" href="structSItemInfo.html#a0">SItemInfo</a>()
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082 <a class="code" href="structSItemInfo.html#o2">isEvaluated</a> = <span class="keyword">false</span>;
<a name="l00083"></a>00083 <a class="code" href="structSItemInfo.html#o0">pEval</a> = NULL;
<a name="l00084"></a>00084 <a class="code" href="structSItemInfo.html#o3">pArg</a> = NULL;
<a name="l00085"></a>00085 <a class="code" href="structSItemInfo.html#o4">nbArgs</a> = 0;
<a name="l00086"></a>00086 <a class="code" href="structSItemInfo.html#o5">pParentItemArg</a> = NULL;
<a name="l00087"></a>00087 <a class="code" href="structSItemInfo.html#o6">canDelete</a> = <span class="keyword">false</span>;
<a name="l00088"></a>00088 <a class="code" href="structSItemInfo.html#o8">ignore</a> = <span class="keyword">false</span>;
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090 };
<a name="l00091"></a>00091
<a name="l00092"></a><a class="code" href="MTParserPrivate_8h.html#a2">00092</a> <span class="keyword">typedef</span> std::vector<SItemInfo> <a class="code" href="MTParserPrivate_8h.html#a2">ItemInfoStack</a>;
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="comment"></span>
<a name="l00095"></a>00095 <span class="comment">/** @brief Private Registrar Interface</span>
<a name="l00096"></a>00096 <span class="comment"></span>
<a name="l00097"></a>00097 <span class="comment"> This is the whole registrar: client interface + interface services.</span>
<a name="l00098"></a>00098 <span class="comment">*/</span>
<a name="l00099"></a><a class="code" href="classMTRegistrarI.html">00099</a> <span class="keyword">class </span><a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> : <span class="keyword">public</span> <a class="code" href="classMTRegistrarPublicI.html">MTRegistrarPublicI</a>
<a name="l00100"></a>00100 {
<a name="l00101"></a>00101 <span class="keyword">public</span>:
<a name="l00102"></a>00102
<a name="l00103"></a>00103 <span class="comment"></span>
<a name="l00104"></a>00104 <span class="comment"> /** @brief Set the variable factory used to create variable object </span>
<a name="l00105"></a>00105 <span class="comment"> </span>
<a name="l00106"></a>00106 <span class="comment"> Allows automatic variable definition. The default factory creates variables with default values.</span>
<a name="l00107"></a>00107 <span class="comment"> @param pFactory Variable factory object. This object will be automatically</span>
<a name="l00108"></a>00108 <span class="comment"> deleted at the end of the registrar life</span>
<a name="l00109"></a>00109 <span class="comment"> */</span>
<a name="l00110"></a>00110 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTRegistrarI.html#a0">setVarFactory</a>(<a class="code" href="classMTVariableFactoryI.html">MTVariableFactoryI</a> *pFactory) = 0;
<a name="l00111"></a>00111 <span class="comment"></span>
<a name="l00112"></a>00112 <span class="comment"> /** @brief Use the variable factory to create a new variable object associated with this name</span>
<a name="l00113"></a>00113 <span class="comment"> @param symbol: variable symbol to define </span>
<a name="l00114"></a>00114 <span class="comment"> */</span>
<a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTRegistrarI.html#a1">defineVar</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *symbol) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00116"></a>00116 <span class="comment"></span>
<a name="l00117"></a>00117 <span class="comment"> /** @brief Check whether a variable is defined</span>
<a name="l00118"></a>00118 <span class="comment"> @param symbol Variable symbol</span>
<a name="l00119"></a>00119 <span class="comment"> @return True if the variable is defined</span>
<a name="l00120"></a>00120 <span class="comment"> */</span>
<a name="l00121"></a>00121 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a2">isVarDefined</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *symbol)<span class="keyword">const </span>= 0;
<a name="l00122"></a>00122
<a name="l00123"></a>00123 <span class="comment"></span>
<a name="l00124"></a>00124 <span class="comment"> /** @brief Find an operator with this symbol and this number of arguments</span>
<a name="l00125"></a>00125 <span class="comment"> @param symbol Operator symbol</span>
<a name="l00126"></a>00126 <span class="comment"> @param unaryOp Indicate if the operator must be a unaryOp</span>
<a name="l00127"></a>00127 <span class="comment"> @param index [out] If an operator is found, this will be the operator index</span>
<a name="l00128"></a>00128 <span class="comment"> @return True if the operator exists</span>
<a name="l00129"></a>00129 <span class="comment"> */</span>
<a name="l00130"></a>00130 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a3">findOp</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *symbol, <span class="keywordtype">bool</span> unaryOp, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &index)<span class="keyword">const </span>= 0;
<a name="l00131"></a>00131 <span class="comment"></span>
<a name="l00132"></a>00132 <span class="comment"> /** @brief Check whether this name corresponds to a defined function</span>
<a name="l00133"></a>00133 <span class="comment"> </span>
<a name="l00134"></a>00134 <span class="comment"> There can be multiple functions with this name (overloaded functions).</span>
<a name="l00135"></a>00135 <span class="comment"> To find a specific function, use findFunction</span>
<a name="l00136"></a>00136 <span class="comment"> </span>
<a name="l00137"></a>00137 <span class="comment"> @param word Function name</span>
<a name="l00138"></a>00138 <span class="comment"> @param index [out] If a function is found, this will be the function index</span>
<a name="l00139"></a>00139 <span class="comment"> @return True if the function exists</span>
<a name="l00140"></a>00140 <span class="comment"> */</span>
<a name="l00141"></a>00141 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a4">isAFunction</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *word, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &index)<span class="keyword">const </span>= 0;
<a name="l00142"></a>00142 <span class="comment"></span>
<a name="l00143"></a>00143 <span class="comment"> /** @brief Find a function with this symbol and this number of arguments</span>
<a name="l00144"></a>00144 <span class="comment"></span>
<a name="l00145"></a>00145 <span class="comment"> First try to find a function with this exact number of arguments. If there is</span>
<a name="l00146"></a>00146 <span class="comment"> a function with undefined number of args, then that function will be returned</span>
<a name="l00147"></a>00147 <span class="comment"> by default if no other overloaded function have nbArgs arguments.</span>
<a name="l00148"></a>00148 <span class="comment"></span>
<a name="l00149"></a>00149 <span class="comment"> @param word Function name</span>
<a name="l00150"></a>00150 <span class="comment"> @param nbArgs Function number of arguments</span>
<a name="l00151"></a>00151 <span class="comment"> @param index [out] If a function is found, this will be the function index</span>
<a name="l00152"></a>00152 <span class="comment"> @return True is the function exists</span>
<a name="l00153"></a>00153 <span class="comment"> */</span>
<a name="l00154"></a>00154 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a5">findFunction</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *word, <span class="keywordtype">int</span> nbArgs, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &index)<span class="keyword">const </span>= 0;
<a name="l00155"></a>00155 <span class="comment"></span>
<a name="l00156"></a>00156 <span class="comment"> /** @brief Find all functions with this symbol</span>
<a name="l00157"></a>00157 <span class="comment"></span>
<a name="l00158"></a>00158 <span class="comment"> @param symbol Function symbol</span>
<a name="l00159"></a>00159 <span class="comment"> @return all matching function objects</span>
<a name="l00160"></a>00160 <span class="comment"> */</span>
<a name="l00161"></a>00161 <span class="keyword">virtual</span> std::vector<MTFunctionI*> <a class="code" href="classMTRegistrarI.html#a6">findFunctions</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *symbol)<span class="keyword">const </span>= 0;
<a name="l00162"></a>00162 <span class="comment"></span>
<a name="l00163"></a>00163 <span class="comment"> /** @brief Find a function with this symbol and with this EXACT number of arguments</span>
<a name="l00164"></a>00164 <span class="comment"> @param word Function name</span>
<a name="l00165"></a>00165 <span class="comment"> @param nbArgs Function number of arguments</span>
<a name="l00166"></a>00166 <span class="comment"> @param index [out] If a function is found, this will be the function index</span>
<a name="l00167"></a>00167 <span class="comment"> @return True is the function exists</span>
<a name="l00168"></a>00168 <span class="comment"> */</span>
<a name="l00169"></a>00169 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a7">findFunctionExact</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *word, <span class="keywordtype">int</span> nbArgs, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &index)<span class="keyword">const </span>= 0;
<a name="l00170"></a>00170 <span class="comment"></span>
<a name="l00171"></a>00171 <span class="comment"> /** @brief Find a constant from its name</span>
<a name="l00172"></a>00172 <span class="comment"> @param constName Constant name</span>
<a name="l00173"></a>00173 <span class="comment"> @param index [out] If the constant is found, this will be the constant index</span>
<a name="l00174"></a>00174 <span class="comment"> @return True if the constant exists</span>
<a name="l00175"></a>00175 <span class="comment"> */</span>
<a name="l00176"></a>00176 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a8">findConst</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *constName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &index)<span class="keyword">const </span>= 0;
<a name="l00177"></a>00177 <span class="comment"></span>
<a name="l00178"></a>00178 <span class="comment"> /** @brief Determine whether the string begins with an operator symbol</span>
<a name="l00179"></a>00179 <span class="comment"></span>
<a name="l00180"></a>00180 <span class="comment"> @param str Source string</span>
<a name="l00181"></a>00181 <span class="comment"> @param strLength Source string length. </span>
<a name="l00182"></a>00182 <span class="comment"> @param symbol [out] If the string begins with an operator symbol, this will</span>
<a name="l00183"></a>00183 <span class="comment"> be the symbol</span>
<a name="l00184"></a>00184 <span class="comment"> @return True is the string begins with an operator symbol</span>
<a name="l00185"></a>00185 <span class="comment"> */</span>
<a name="l00186"></a>00186 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTRegistrarI.html#a9">areNextCharsOpString</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *str, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> strLength, <a class="code" href="MTUnicodeANSIDefs_8h.html#a0">MTSTRING</a> &symbol)<span class="keyword">const </span>= 0;
<a name="l00187"></a>00187 <span class="comment"></span>
<a name="l00188"></a>00188 <span class="comment"> /** @brief Create a new instance of itself</span>
<a name="l00189"></a>00189 <span class="comment"></span>
<a name="l00190"></a>00190 <span class="comment"> This method is used to duplicate a parser object.</span>
<a name="l00191"></a>00191 <span class="comment"></span>
<a name="l00192"></a>00192 <span class="comment"> @return A new independant object representing the same registrar object</span>
<a name="l00193"></a>00193 <span class="comment"> */</span>
<a name="l00194"></a>00194 <span class="keyword">virtual</span> <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a>* <a class="code" href="classMTRegistrarI.html#a10">spawn</a>() <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00195"></a>00195
<a name="l00196"></a><a class="code" href="classMTRegistrarI.html#a11">00196</a> <span class="keyword">virtual</span> <a class="code" href="classMTRegistrarI.html#a11">~MTRegistrarI</a>(){};
<a name="l00197"></a>00197
<a name="l00198"></a>00198 };
<a name="l00199"></a>00199 <span class="comment"></span>
<a name="l00200"></a>00200 <span class="comment">/** @brief Private Compiler interface</span>
<a name="l00201"></a>00201 <span class="comment">*/</span>
<a name="l00202"></a><a class="code" href="classMTCompilerI.html">00202</a> <span class="keyword">class </span><a class="code" href="classMTCompilerI.html">MTCompilerI</a> : <span class="keyword">public</span> <a class="code" href="classMTCompilerPublicI.html">MTCompilerPublicI</a>
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204 <span class="keyword">public</span>:
<a name="l00205"></a>00205 <span class="comment"></span>
<a name="l00206"></a>00206 <span class="comment"> /** @brief Enable or disable the automatic variable definition feature</span>
<a name="l00207"></a>00207 <span class="comment"></span>
<a name="l00208"></a>00208 <span class="comment"> The automatic variable definition feature avoid having to define all variables</span>
<a name="l00209"></a>00209 <span class="comment"> upfront. </span>
<a name="l00210"></a>00210 <span class="comment"></span>
<a name="l00211"></a>00211 <span class="comment"> @param enable True = Enabled, False = Disabled</span>
<a name="l00212"></a>00212 <span class="comment"> */</span>
<a name="l00213"></a>00213 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#a0">enableAutoVarDefinition</a>(<span class="keywordtype">bool</span> enable) = 0;
<a name="l00214"></a>00214 <span class="comment"></span>
<a name="l00215"></a>00215 <span class="comment"> /** @brief Variable redefined event </span>
<a name="l00216"></a>00216 <span class="comment"></span>
<a name="l00217"></a>00217 <span class="comment"> A variable has been replaced, so we must replace its object.</span>
<a name="l00218"></a>00218 <span class="comment"></span>
<a name="l00219"></a>00219 <span class="comment"> The expression is not resetted.</span>
<a name="l00220"></a>00220 <span class="comment"></span>
<a name="l00221"></a>00221 <span class="comment"> @param pVar The new variable object. It will be deleted after use.</span>
<a name="l00222"></a>00222 <span class="comment"> */</span>
<a name="l00223"></a>00223 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#a1">onVarRedefined</a>(<a class="code" href="classMTVariableI.html">MTVariableI</a> *pVar) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00224"></a>00224 <span class="comment"></span>
<a name="l00225"></a>00225 <span class="comment"> /** @brief Get the item stack </span>
<a name="l00226"></a>00226 <span class="comment"></span>
<a name="l00227"></a>00227 <span class="comment"> Contains the compiled expression, ready to be evaluated</span>
<a name="l00228"></a>00228 <span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment"> @return The item stack</span>
<a name="l00230"></a>00230 <span class="comment"> */</span>
<a name="l00231"></a>00231 <span class="keyword">virtual</span> <a class="code" href="MTParserPrivate_8h.html#a2">ItemInfoStack</a>* <a class="code" href="classMTCompilerI.html#a2">getItemStack</a>() = 0;
<a name="l00232"></a>00232 <span class="comment"></span>
<a name="l00233"></a>00233 <span class="comment"> /** @brief Set the parent compiler to allow chained behaviours</span>
<a name="l00234"></a>00234 <span class="comment"> </span>
<a name="l00235"></a>00235 <span class="comment"> @param pParent The parent compiler. This object must exist as long as</span>
<a name="l00236"></a>00236 <span class="comment"> the child exists. This is an hard agregate relation.</span>
<a name="l00237"></a>00237 <span class="comment"> */</span>
<a name="l00238"></a>00238 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#a3">setParent</a>( <a class="code" href="classMTCompilerI.html">MTCompilerI</a> *pParent ) = 0;
<a name="l00239"></a>00239 <span class="comment"></span>
<a name="l00240"></a>00240 <span class="comment">/** @name Compiler state services</span>
<a name="l00241"></a>00241 <span class="comment">* </span>
<a name="l00242"></a>00242 <span class="comment">*/</span><span class="comment"></span>
<a name="l00243"></a>00243 <span class="comment"> //@{</span>
<a name="l00244"></a>00244 <span class="comment"></span><span class="comment"></span>
<a name="l00245"></a>00245 <span class="comment"> /** @brief Add the current character to the current word */</span>
<a name="l00246"></a>00246 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>() = 0;
<a name="l00247"></a>00247 <span class="comment"></span>
<a name="l00248"></a>00248 <span class="comment"> /** @brief Clear the curWord value */</span>
<a name="l00249"></a>00249 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_1">clearCurWord</a>() = 0;
<a name="l00250"></a>00250 <span class="comment"></span>
<a name="l00251"></a>00251 <span class="comment"> /** @brief Get the current word */</span>
<a name="l00252"></a>00252 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a>* <a class="code" href="classMTCompilerI.html#z10_2">getCurWord</a>() = 0;
<a name="l00253"></a>00253 <span class="comment"></span>
<a name="l00254"></a>00254 <span class="comment"> /** @brief Get the current parsing position in the math formula*/</span>
<a name="l00255"></a>00255 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classMTCompilerI.html#z10_3">getCurPos</a>() = 0;
<a name="l00256"></a>00256 <span class="comment"></span>
<a name="l00257"></a>00257 <span class="comment"> /** @brief Push a value item on the stack</span>
<a name="l00258"></a>00258 <span class="comment"> @param val The value to be pushed</span>
<a name="l00259"></a>00259 <span class="comment"> */</span>
<a name="l00260"></a>00260 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_4">pushValue</a>(<span class="keyword">const</span> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> &val) = 0;
<a name="l00261"></a>00261 <span class="comment"></span>
<a name="l00262"></a>00262 <span class="comment"> /** @brief Get the variable evaluator (stub) object associated with this variable</span>
<a name="l00263"></a>00263 <span class="comment"></span>
<a name="l00264"></a>00264 <span class="comment"> This object must be used instead of the registrar variable object. The stub</span>
<a name="l00265"></a>00265 <span class="comment"> doesn't call the evaluate method of the variable but returns a cached value. </span>
<a name="l00266"></a>00266 <span class="comment"></span>
<a name="l00267"></a>00267 <span class="comment"> @param symbol The variable symbol</span>
<a name="l00268"></a>00268 <span class="comment"> @return The variable stub</span>
<a name="l00269"></a>00269 <span class="comment"> */</span>
<a name="l00270"></a>00270 <span class="keyword">virtual</span> <a class="code" href="classMTVariableI.html">MTVariableI</a>* <a class="code" href="classMTCompilerI.html#z10_5">getVar</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *symbol) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>)= 0;
<a name="l00271"></a>00271 <span class="comment"></span>
<a name="l00272"></a>00272 <span class="comment"> /** @brief Push a variable item on the stack</span>
<a name="l00273"></a>00273 <span class="comment"> @param varName The variable name to be pushed</span>
<a name="l00274"></a>00274 <span class="comment"> */</span>
<a name="l00275"></a>00275 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_6">pushVariable</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *varName) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00276"></a>00276 <span class="comment"></span>
<a name="l00277"></a>00277 <span class="comment"> /** @brief Push a function item on the stack</span>
<a name="l00278"></a>00278 <span class="comment"> </span>
<a name="l00279"></a>00279 <span class="comment"> The function arguments must have been pushed before.</span>
<a name="l00280"></a>00280 <span class="comment"></span>
<a name="l00281"></a>00281 <span class="comment"> @param funcName The function name</span>
<a name="l00282"></a>00282 <span class="comment"> @param nbArgs The number of arguments actually used by the function. May be</span>
<a name="l00283"></a>00283 <span class="comment"> different from the function definition. For example, if the</span>
<a name="l00284"></a>00284 <span class="comment"> function takes an undefined number of arguments.</span>
<a name="l00285"></a>00285 <span class="comment"> */</span>
<a name="l00286"></a>00286 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_7">pushFunction</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *funcName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nbArgs) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00287"></a>00287 <span class="comment"></span>
<a name="l00288"></a>00288 <span class="comment"> /** @brief Push this function instance on the stack</span>
<a name="l00289"></a>00289 <span class="comment"> </span>
<a name="l00290"></a>00290 <span class="comment"> This object will be pushed on the stack. The compiler own the object and will delete</span>
<a name="l00291"></a>00291 <span class="comment"> it when necessary. The function arguments must have been pushed before.</span>
<a name="l00292"></a>00292 <span class="comment"></span>
<a name="l00293"></a>00293 <span class="comment"> @param pFunc The function instance</span>
<a name="l00294"></a>00294 <span class="comment"> @param nbArgs The number of arguments actually used by the function. May be</span>
<a name="l00295"></a>00295 <span class="comment"> different from the function definition. For example, if the</span>
<a name="l00296"></a>00296 <span class="comment"> function takes an undefined number of arguments.</span>
<a name="l00297"></a>00297 <span class="comment"> */</span>
<a name="l00298"></a>00298 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_7">pushFunction</a>(<a class="code" href="classMTFunctionI.html">MTFunctionI</a> *pFunc, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nbArgs) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00299"></a>00299 <span class="comment"></span>
<a name="l00300"></a>00300 <span class="comment"> /** @brief Compile a function argument and push it on the stack</span>
<a name="l00301"></a>00301 <span class="comment"></span>
<a name="l00302"></a>00302 <span class="comment"> @param arg The argument. This can be any expression.</span>
<a name="l00303"></a>00303 <span class="comment"> */</span>
<a name="l00304"></a>00304 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_9">pushFuncArg</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *arg) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00305"></a>00305 <span class="comment"></span>
<a name="l00306"></a>00306 <span class="comment"> /** @brief Exit of the current compiler state</span>
<a name="l00307"></a>00307 <span class="comment"> </span>
<a name="l00308"></a>00308 <span class="comment"> Tell to the compiler that the current compiler state</span>
<a name="l00309"></a>00309 <span class="comment"> execution is finished.</span>
<a name="l00310"></a>00310 <span class="comment"> */</span>
<a name="l00311"></a>00311 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_10">exitState</a>() = 0;
<a name="l00312"></a>00312 <span class="comment"></span>
<a name="l00313"></a>00313 <span class="comment"> /** @brief Throw a parsing exception */</span>
<a name="l00314"></a>00314 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> * <span class="keywordtype">id</span>, <span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *itemName)<span class="keyword">const</span> <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00315"></a>00315 <span class="comment"></span>
<a name="l00316"></a>00316 <span class="comment"> /** @brief Throw a parsing exception */</span>
<a name="l00317"></a>00317 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> * <span class="keywordtype">id</span>, <span class="keywordtype">int</span> pos)<span class="keyword">const</span> <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00318"></a>00318 <span class="comment"></span>
<a name="l00319"></a>00319 <span class="comment"> /** @brief Throw a parsing exception */</span>
<a name="l00320"></a>00320 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> * <span class="keywordtype">id</span>, <span class="keywordtype">int</span> pos, <span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *itemName)<span class="keyword">const</span> <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00321"></a>00321 <span class="comment"></span>
<a name="l00322"></a>00322 <span class="comment"> /** @brief Throw a parsing exception */</span>
<a name="l00323"></a>00323 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> * <span class="keywordtype">id</span>, <span class="keywordtype">int</span> pos, <span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> *itemName, <span class="keywordtype">int</span> param)<span class="keyword">const</span> <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00324"></a>00324
<a name="l00325"></a>00325 <span class="comment"></span>
<a name="l00326"></a>00326 <span class="comment"> //@}</span>
<a name="l00327"></a>00327 <span class="comment"></span><span class="comment"></span>
<a name="l00328"></a>00328 <span class="comment"> /** @brief Create a new instance of itself</span>
<a name="l00329"></a>00329 <span class="comment"></span>
<a name="l00330"></a>00330 <span class="comment"> This method is used to duplicate a parser object.</span>
<a name="l00331"></a>00331 <span class="comment"></span>
<a name="l00332"></a>00332 <span class="comment"> @return A new independant object representing the same compiler object</span>
<a name="l00333"></a>00333 <span class="comment"> */</span>
<a name="l00334"></a>00334 <span class="keyword">virtual</span> <a class="code" href="classMTCompilerI.html">MTCompilerI</a>* <a class="code" href="classMTCompilerI.html#a4">spawn</a>(<span class="keyword">class</span> <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *pRegistrar) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00335"></a>00335
<a name="l00336"></a><a class="code" href="classMTCompilerI.html#a5">00336</a> <span class="keyword">virtual</span> <a class="code" href="classMTCompilerI.html#a5">~MTCompilerI</a>(){};
<a name="l00337"></a>00337
<a name="l00338"></a>00338 };
<a name="l00339"></a>00339 <span class="comment"></span>
<a name="l00340"></a>00340 <span class="comment">/** @brief Compiler state Interface </span>
<a name="l00341"></a>00341 <span class="comment"> </span>
<a name="l00342"></a>00342 <span class="comment"> Allows the customization of the main compiler. This could be used</span>
<a name="l00343"></a>00343 <span class="comment"> to define functions needing a special syntax.</span>
<a name="l00344"></a>00344 <span class="comment">*/</span>
<a name="l00345"></a><a class="code" href="classMTCompilerStateI.html">00345</a> <span class="keyword">class </span><a class="code" href="classMTCompilerStateI.html">MTCompilerStateI</a>
<a name="l00346"></a>00346 {
<a name="l00347"></a>00347 <span class="keyword">public</span>:
<a name="l00348"></a>00348
<a name="l00349"></a><a class="code" href="classMTCompilerStateI.html#a0">00349</a> <a class="code" href="classMTCompilerStateI.html#a0">MTCompilerStateI</a>(){ <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a> = NULL; <a class="code" href="classMTCompilerStateI.html#p1">m_pRegistrar</a> = NULL; }
<a name="l00350"></a>00350 <span class="comment"></span>
<a name="l00351"></a>00351 <span class="comment"> /** @brief Called when entering the state */</span>
<a name="l00352"></a><a class="code" href="classMTCompilerStateI.html#a1">00352</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#a1">enter</a>(<a class="code" href="classMTCompilerI.html">MTCompilerI</a> *pCompiler, <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *pRegistrar)
<a name="l00353"></a>00353 {
<a name="l00354"></a>00354 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a> = pCompiler;
<a name="l00355"></a>00355 <a class="code" href="classMTCompilerStateI.html#p1">m_pRegistrar</a> = pRegistrar;
<a name="l00356"></a>00356 }
<a name="l00357"></a>00357 <span class="comment"></span>
<a name="l00358"></a>00358 <span class="comment"> /** @brief Called when the end of the math formula is reached */</span>
<a name="l00359"></a><a class="code" href="classMTCompilerStateI.html#a2">00359</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#a2">onEndOfFormula</a>(){};
<a name="l00360"></a>00360 <span class="comment"></span>
<a name="l00361"></a>00361 <span class="comment"> /** @brief Compile a character</span>
<a name="l00362"></a>00362 <span class="comment"></span>
<a name="l00363"></a>00363 <span class="comment"> This allows a by character compilation. If you compile a character the default</span>
<a name="l00364"></a>00364 <span class="comment"> parser will not process it and consequently, the event callbacks will not be called.</span>
<a name="l00365"></a>00365 <span class="comment"></span>
<a name="l00366"></a>00366 <span class="comment"> @param c The current character to compile</span>
<a name="l00367"></a>00367 <span class="comment"> @return true if the character has been compiled</span>
<a name="l00368"></a>00368 <span class="comment"> */</span>
<a name="l00369"></a><a class="code" href="classMTCompilerStateI.html#a3">00369</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMTCompilerStateI.html#a3">compileChar</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a1">MTCHAR</a> &c){ <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00370"></a>00370 <span class="comment"></span>
<a name="l00371"></a>00371 <span class="comment">/** @name Token Events</span>
<a name="l00372"></a>00372 <span class="comment">* Multiple parser event callbacks.</span>
<a name="l00373"></a>00373 <span class="comment">*/</span><span class="comment"></span>
<a name="l00374"></a>00374 <span class="comment"> //@{</span>
<a name="l00375"></a>00375 <span class="comment"></span> <span class="comment"></span>
<a name="l00376"></a>00376 <span class="comment"> /** @brief Called when an operator is detected </span>
<a name="l00377"></a>00377 <span class="comment"> @param opSymbol The detected operator symbol</span>
<a name="l00378"></a>00378 <span class="comment"> */</span>
<a name="l00379"></a><a class="code" href="classMTCompilerStateI.html#z11_0">00379</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#z11_0">onOp</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a0">MTSTRING</a> &opSymbol){ <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>(); }
<a name="l00380"></a>00380 <span class="comment"></span>
<a name="l00381"></a>00381 <span class="comment"> /** @brief Called when an open bracket is detected */</span>
<a name="l00382"></a><a class="code" href="classMTCompilerStateI.html#z11_1">00382</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#z11_1">onOpenBracket</a>(){ <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>(); }
<a name="l00383"></a>00383 <span class="comment"></span>
<a name="l00384"></a>00384 <span class="comment"> /** @brief Called when a close bracket is detected */</span>
<a name="l00385"></a><a class="code" href="classMTCompilerStateI.html#z11_2">00385</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#z11_2">onCloseBracket</a>(){ <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>(); }
<a name="l00386"></a>00386 <span class="comment"></span>
<a name="l00387"></a>00387 <span class="comment"> /** @brief Called when an argument separator is detected */</span>
<a name="l00388"></a><a class="code" href="classMTCompilerStateI.html#z11_3">00388</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTCompilerStateI.html#z11_3">onArgSeparator</a>(){ <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>(); }
<a name="l00389"></a>00389 <span class="comment"></span>
<a name="l00390"></a>00390 <span class="comment"> //@}</span>
<a name="l00391"></a>00391 <span class="comment"></span>
<a name="l00392"></a><a class="code" href="classMTCompilerStateI.html#a4">00392</a> <span class="keyword">virtual</span> <a class="code" href="classMTCompilerStateI.html#a4">~MTCompilerStateI</a>(){};
<a name="l00393"></a>00393
<a name="l00394"></a>00394 <span class="keyword">protected</span>:
<a name="l00395"></a>00395
<a name="l00396"></a>00396 <a class="code" href="classMTCompilerI.html">MTCompilerI</a> *<a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>;
<a name="l00397"></a><a class="code" href="classMTCompilerStateI.html#p1">00397</a> <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *<a class="code" href="classMTCompilerStateI.html#p1">m_pRegistrar</a>;
<a name="l00398"></a>00398 };
<a name="l00399"></a>00399 <span class="comment"></span>
<a name="l00400"></a>00400 <span class="comment">/** @brief Conversion Function Interface</span>
<a name="l00401"></a>00401 <span class="comment"></span>
<a name="l00402"></a>00402 <span class="comment"> A conversion function is used to convert a string value to</span>
<a name="l00403"></a>00403 <span class="comment"> a double value. For example, convert an hexadecimal value to a decimal</span>
<a name="l00404"></a>00404 <span class="comment"> value. A conversion function is constant, that is it cannot have variable</span>
<a name="l00405"></a>00405 <span class="comment"> argument. </span>
<a name="l00406"></a>00406 <span class="comment"></span>
<a name="l00407"></a>00407 <span class="comment"> This class is a template to simplify the writing of conversion functions.</span>
<a name="l00408"></a>00408 <span class="comment"> It implements a custom compiler and exposes some functions needed by conversion</span>
<a name="l00409"></a>00409 <span class="comment"> functions.</span>
<a name="l00410"></a>00410 <span class="comment"> </span>
<a name="l00411"></a>00411 <span class="comment">*/</span>
<a name="l00412"></a><a class="code" href="classMTConvFunctionI.html">00412</a> <span class="keyword">class </span><a class="code" href="classMTConvFunctionI.html">MTConvFunctionI</a> : <span class="keyword">public</span> <a class="code" href="classMTFunctionI.html">MTFunctionI</a>, <span class="keyword">public</span> <a class="code" href="classMTCompilerStateI.html">MTCompilerStateI</a>
<a name="l00413"></a>00413 {
<a name="l00414"></a>00414 <span class="keyword">public</span>:
<a name="l00415"></a>00415 <span class="comment"></span>
<a name="l00416"></a>00416 <span class="comment"> /** @brief Do the conversion</span>
<a name="l00417"></a>00417 <span class="comment"> </span>
<a name="l00418"></a>00418 <span class="comment"> Convert the string value to a double value. This method will be called</span>
<a name="l00419"></a>00419 <span class="comment"> when the compiling is done. To indicate a conversion error, </span>
<a name="l00420"></a>00420 <span class="comment"> call throwConversionExcep function.</span>
<a name="l00421"></a>00421 <span class="comment"></span>
<a name="l00422"></a>00422 <span class="comment"> @param val String value to be converted</span>
<a name="l00423"></a>00423 <span class="comment"> @return The double value represented by the string </span>
<a name="l00424"></a>00424 <span class="comment"> */</span>
<a name="l00425"></a>00425 <span class="keyword">virtual</span> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> <a class="code" href="classMTConvFunctionI.html#a0">convert</a>(<span class="keyword">const</span> <a class="code" href="MTUnicodeANSIDefs_8h.html#a0">MTSTRING</a> &val) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00426"></a>00426
<a name="l00427"></a>00427
<a name="l00428"></a>00428 <span class="comment">//**********************************</span>
<a name="l00429"></a>00429 <span class="comment">// MTCompilerStateI implementation</span>
<a name="l00430"></a>00430
<a name="l00431"></a><a class="code" href="classMTConvFunctionI.html#a1">00431</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTConvFunctionI.html#a1">enter</a>(<a class="code" href="classMTCompilerI.html">MTCompilerI</a> *pCompiler, <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *pRegistrar)
<a name="l00432"></a>00432 {
<a name="l00433"></a>00433 <a class="code" href="classMTCompilerStateI.html#a1">MTCompilerStateI::enter</a>(pCompiler, pRegistrar);
<a name="l00434"></a>00434 m_beginPos = <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_3">getCurPos</a>();
<a name="l00435"></a>00435 }
<a name="l00436"></a>00436
<a name="l00437"></a><a class="code" href="classMTConvFunctionI.html#a2">00437</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTConvFunctionI.html#a2">onCloseBracket</a>(){
<a name="l00438"></a>00438
<a name="l00439"></a>00439 <span class="keywordflow">try</span>
<a name="l00440"></a>00440 {
<a name="l00441"></a>00441 <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> val = <a class="code" href="classMTConvFunctionI.html#a0">convert</a>(<a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_2">getCurWord</a>());
<a name="l00442"></a>00442 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_4">pushValue</a>(val);
<a name="l00443"></a>00443 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_1">clearCurWord</a>();
<a name="l00444"></a>00444 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_10">exitState</a>();
<a name="l00445"></a>00445 }
<a name="l00446"></a>00446 <span class="keywordflow">catch</span>( <a class="code" href="classMTChainedExceptions.html">MTParserException</a> )
<a name="l00447"></a>00447 {
<a name="l00448"></a>00448 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<a class="code" href="MTParserException_8h.html#a32">MTPARSINGEXCEP_InvalidFuncSyntax</a>, <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_3">getCurPos</a>()-lstrlen(<a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_2">getCurWord</a>()), <a class="code" href="classMTParserItemI.html#a1">getSymbol</a>(), 1);
<a name="l00449"></a>00449 }
<a name="l00450"></a>00450
<a name="l00451"></a>00451 }
<a name="l00452"></a>00452
<a name="l00453"></a><a class="code" href="classMTConvFunctionI.html#a3">00453</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTConvFunctionI.html#a3">onEndOfFormula</a>()
<a name="l00454"></a>00454 {
<a name="l00455"></a>00455 <span class="comment">// missing closing bracket!</span>
<a name="l00456"></a>00456 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<a class="code" href="MTParserException_8h.html#a38">MTPARSINGEXCEP_MissingCloseBracket</a>, m_beginPos);
<a name="l00457"></a>00457 }
<a name="l00458"></a>00458
<a name="l00459"></a>00459
<a name="l00460"></a>00460
<a name="l00461"></a>00461 <span class="comment">//**********************************</span>
<a name="l00462"></a>00462 <span class="comment">// MTFunctionI implementation</span>
<a name="l00463"></a>00463
<a name="l00464"></a><a class="code" href="classMTConvFunctionI.html#a4">00464</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classMTConvFunctionI.html#a4">getNbArgs</a>(){ <span class="keywordflow">return</span> 1; }
<a name="l00465"></a>00465
<a name="l00466"></a><a class="code" href="classMTConvFunctionI.html#a5">00466</a> <span class="keyword">virtual</span> <span class="keyword">class </span><a class="code" href="classMTCompilerStateI.html">MTCompilerStateI</a>* <a class="code" href="classMTConvFunctionI.html#a5">getCompilerState</a>(){ <span class="keywordflow">return</span> <span class="keyword">this</span>; }
<a name="l00467"></a>00467
<a name="l00468"></a><a class="code" href="classMTConvFunctionI.html#a6">00468</a> <span class="keyword">virtual</span> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> <a class="code" href="classMTConvFunctionI.html#a6">evaluate</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nbArgs, <span class="keyword">const</span> <a class="code" href="MTParserPublic_8h.html#a8">MTDOUBLE</a> *pArg)
<a name="l00469"></a>00469 {
<a name="l00470"></a>00470 <span class="keywordflow">return</span> 0;
<a name="l00471"></a>00471 }
<a name="l00472"></a>00472
<a name="l00473"></a><a class="code" href="classMTConvFunctionI.html#a7">00473</a> <span class="keyword">virtual</span> <a class="code" href="classMTConvFunctionI.html#a7">~MTConvFunctionI</a>(){};
<a name="l00474"></a>00474
<a name="l00475"></a>00475 <span class="keyword">protected</span>:
<a name="l00476"></a>00476 <span class="comment"></span>
<a name="l00477"></a>00477 <span class="comment"> /** @brief Throw a conversion exception</span>
<a name="l00478"></a>00478 <span class="comment"></span>
<a name="l00479"></a>00479 <span class="comment"> Indicate that an error occured during the conversion.</span>
<a name="l00480"></a>00480 <span class="comment"> */</span>
<a name="l00481"></a><a class="code" href="classMTConvFunctionI.html#b0">00481</a> <span class="keywordtype">void</span> <a class="code" href="classMTConvFunctionI.html#b0">throwConversionExcep</a>() throw(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>){
<a name="l00482"></a>00482 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<a class="code" href="MTParserException_8h.html#a32">MTPARSINGEXCEP_InvalidFuncSyntax</a>, 0, <a class="code" href="classMTParserItemI.html#a1">getSymbol</a>(), 1);
<a name="l00483"></a>00483 }
<a name="l00484"></a>00484
<a name="l00485"></a>00485 <span class="keyword">private</span>:
<a name="l00486"></a>00486
<a name="l00487"></a>00487 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_beginPos;
<a name="l00488"></a>00488
<a name="l00489"></a>00489 };
<a name="l00490"></a>00490 <span class="comment"></span>
<a name="l00491"></a>00491 <span class="comment">/** @brief Function Parameter Tokenizer</span>
<a name="l00492"></a>00492 <span class="comment"></span>
<a name="l00493"></a>00493 <span class="comment"> This is an helper class that separate each</span>
<a name="l00494"></a>00494 <span class="comment"> function argument and allow to acces them individually.</span>
<a name="l00495"></a>00495 <span class="comment"></span>
<a name="l00496"></a>00496 <span class="comment"> Once the parameters have been parsed, the client </span>
<a name="l00497"></a>00497 <span class="comment"> init method is called and the object is pushed into the compiler stack. </span>
<a name="l00498"></a>00498 <span class="comment"> This way, functions can have their own state. </span>
<a name="l00499"></a>00499 <span class="comment"></span>
<a name="l00500"></a>00500 <span class="comment"> *The implementation is on the header file to allow plug-ins to only</span>
<a name="l00501"></a>00501 <span class="comment"> include this file without having to link with the library.</span>
<a name="l00502"></a>00502 <span class="comment">*/</span>
<a name="l00503"></a><a class="code" href="classMTFctParamTokenizer.html">00503</a> <span class="keyword">class </span><a class="code" href="classMTFctParamTokenizer.html">MTFctParamTokenizer</a> : <span class="keyword">public</span> <a class="code" href="classMTCompilerStateI.html">MTCompilerStateI</a>
<a name="l00504"></a>00504 {
<a name="l00505"></a>00505 <span class="keyword">public</span>:
<a name="l00506"></a>00506
<a name="l00507"></a>00507 <span class="comment">/* @brief Function that use the param tokenizer services</span>
<a name="l00508"></a>00508 <span class="comment"></span>
<a name="l00509"></a>00509 <span class="comment"> That kind of function can maintain its own state since there will be</span>
<a name="l00510"></a>00510 <span class="comment"> one instance for each occurence of the function in the formula. For example,</span>
<a name="l00511"></a>00511 <span class="comment"> in the formula "fct()+fct()", there will be two fct objects.</span>
<a name="l00512"></a>00512 <span class="comment"> */</span>
<a name="l00513"></a><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html">00513</a> <span class="keyword">class </span><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html">ClientFctI</a> : <span class="keyword">public</span> <a class="code" href="classMTFunctionI.html">MTFunctionI</a>
<a name="l00514"></a>00514 {
<a name="l00515"></a>00515 <span class="keyword">public</span>:
<a name="l00516"></a>00516
<a name="l00517"></a><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a0">00517</a> <a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a0">ClientFctI</a>(){ m_pTokenizer = NULL; }
<a name="l00518"></a>00518
<a name="l00519"></a>00519 <span class="comment">/* @brief Initialize the function</span>
<a name="l00520"></a>00520 <span class="comment"></span>
<a name="l00521"></a>00521 <span class="comment"> The parameters will constitute the function state.</span>
<a name="l00522"></a>00522 <span class="comment"></span>
<a name="l00523"></a>00523 <span class="comment"> @param params The parsed parameters</span>
<a name="l00524"></a>00524 <span class="comment"> @param pCompiler The current compiler object</span>
<a name="l00525"></a>00525 <span class="comment"> @param pRegistrar The current registrar object </span>
<a name="l00526"></a>00526 <span class="comment"> @param pos The function beginning position in the math expression</span>
<a name="l00527"></a>00527 <span class="comment"> */</span>
<a name="l00528"></a>00528 <span class="keyword">virtual</span> <span class="keywordtype">void</span> init(std::vector<MTSTRING> params, <a class="code" href="classMTCompilerI.html">MTCompilerI</a> *pCompiler, <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *pRegistrar, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos) <span class="keywordflow">throw</span>(<a class="code" href="classMTChainedExceptions.html">MTParserException</a>) = 0;
<a name="l00529"></a>00529
<a name="l00530"></a><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a2">00530</a> <span class="keyword">virtual</span> <a class="code" href="classMTCompilerStateI.html">MTCompilerStateI</a>* <a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a2">getCompilerState</a>()
<a name="l00531"></a>00531 {
<a name="l00532"></a>00532 <span class="keywordflow">if</span>( m_pTokenizer == NULL )
<a name="l00533"></a>00533 {
<a name="l00534"></a>00534 m_pTokenizer = <span class="keyword">new</span> <a class="code" href="classMTFctParamTokenizer.html#a0">MTFctParamTokenizer</a>();
<a name="l00535"></a>00535 <span class="keywordflow">if</span>( m_pTokenizer == NULL )
<a name="l00536"></a>00536 {
<a name="l00537"></a>00537 <span class="comment">// out of memory</span>
<a name="l00538"></a>00538 <span class="keywordflow">return</span> NULL;
<a name="l00539"></a>00539 }
<a name="l00540"></a>00540 }
<a name="l00541"></a>00541
<a name="l00542"></a>00542 m_pTokenizer-><a class="code" href="classMTFctParamTokenizer.html#a1">setClient</a>((<a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html">ClientFctI</a>*)<a class="code" href="classMTFunctionI.html#a3">spawn</a>());
<a name="l00543"></a>00543
<a name="l00544"></a>00544 <span class="keywordflow">return</span> m_pTokenizer;
<a name="l00545"></a>00545 }
<a name="l00546"></a>00546
<a name="l00547"></a><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a3">00547</a> <span class="keyword">virtual</span> <a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a3">~ClientFctI</a>()
<a name="l00548"></a>00548 {
<a name="l00549"></a>00549 <span class="keywordflow">if</span>( m_pTokenizer != NULL )
<a name="l00550"></a>00550 {
<a name="l00551"></a>00551 <span class="keyword">delete</span> m_pTokenizer;
<a name="l00552"></a>00552 m_pTokenizer = NULL;
<a name="l00553"></a>00553 }
<a name="l00554"></a>00554 }
<a name="l00555"></a>00555
<a name="l00556"></a>00556 <span class="keyword">private</span>:
<a name="l00557"></a>00557
<a name="l00558"></a>00558 <a class="code" href="classMTFctParamTokenizer.html">MTFctParamTokenizer</a> *m_pTokenizer;
<a name="l00559"></a>00559
<a name="l00560"></a>00560 };
<a name="l00561"></a>00561 <span class="keyword">public</span>:
<a name="l00562"></a>00562
<a name="l00563"></a>00563
<a name="l00564"></a><a class="code" href="classMTFctParamTokenizer.html#a0">00564</a> <a class="code" href="classMTFctParamTokenizer.html#a0">MTFctParamTokenizer</a>(){ m_pFct = NULL; }
<a name="l00565"></a>00565
<a name="l00566"></a>00566 <span class="comment">/* @brief Set the client function</span>
<a name="l00567"></a>00567 <span class="comment"></span>
<a name="l00568"></a>00568 <span class="comment"> @param pFct Must be a new function object. This object will be owned by the</span>
<a name="l00569"></a>00569 <span class="comment"> compiler, so it will automatically be deleted after use.</span>
<a name="l00570"></a>00570 <span class="comment"> */</span>
<a name="l00571"></a><a class="code" href="classMTFctParamTokenizer.html#a1">00571</a> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a1">setClient</a>(<a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html">ClientFctI</a> *pFct)
<a name="l00572"></a>00572 {
<a name="l00573"></a>00573 clean();
<a name="l00574"></a>00574 m_pFct = pFct;
<a name="l00575"></a>00575 }
<a name="l00576"></a>00576
<a name="l00577"></a>00577
<a name="l00578"></a>00578 <span class="comment">//**********************************</span>
<a name="l00579"></a>00579 <span class="comment">// MTCompilerStateI implementation</span>
<a name="l00580"></a>00580
<a name="l00581"></a><a class="code" href="classMTFctParamTokenizer.html#a2">00581</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a2">enter</a>(<a class="code" href="classMTCompilerI.html">MTCompilerI</a> *pCompiler, <a class="code" href="classMTRegistrarI.html">MTRegistrarI</a> *pRegistrar)
<a name="l00582"></a>00582 {
<a name="l00583"></a>00583 <a class="code" href="classMTCompilerStateI.html#a1">MTCompilerStateI::enter</a>(pCompiler, pRegistrar);
<a name="l00584"></a>00584
<a name="l00585"></a>00585 m_params.clear();
<a name="l00586"></a>00586 m_bracketCount = 1; <span class="comment">// we count the function opening bracket </span>
<a name="l00587"></a>00587 m_beginPos = <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_3">getCurPos</a>();
<a name="l00588"></a>00588 }
<a name="l00589"></a>00589
<a name="l00590"></a><a class="code" href="classMTFctParamTokenizer.html#a3">00590</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a3">onEndOfFormula</a>()
<a name="l00591"></a>00591 {
<a name="l00592"></a>00592 <span class="comment">// missing arguments!</span>
<a name="l00593"></a>00593 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_11">throwParsingExcep</a>(<a class="code" href="MTParserException_8h.html#a38">MTPARSINGEXCEP_MissingCloseBracket</a>, m_beginPos);
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595
<a name="l00596"></a><a class="code" href="classMTFctParamTokenizer.html#a4">00596</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a4">onOpenBracket</a>()
<a name="l00597"></a>00597 {
<a name="l00598"></a>00598 m_bracketCount++;
<a name="l00599"></a>00599 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>();
<a name="l00600"></a>00600 }
<a name="l00601"></a><a class="code" href="classMTFctParamTokenizer.html#a5">00601</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a5">onCloseBracket</a>()
<a name="l00602"></a>00602 {
<a name="l00603"></a>00603 m_bracketCount--;
<a name="l00604"></a>00604 <span class="keywordflow">if</span>( m_bracketCount == 0 )
<a name="l00605"></a>00605 {
<a name="l00606"></a>00606 <span class="comment">// end of function</span>
<a name="l00607"></a>00607
<a name="l00608"></a>00608 <span class="comment">// add the last parameter...</span>
<a name="l00609"></a>00609 m_params.push_back(<a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_2">getCurWord</a>());
<a name="l00610"></a>00610 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_1">clearCurWord</a>();
<a name="l00611"></a>00611 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_10">exitState</a>();
<a name="l00612"></a>00612
<a name="l00613"></a>00613 <span class="comment">// the init method can recall this compiler object with another client, so </span>
<a name="l00614"></a>00614 <span class="comment">// after this point we can't use actual member variable values. </span>
<a name="l00615"></a>00615 <a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html">ClientFctI</a> *pFct = m_pFct;
<a name="l00616"></a>00616 m_pFct = NULL;
<a name="l00617"></a>00617
<a name="l00618"></a>00618 <span class="keywordflow">try</span>
<a name="l00619"></a>00619 {
<a name="l00620"></a>00620 pFct-><a class="code" href="classMTFctParamTokenizer_1_1ClientFctI.html#a1">init</a>(m_params, <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>, <a class="code" href="classMTCompilerStateI.html#p1">m_pRegistrar</a>, m_beginPos);
<a name="l00621"></a>00621 }
<a name="l00622"></a>00622 <span class="keywordflow">catch</span>( <a class="code" href="classMTChainedExceptions.html">MTParserException</a> &e )
<a name="l00623"></a>00623 {
<a name="l00624"></a>00624 <span class="keyword">delete</span> pFct;
<a name="l00625"></a>00625 <span class="keywordflow">throw</span>(e); <span class="comment">// rethrow the same exception</span>
<a name="l00626"></a>00626 }
<a name="l00627"></a>00627
<a name="l00628"></a>00628 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_7">pushFunction</a>(pFct, pFct-><a class="code" href="classMTFunctionI.html#a0">getNbArgs</a>());
<a name="l00629"></a>00629 }
<a name="l00630"></a>00630 <span class="keywordflow">else</span>
<a name="l00631"></a>00631 {
<a name="l00632"></a>00632 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>();
<a name="l00633"></a>00633 }
<a name="l00634"></a>00634 }
<a name="l00635"></a><a class="code" href="classMTFctParamTokenizer.html#a6">00635</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMTFctParamTokenizer.html#a6">onArgSeparator</a>()
<a name="l00636"></a>00636 {
<a name="l00637"></a>00637 <span class="comment">// if parsing at our function level </span>
<a name="l00638"></a>00638 <span class="keywordflow">if</span>( m_bracketCount == 1 )
<a name="l00639"></a>00639 {
<a name="l00640"></a>00640 m_params.push_back(<a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_2">getCurWord</a>());
<a name="l00641"></a>00641 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_1">clearCurWord</a>();
<a name="l00642"></a>00642 }
<a name="l00643"></a>00643 <span class="keywordflow">else</span>
<a name="l00644"></a>00644 {
<a name="l00645"></a>00645 <a class="code" href="classMTCompilerStateI.html#p0">m_pCompiler</a>-><a class="code" href="classMTCompilerI.html#z10_0">addCurChar</a>();
<a name="l00646"></a>00646 }
<a name="l00647"></a>00647 }
<a name="l00648"></a>00648
<a name="l00649"></a><a class="code" href="classMTFctParamTokenizer.html#a7">00649</a> <a class="code" href="classMTFctParamTokenizer.html#a7">~MTFctParamTokenizer</a>(){clean();}
<a name="l00650"></a>00650
<a name="l00651"></a>00651 <span class="keyword">private</span>:
<a name="l00652"></a>00652
<a name="l00653"></a>00653 <span class="keywordtype">void</span> clean()
<a name="l00654"></a>00654 {
<a name="l00655"></a>00655 <span class="comment">// if the function has not been used, delete it</span>
<a name="l00656"></a>00656 <span class="keywordflow">if</span>( m_pFct != NULL )
<a name="l00657"></a>00657 {
<a name="l00658"></a>00658 <span class="keyword">delete</span> m_pFct;
<a name="l00659"></a>00659 m_pFct = NULL;
<a name="l00660"></a>00660 }
<a name="l00661"></a>00661 }
<a name="l00662"></a>00662
<a name="l00663"></a>00663 <span class="keyword">private</span>:
<a name="l00664"></a>00664
<a name="l00665"></a>00665 std::vector<MTSTRING> m_params;
<a name="l00666"></a>00666 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_bracketCount;
<a name="l00667"></a>00667 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_beginPos;
<a name="l00668"></a>00668 ClientFctI *m_pFct;
<a name="l00669"></a>00669
<a name="l00670"></a>00670 };
<a name="l00671"></a>00671
<a name="l00672"></a>00672
<a name="l00673"></a>00673 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 9 17:39:36 2008 for MTParserLib by
<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>