File: a00142.html

package info (click to toggle)
libloki 0.1.7-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 6,600 kB
  • sloc: cpp: 30,475; ansic: 1,974; makefile: 365; php: 316; perl: 108
file content (112 lines) | stat: -rwxr-xr-x 6,088 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loki: Visitor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Visitor Class Reference<br>
<small>
[<a class="el" href="a00227.html">Visitor</a>]</small>
</h1><!-- doxytag: class="Visitor" --><code>#include &lt;Visitor.h&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Visitor:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The building block of Acyclic <a class="el" href="a00142.html">Visitor</a><p>
<dl class="user" compact><dt><b>Usage</b></dt><dd></dd></dl>
Defining the visitable class:<p>
<div class="fragment"><pre class="fragment"> <span class="keyword">class </span>RasterBitmap : <span class="keyword">public</span> BaseVisitable&lt;&gt;
 {
 <span class="keyword">public</span>:
     <a class="code" href="a00227.html#g2b6ed280714eca44a2713d3cee5b2093">LOKI_DEFINE_VISITABLE</a>()
 };
</pre></div><p>
Way 1 to define a visitor: <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>SomeVisitor : 
     <span class="keyword">public</span> BaseVisitor <span class="comment">// required</span>
     <span class="keyword">public</span> <a class="code" href="a00142.html">Visitor</a>&lt;RasterBitmap&gt;,
     <span class="keyword">public</span> <a class="code" href="a00142.html">Visitor</a>&lt;Paragraph&gt;
 {
 <span class="keyword">public</span>:
     <span class="keywordtype">void</span> Visit(RasterBitmap&amp;); <span class="comment">// visit a RasterBitmap</span>
     <span class="keywordtype">void</span> Visit(Paragraph &amp;);   <span class="comment">// visit a Paragraph</span>
 };
</pre></div><p>
Way 2 to define the visitor: <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>SomeVisitor : 
     <span class="keyword">public</span> BaseVisitor <span class="comment">// required</span>
     <span class="keyword">public</span> <a class="code" href="a00142.html">Visitor</a>&lt;LOKI_TYPELIST_2(RasterBitmap, Paragraph)&gt;
 {
 <span class="keyword">public</span>:
     <span class="keywordtype">void</span> Visit(RasterBitmap&amp;); <span class="comment">// visit a RasterBitmap</span>
     <span class="keywordtype">void</span> Visit(Paragraph &amp;);   <span class="comment">// visit a Paragraph</span>
 };
</pre></div><p>
Way 3 to define the visitor: <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>SomeVisitor : 
     <span class="keyword">public</span> BaseVisitor <span class="comment">// required</span>
     <span class="keyword">public</span> <a class="code" href="a00142.html">Visitor</a>&lt;Seq&lt;RasterBitmap, Paragraph&gt;::Type&gt;
 {
 <span class="keyword">public</span>:
     <span class="keywordtype">void</span> Visit(RasterBitmap&amp;); <span class="comment">// visit a RasterBitmap</span>
     <span class="keywordtype">void</span> Visit(Paragraph &amp;);   <span class="comment">// visit a Paragraph</span>
 };
</pre></div><p>
<dl class="user" compact><dt><b>Using const visit functions:</b></dt><dd></dd></dl>
Defining the visitable class (true for const):<p>
<div class="fragment"><pre class="fragment"> <span class="keyword">class </span>RasterBitmap : <span class="keyword">public</span> BaseVisitable&lt;void, DefaultCatchAll, true&gt;
 {
 <span class="keyword">public</span>:
     <a class="code" href="a00227.html#g0d60fea385397a82b9d3b3d231517777">LOKI_DEFINE_CONST_VISITABLE</a>()
 };
</pre></div><p>
Defining the visitor which only calls const member functions: <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>SomeVisitor : 
     <span class="keyword">public</span> BaseVisitor <span class="comment">// required</span>
     <span class="keyword">public</span> <a class="code" href="a00142.html">Visitor</a>&lt;RasterBitmap, void, true&gt;,
 {
 <span class="keyword">public</span>:
     <span class="keywordtype">void</span> Visit(<span class="keyword">const</span> RasterBitmap&amp;); <span class="comment">// visit a RasterBitmap by a const member function</span>
 };
</pre></div><p>
<dl class="user" compact><dt><b>Example:</b></dt><dd></dd></dl>
test/Visitor/main.cpp <hr>The documentation for this class was generated from the following file:<ul>
<li>Visitor.h</ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 29 18:51:41 2009 for Loki by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>