• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  Copyright 2012 Eric Niebler
4
5  Distributed under the Boost
6  Software License, Version 1.0. (See accompanying
7  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8  -->
9<header name="boost/proto/generate.hpp">
10  <para>Contains definition of
11    <computeroutput><classname alt="boost::proto::default_generator">proto::default_generator</classname></computeroutput>,
12    <computeroutput><classname alt="boost::proto::generator">proto::generator</classname>&lt;&gt;</computeroutput>,
13    <computeroutput><classname alt="boost::proto::pod_generator">proto::pod_generator</classname>&lt;&gt;</computeroutput>
14    and other utilities that users can use to post-process new expression objects that
15    Proto creates.</para>
16  <namespace name="boost">
17    <namespace name="proto">
18      <!-- proto::default_generator -->
19      <struct name="default_generator">
20        <purpose>A simple generator that passes an expression through unchanged.</purpose>
21        <description>
22          <para>
23            Generators are intended for use as the first template parameter to the
24            <computeroutput><classname alt="proto::domain">proto::domain&lt;&gt;</classname></computeroutput>
25            class template and control if and how expressions within that domain are to be customized.
26            The <computeroutput>proto::default_generator</computeroutput> makes no modifications to the
27            expressions passed to it.
28          </para>
29        </description>
30        <inherit>
31          <type><classname>proto::callable</classname></type>
32        </inherit>
33        <struct-specialization name="result">
34          <template>
35            <template-type-parameter name="This"/>
36            <template-type-parameter name="Expr"/>
37          </template>
38          <specialization>
39            <template-arg>This(Expr)</template-arg>
40          </specialization>
41          <typedef name="type">
42            <type>Expr</type>
43          </typedef>
44        </struct-specialization>
45        <method-group name="public member functions">
46          <method name="operator()" cv="const">
47            <type>Expr</type>
48            <template>
49              <template-type-parameter name="Expr"/>
50            </template>
51            <parameter name="expr">
52              <paramtype>Expr const &amp;</paramtype>
53              <description>
54                <para>A Proto expression</para>
55              </description>
56            </parameter>
57            <returns>
58              <para><computeroutput>expr</computeroutput></para>
59            </returns>
60          </method>
61        </method-group>
62      </struct>
63
64      <!-- proto::basic_default_generator -->
65      <struct name="basic_default_generator">
66        <purpose>
67          A simple generator that passes an expression through unchanged while stating
68          a preference for <classname>proto::basic_expr</classname>&lt;&gt; over
69          <classname>proto::expr</classname>&lt;&gt;.</purpose>
70        <inherit>
71          <type><classname>proto::use_basic_expr</classname>&lt; <classname>proto::default_generator</classname> &gt;</type>
72        </inherit>
73      </struct>
74
75      <!-- proto::generator -->
76      <struct name="generator">
77        <template>
78          <template-nontype-parameter name="Extends">
79            <type>template&lt; typename &gt; class</type>
80          </template-nontype-parameter>
81        </template>
82        <purpose>A generator that wraps expressions passed to it in the specified extension wrapper.</purpose>
83        <description>
84          <para>
85            Generators are intended for use as the first template parameter to the
86            <computeroutput><classname alt="proto::domain">proto::domain&lt;&gt;</classname></computeroutput>
87            class template and control if and how expressions within that domain are to be customized.
88            <computeroutput>proto::generator&lt;&gt;</computeroutput> wraps each expression passed to it in
89            the <computeroutput>Extends&lt;&gt;</computeroutput> wrapper.
90          </para>
91        </description>
92        <struct-specialization name="result">
93          <template>
94            <template-type-parameter name="This"/>
95            <template-type-parameter name="Expr"/>
96          </template>
97          <specialization>
98            <template-arg>This(Expr)</template-arg>
99          </specialization>
100          <typedef name="type">
101            <type>Extends&lt; Expr &gt;</type>
102          </typedef>
103        </struct-specialization>
104        <method-group name="public member functions">
105          <method name="operator()" cv="const">
106            <type>Extends&lt; Expr &gt;</type>
107            <template>
108              <template-type-parameter name="Expr"/>
109            </template>
110            <parameter name="expr">
111              <paramtype>Expr const &amp;</paramtype>
112              <description>
113                <para>A Proto expression</para>
114              </description>
115            </parameter>
116            <returns>
117              <para><computeroutput>Extends&lt;Expr&gt;(expr)</computeroutput></para>
118            </returns>
119          </method>
120        </method-group>
121      </struct>
122
123      <!-- proto::pod_generator -->
124      <struct name="pod_generator">
125        <template>
126          <template-nontype-parameter name="Extends">
127            <type>template&lt; typename &gt; class</type>
128          </template-nontype-parameter>
129        </template>
130        <purpose>A generator that wraps expressions passed to it in the specified extension wrapper and uses aggregate initialization for the wrapper. </purpose>
131        <description>
132          <para>
133            Generators are intended for use as the first template parameter to the
134            <computeroutput><classname alt="proto::domain">proto::domain&lt;&gt;</classname></computeroutput>
135            class template and control if and how expressions within that domain are to be customized.
136            <computeroutput>proto::pod_generator&lt;&gt;</computeroutput> wraps each expression passed
137            to it in the <computeroutput>Extends&lt;&gt;</computeroutput> wrapper, and uses aggregate
138            initialzation for the wrapped object.
139          </para>
140        </description>
141        <inherit>
142          <type><classname>proto::callable</classname></type>
143        </inherit>
144        <struct-specialization name="result">
145          <template>
146            <template-type-parameter name="This"/>
147            <template-type-parameter name="Expr"/>
148          </template>
149          <specialization>
150            <template-arg>This(Expr)</template-arg>
151          </specialization>
152          <typedef name="type">
153            <type>Extends&lt; Expr &gt;</type>
154          </typedef>
155        </struct-specialization>
156        <method-group name="public member functions">
157          <method name="operator()" cv="const">
158            <type>Extends&lt; Expr &gt;</type>
159            <template>
160              <template-type-parameter name="Expr"/>
161            </template>
162            <parameter name="expr">
163              <paramtype>Expr const &amp;</paramtype>
164              <description>
165                <para>A Proto expression</para>
166              </description>
167            </parameter>
168            <returns>
169              <para>
170                <computeroutput>Extends&lt;Expr&gt; that = {expr}; return that;</computeroutput>
171              </para>
172            </returns>
173          </method>
174        </method-group>
175      </struct>
176
177      <!-- by_value_generator -->
178      <struct name="by_value_generator">
179        <purpose>A generator that replaces child nodes held by reference with ones held by value.
180          Use with <computeroutput><classname alt="proto::compose_generators">proto::compose_generators&lt;&gt;</classname>
181          </computeroutput> to forward that result to another generator.
182        </purpose>
183        <description>
184          <para>
185            Generators are intended for use as the first template parameter to the
186            <computeroutput><classname alt="proto::domain">proto::domain&lt;&gt;</classname></computeroutput>
187            class template and control if and how expressions within that domain are to be customized.
188            <computeroutput>proto::by_value_generator</computeroutput> ensures all child nodes are held
189            by value. This generator is typically composed with a second generator for further processing,
190            as <computeroutput><classname>proto::compose_generators</classname>&lt;proto::by_value_generator,
191            MyGenerator&gt;</computeroutput>.
192          </para>
193        </description>
194        <inherit>
195          <type><classname>proto::callable</classname></type>
196        </inherit>
197        <struct-specialization name="result">
198          <template>
199            <template-type-parameter name="This"/>
200            <template-type-parameter name="Expr"/>
201          </template>
202          <specialization>
203            <template-arg>This(Expr)</template-arg>
204          </specialization>
205          <typedef name="type">
206            <type><emphasis>unspecified</emphasis></type>
207          </typedef>
208        </struct-specialization>
209        <method-group name="public member functions">
210          <method name="operator()" cv="const">
211            <type><emphasis>unspecified</emphasis></type>
212            <template>
213              <template-type-parameter name="Expr"/>
214            </template>
215            <parameter name="expr">
216              <paramtype>Expr const &amp;</paramtype>
217              <description>
218                <para>A Proto expression.</para>
219              </description>
220            </parameter>
221            <returns>
222              <para>Equivalent to <computeroutput><functionname>proto::deep_copy</functionname>(expr)</computeroutput></para>
223            </returns>
224          </method>
225        </method-group>
226      </struct>
227
228      <!-- proto::compose_generator -->
229      <struct name="compose_generators">
230        <template>
231          <template-type-parameter name="First"/>
232          <template-type-parameter name="Second"/>
233        </template>
234        <purpose>A composite generator that first applies one transform to an expression and then forwards
235          the result on to another generator for further transformation.</purpose>
236        <description>
237          <para>
238            Generators are intended for use as the first template parameter to the
239            <computeroutput><classname alt="proto::domain">proto::domain&lt;&gt;</classname></computeroutput>
240            class template and control if and how expressions within that domain are to be customized.
241            <computeroutput>proto::compose_generators&lt;&gt;</computeroutput> is a composite generator
242            that first applies one transform to an expression and then forwards the result on to another
243            generator for further transformation.
244          </para>
245        </description>
246        <inherit>
247          <type><classname>proto::callable</classname></type>
248        </inherit>
249        <struct-specialization name="result">
250          <template>
251            <template-type-parameter name="This"/>
252            <template-type-parameter name="Expr"/>
253          </template>
254          <specialization>
255            <template-arg>This(Expr)</template-arg>
256          </specialization>
257          <inherit>
258            <type>
259    boost::result_of&lt;
260      Second(typename boost::result_of&lt;First(Expr)&gt;::type)
261    &gt;</type>
262          </inherit>
263        </struct-specialization>
264        <method-group name="public member functions">
265          <method name="operator()" cv="const">
266            <type>typename boost::result_of&lt;
267      Second(typename boost::result_of&lt;First(Expr)&gt;::type)
268    &gt;::type</type>
269            <template>
270              <template-type-parameter name="Expr"/>
271            </template>
272            <parameter name="expr">
273              <paramtype>Expr const &amp;</paramtype>
274              <description>
275                <para>A Proto expression.</para>
276              </description>
277            </parameter>
278            <returns>
279              <para><computeroutput>Second()(First()(expr))</computeroutput></para>
280            </returns>
281          </method>
282        </method-group>
283      </struct>
284
285      <!-- proto::use_basic_expr -->
286      <struct name="use_basic_expr">
287        <template>
288          <template-type-parameter name="Generator"/>
289        </template>
290        <inherit>
291          <type>Generator</type>
292        </inherit>
293        <description>
294          <para>
295            Annotate a generator to indicate that it would
296            prefer to be passed instances of
297            <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
298            <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
299          </para>
300          <para>
301            <computeroutput>use_basic_expr&lt; Generator &gt;</computeroutput> is itself a generator.
302          </para>
303        </description>
304      </struct>
305
306      <!-- proto::wants_basic_expr -->
307      <struct name="wants_basic_expr">
308        <template>
309          <template-type-parameter name="Generator"/>
310        </template>
311        <inherit>
312          <type>mpl::bool_&lt; <replaceable>true-or-false</replaceable> &gt;</type>
313        </inherit>
314        <description>
315          <para>
316            A Boolean metafunction that tests a generator to see whether
317            it would prefer to be passed instances of
318            <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
319            <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
320          </para>
321        </description>
322      </struct>
323
324    </namespace>
325  </namespace>
326</header>
327