?? cell_8hpp-source.html
字號:
<!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>a1: Cell.hpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.9.1 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>Cell.hpp</h1><a href="Cell_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 00022 <span class="preprocessor">#ifndef CELL_HPP</span>00023 <span class="preprocessor"></span><span class="preprocessor">#define CELL_HPP</span>00024 <span class="preprocessor"></span>00025 <span class="preprocessor">#include <cstddef></span>00026 <span class="preprocessor">#include <cstdlib></span>00027 <span class="preprocessor">#include <iostream></span>00028 <span class="preprocessor">#include <fstream></span>00029 <span class="preprocessor">#include <sstream></span>00030 <span class="preprocessor">#include <string></span>00031 <span class="preprocessor">#include <stack></span>00032 00033 <span class="keyword">using</span> <span class="keyword">namespace </span>std;00034 <a name="l00039"></a><a class="code" href="classCell.html">00039</a> <span class="keyword">class </span><a class="code" href="classCell.html">Cell</a> {00040 <span class="keyword">public</span>:00041 00045 <a class="code" href="classCell.html">Cell</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> i);00046 00050 <a class="code" href="classCell.html">Cell</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> d);00051 00055 <a class="code" href="classCell.html">Cell</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> s);00056 00060 <a class="code" href="classCell.html">Cell</a>(<a class="code" href="classCell.html">Cell</a>* <span class="keyword">const</span> my_car, <a class="code" href="classCell.html">Cell</a>* <span class="keyword">const</span> my_cdr);00061 00066 <span class="keywordtype">bool</span> is_int() <span class="keyword">const</span>;00067 00072 <span class="keywordtype">bool</span> is_double() <span class="keyword">const</span>;00073 00078 <span class="keywordtype">bool</span> is_symbol() <span class="keyword">const</span>;00079 00084 <span class="keywordtype">bool</span> is_cons() <span class="keyword">const</span>;00085 00090 <span class="keywordtype">int</span> <a class="code" href="cons_8hpp.html#a10">get_int</a>() <span class="keyword">const</span>;00091 00096 <span class="keywordtype">double</span> <a class="code" href="cons_8hpp.html#a11">get_double</a>() <span class="keyword">const</span>;00097 00102 string <a class="code" href="cons_8hpp.html#a12">get_symbol</a>() <span class="keyword">const</span>;00103 00108 <a class="code" href="classCell.html">Cell</a>* get_car() <span class="keyword">const</span>;00109 00114 <a class="code" href="classCell.html">Cell</a>* get_cdr() <span class="keyword">const</span>;00115 00120 <span class="keywordtype">void</span> print(ostream& os = cout) <span class="keyword">const</span>;00121 00122 <span class="keyword">private</span>:00123 <a name="l00124"></a><a class="code" href="classCell.html#y4">00124</a> <span class="keyword">enum</span> TypeTag {type_int, type_double, type_symbol, type_conspair};<a name="l00125"></a><a class="code" href="classCell.html#r0">00125</a> TypeTag tag_m;<a name="l00126"></a><a class="code" href="structCell_1_1ConsPair.html">00126</a> <span class="keyword">struct </span><a class="code" href="structCell_1_1ConsPair.html">ConsPair</a>00127 {<a name="l00128"></a><a class="code" href="structCell_1_1ConsPair.html#o0">00128</a> <a class="code" href="classCell.html">Cell</a> *car; <a name="l00129"></a><a class="code" href="structCell_1_1ConsPair.html#o1">00129</a> <a class="code" href="classCell.html">Cell</a> *cdr; 00130 };00131 <span class="keyword">union</span>00132 <span class="keyword"> </span>{<a name="l00133"></a><a class="code" href="classCell.html#r1">00133</a> <span class="keywordtype">int</span> int_m; <a name="l00134"></a><a class="code" href="classCell.html#r2">00134</a> <span class="keywordtype">double</span> double_m; <a name="l00135"></a><a class="code" href="classCell.html#r3">00135</a> <span class="keywordtype">char</span>* symbol_m; <a name="l00136"></a><a class="code" href="classCell.html#r4">00136</a> <a class="code" href="structCell_1_1ConsPair.html">ConsPair</a> conspair_m; 00137 };00138 };00139 00140 <span class="comment">// Reminder: cons.hpp expects nil to be defined somewhere (for this</span>00141 <span class="comment">// implementation, Cell.cpp is the logical place to define it).</span>00142 <span class="comment">// Here we promise this again, just to be safe.</span>00143 <span class="keyword">extern</span> <a class="code" href="classCell.html">Cell</a>* <span class="keyword">const</span> nil;00144 00145 <span class="preprocessor">#endif // CELL_HPP</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 8 19:07:07 2007 for a1 by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -