Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 39121eaa6e08c828e313b57261e3f286 > files > 71

antlr-C++-doc-2.7.7-15.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ANTLR Support Libraries 2.7.1+: antlr/BaseAST.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ANTLR Support Libraries 2.7.1+</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>antlr/BaseAST.hpp</h1>  </div>
</div>
<div class="contents">
<a href="BaseAST_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef INC_BaseAST_hpp__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define INC_BaseAST_hpp__</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="comment">/* ANTLR Translator Generator</span>
<a name="l00005"></a>00005 <span class="comment"> * Project led by Terence Parr at http://www.jGuru.com</span>
<a name="l00006"></a>00006 <span class="comment"> * Software rights: http://www.antlr.org/license.html</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/BaseAST.hpp#2 $</span>
<a name="l00009"></a>00009 <span class="comment"> */</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;antlr/config.hpp&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;antlr/AST.hpp&gt;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="preprocessor">#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="keyword">namespace </span>antlr {
<a name="l00018"></a>00018 <span class="preprocessor">#endif</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a><a class="code" href="BaseAST_8hpp.html#a8c208f381fc0e8065e2841230bfb4848">00020</a> <span class="keyword">class </span><a class="code" href="config_8hpp.html#ad583892c7af76867441115e41aa1ce52">ANTLR_API</a> <a class="code" href="classBaseAST.html">BaseAST</a>;
<a name="l00021"></a>00021 <span class="keyword">typedef</span> <a class="code" href="classASTRefCount.html">ASTRefCount&lt;BaseAST&gt;</a> <a class="code" href="BaseAST_8hpp.html#a8c208f381fc0e8065e2841230bfb4848">RefBaseAST</a>;
<a name="l00022"></a>00022 
<a name="l00023"></a><a class="code" href="classBaseAST.html">00023</a> <span class="keyword">class </span><a class="code" href="config_8hpp.html#ad583892c7af76867441115e41aa1ce52">ANTLR_API</a> <a class="code" href="classBaseAST.html">BaseAST</a> : <span class="keyword">public</span> <a class="code" href="classAST.html">AST</a> {
<a name="l00024"></a>00024 <span class="keyword">public</span>:
<a name="l00025"></a><a class="code" href="classBaseAST.html#abc931a496698d7e97744e20b7ecdb315">00025</a>    <a class="code" href="classBaseAST.html">BaseAST</a>() : <a class="code" href="classAST.html">AST</a>()
<a name="l00026"></a>00026    {
<a name="l00027"></a>00027    }
<a name="l00028"></a><a class="code" href="classBaseAST.html#a944f5ec70026186594c51d58f74b5936">00028</a>    <a class="code" href="classBaseAST.html">BaseAST</a>(<span class="keyword">const</span> <a class="code" href="classBaseAST.html">BaseAST</a>&amp; other)
<a name="l00029"></a>00029    : <a class="code" href="classAST.html">AST</a>(other)
<a name="l00030"></a>00030    {
<a name="l00031"></a>00031    }
<a name="l00032"></a><a class="code" href="classBaseAST.html#a51e8b9b2271dfbab4524f42d118c2a4e">00032</a>    <span class="keyword">virtual</span> ~<a class="code" href="classBaseAST.html">BaseAST</a>()
<a name="l00033"></a>00033    {
<a name="l00034"></a>00034    }
<a name="l00035"></a>00035 
<a name="l00037"></a>00037    <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* typeName( <span class="keywordtype">void</span> ) <span class="keyword">const</span> = 0;
<a name="l00038"></a>00038 
<a name="l00040"></a>00040    <span class="keyword">virtual</span> <a class="code" href="classASTRefCount.html">RefAST</a> clone( <span class="keywordtype">void</span> ) <span class="keyword">const</span> = 0;
<a name="l00041"></a>00041 
<a name="l00043"></a>00043    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> equals(<a class="code" href="classASTRefCount.html">RefAST</a> t) <span class="keyword">const</span>;
<a name="l00044"></a>00044 
<a name="l00048"></a>00048    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> equalsList(<a class="code" href="classASTRefCount.html">RefAST</a> t) <span class="keyword">const</span>;
<a name="l00049"></a>00049 
<a name="l00052"></a>00052    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> equalsListPartial(<a class="code" href="classASTRefCount.html">RefAST</a> t) <span class="keyword">const</span>;
<a name="l00053"></a>00053 
<a name="l00057"></a>00057    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> equalsTree(<a class="code" href="classASTRefCount.html">RefAST</a> t) <span class="keyword">const</span>;
<a name="l00058"></a>00058 
<a name="l00062"></a>00062    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> equalsTreePartial(<a class="code" href="classASTRefCount.html">RefAST</a> t) <span class="keyword">const</span>;
<a name="l00063"></a>00063 
<a name="l00068"></a>00068    <span class="keyword">virtual</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)vector&lt;<a class="code" href="classASTRefCount.html">RefAST</a>&gt; findAll(<a class="code" href="classASTRefCount.html">RefAST</a> t);
<a name="l00069"></a>00069 
<a name="l00074"></a>00074    virtual <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)vector&lt;<a class="code" href="classASTRefCount.html">RefAST</a>&gt; findAllPartial(<a class="code" href="classASTRefCount.html">RefAST</a> t);
<a name="l00075"></a>00075 
<a name="l00077"></a><a class="code" href="classBaseAST.html#a2464af40afa022f96680bdaa46df99fa">00077</a>    virtual <span class="keywordtype">void</span> addChild(<a class="code" href="classASTRefCount.html">RefAST</a> c)
<a name="l00078"></a>00078    {
<a name="l00079"></a>00079       <span class="keywordflow">if</span>( !c )
<a name="l00080"></a>00080          <span class="keywordflow">return</span>;
<a name="l00081"></a>00081 
<a name="l00082"></a>00082       <a class="code" href="classASTRefCount.html">RefBaseAST</a> tmp = down;
<a name="l00083"></a>00083 
<a name="l00084"></a>00084       <span class="keywordflow">if</span> (tmp)
<a name="l00085"></a>00085       {
<a name="l00086"></a>00086          <span class="keywordflow">while</span> (tmp-&gt;right)
<a name="l00087"></a>00087             tmp = tmp-&gt;right;
<a name="l00088"></a>00088          tmp-&gt;right = c;
<a name="l00089"></a>00089       }
<a name="l00090"></a>00090       <span class="keywordflow">else</span>
<a name="l00091"></a>00091          down = c;
<a name="l00092"></a>00092    }
<a name="l00093"></a>00093 
<a name="l00097"></a>00097    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> getNumberOfChildren() <span class="keyword">const</span>;
<a name="l00098"></a>00098 
<a name="l00100"></a><a class="code" href="classBaseAST.html#aebb70b58e23c1a92dc45c21c8196e995">00100</a>    <span class="keyword">virtual</span> <a class="code" href="classASTRefCount.html">RefAST</a> getFirstChild()<span class="keyword"> const</span>
<a name="l00101"></a>00101 <span class="keyword">   </span>{
<a name="l00102"></a>00102       <span class="keywordflow">return</span> <a class="code" href="ASTRefCount_8hpp.html#a25b300faa8730e33c35b83c55afd2596">RefAST</a>(down);
<a name="l00103"></a>00103    }
<a name="l00105"></a><a class="code" href="classBaseAST.html#a5b385d845b253a797d99055e588f2502">00105</a>    <span class="keyword">virtual</span> <a class="code" href="classASTRefCount.html">RefAST</a> getNextSibling()<span class="keyword"> const</span>
<a name="l00106"></a>00106 <span class="keyword">   </span>{
<a name="l00107"></a>00107       <span class="keywordflow">return</span> <a class="code" href="ASTRefCount_8hpp.html#a25b300faa8730e33c35b83c55afd2596">RefAST</a>(right);
<a name="l00108"></a>00108    }
<a name="l00109"></a>00109 
<a name="l00111"></a><a class="code" href="classBaseAST.html#ad62ccfebc1e7e3896371f8d76975afbc">00111</a>    <span class="keyword">virtual</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)string getText()<span class="keyword"> const</span>
<a name="l00112"></a>00112 <span class="keyword">   </span>{
<a name="l00113"></a>00113       <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;
<a name="l00114"></a>00114    }
<a name="l00116"></a><a class="code" href="classBaseAST.html#a256bfc8da3db4c6ac9ca058bbf6d986b">00116</a>    <span class="keyword">virtual</span> <span class="keywordtype">int</span> getType()<span class="keyword"> const</span>
<a name="l00117"></a>00117 <span class="keyword">   </span>{
<a name="l00118"></a>00118       <span class="keywordflow">return</span> 0;
<a name="l00119"></a>00119    }
<a name="l00120"></a>00120 
<a name="l00122"></a><a class="code" href="classBaseAST.html#a199a908d80e0746ccbd79edbf64c7128">00122</a>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> removeChildren()
<a name="l00123"></a>00123    {
<a name="l00124"></a>00124       down = <span class="keyword">static_cast&lt;</span><a class="code" href="classBaseAST.html">BaseAST</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span><a class="code" href="classAST.html">AST</a>*<span class="keyword">&gt;</span>(<a class="code" href="AST_8hpp.html#aef5cde6de81efc04d3b318e3dc5863ff">nullAST</a>));
<a name="l00125"></a>00125    }
<a name="l00126"></a>00126 
<a name="l00128"></a><a class="code" href="classBaseAST.html#a4004f3fef43d74ebe67f89771c0a4cec">00128</a>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> setFirstChild(<a class="code" href="classASTRefCount.html">RefAST</a> c)
<a name="l00129"></a>00129    {
<a name="l00130"></a>00130       down = <span class="keyword">static_cast&lt;</span><a class="code" href="classBaseAST.html">BaseAST</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span><a class="code" href="classAST.html">AST</a>*<span class="keyword">&gt;</span>(c));
<a name="l00131"></a>00131    }
<a name="l00132"></a>00132 
<a name="l00134"></a><a class="code" href="classBaseAST.html#a02984326c6a52c38bca8895be38b681e">00134</a>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> setNextSibling(<a class="code" href="classASTRefCount.html">RefAST</a> n)
<a name="l00135"></a>00135    {
<a name="l00136"></a>00136       right = <span class="keyword">static_cast&lt;</span><a class="code" href="classBaseAST.html">BaseAST</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span><a class="code" href="classAST.html">AST</a>*<span class="keyword">&gt;</span>(n));
<a name="l00137"></a>00137    }
<a name="l00138"></a>00138 
<a name="l00140"></a><a class="code" href="classBaseAST.html#a392ca1489f57b54af4de9b3af3a2c7ed">00140</a>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> setText(<span class="keyword">const</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)<span class="keywordtype">string</span>&amp; txt)
<a name="l00141"></a>00141    {
<a name="l00142"></a>00142    }
<a name="l00143"></a>00143 
<a name="l00145"></a><a class="code" href="classBaseAST.html#ab6d00d232a33586e7eb7df52f80fc129">00145</a>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> setType(<span class="keywordtype">int</span> type)
<a name="l00146"></a>00146    {
<a name="l00147"></a>00147    }
<a name="l00148"></a>00148 
<a name="l00149"></a>00149 <span class="preprocessor">#ifdef ANTLR_SUPPORT_XML</span>
<a name="l00150"></a>00150 <span class="preprocessor"></span>
<a name="l00154"></a>00154    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> attributesToStream( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)ostream&amp; out ) <span class="keyword">const</span>;
<a name="l00159"></a>00159    <span class="keyword">virtual</span> <span class="keywordtype">void</span> toStream( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)ostream &amp;out ) <span class="keyword">const</span>;
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
<a name="l00161"></a>00161 <span class="preprocessor"></span>
<a name="l00163"></a><a class="code" href="classBaseAST.html#a547f40759e9fd0c1c160a18a23112a39">00163</a>    <span class="keyword">virtual</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)string toString()<span class="keyword"> const</span>
<a name="l00164"></a>00164 <span class="keyword">   </span>{
<a name="l00165"></a>00165       <span class="keywordflow">return</span> getText();
<a name="l00166"></a>00166    }
<a name="l00167"></a>00167 
<a name="l00169"></a>00169    <span class="keyword">virtual</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)string toStringList() const;
<a name="l00170"></a>00170    virtual <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)<span class="keywordtype">string</span> toStringTree() const;
<a name="l00171"></a>00171 protected:
<a name="l00172"></a><a class="code" href="classBaseAST.html#a45f93258ce1f0465857d0271ead3edcd">00172</a>    <a class="code" href="classASTRefCount.html">RefBaseAST</a> down;
<a name="l00173"></a><a class="code" href="classBaseAST.html#a531c0e14cf4bfe147298e3a41847aec9">00173</a>    <a class="code" href="classASTRefCount.html">RefBaseAST</a> right;
<a name="l00174"></a>00174 private:
<a name="l00175"></a>00175    <span class="keywordtype">void</span> doWorkForFindAll(<a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)vector&lt;<a class="code" href="classASTRefCount.html">RefAST</a>&gt;&amp; v,
<a name="l00176"></a>00176                          <a class="code" href="classASTRefCount.html">RefAST</a> target,
<a name="l00177"></a>00177                          <span class="keywordtype">bool</span> partialMatch);
<a name="l00178"></a>00178 };
<a name="l00179"></a>00179 
<a name="l00182"></a><a class="code" href="classBaseAST.html#a0051614e6f1f1a287dafec54963d664a">00182</a> inline <span class="keywordtype">bool</span> <a class="code" href="classBaseAST.html">BaseAST</a>::equals(<a class="code" href="classASTRefCount.html">RefAST</a> t)<span class="keyword"> const</span>
<a name="l00183"></a>00183 <span class="keyword"></span>{
<a name="l00184"></a>00184    <span class="keywordflow">if</span> (!t)
<a name="l00185"></a>00185       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00186"></a>00186    <span class="keywordflow">return</span> ((getType() == t-&gt;getType()) &amp;&amp; (getText() == t-&gt;getText()));
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188 
<a name="l00189"></a>00189 <span class="preprocessor">#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE</span>
<a name="l00190"></a>00190 <span class="preprocessor"></span>}
<a name="l00191"></a>00191 <span class="preprocessor">#endif</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span>
<a name="l00193"></a>00193 <span class="preprocessor">#endif //INC_BaseAST_hpp__</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated on Fri Mar 25 2011 for ANTLR Support Libraries 2.7.1+ by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>