486 lines
19 KiB
XML
486 lines
19 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
Copyright 2012 Eric Niebler
|
|
|
|
Distributed under the Boost
|
|
Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
-->
|
|
<header name="boost/proto/transform/arg.hpp">
|
|
<para>Contains definition of the childN transforms and friends.</para>
|
|
<namespace name="boost">
|
|
<namespace name="proto">
|
|
<struct name="_expr">
|
|
<inherit><classname>proto::transform</classname>< _expr ></inherit>
|
|
<purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the current expression unmodified. </purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
<classname>proto::terminal</classname><int>::type & j = proto::_expr()(i);
|
|
assert( boost::addressof(i) == boost::addressof(j) );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit>
|
|
<typedef name="result_type">
|
|
<type>Expr</type>
|
|
</typedef>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>Expr</type>
|
|
<parameter name="expr">
|
|
<paramtype>typename impl::expr_param</paramtype>
|
|
<description>
|
|
<para>The current expression. </para>
|
|
</description>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::state_param</paramtype>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::data_param</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Returns the current expression.
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>expr</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_state">
|
|
<inherit><classname>proto::transform</classname>< _state ></inherit>
|
|
<purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the current state unmodified. </purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
char ch = proto::_state()(i, 'a');
|
|
assert( ch == 'a' );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit>
|
|
<typedef name="result_type">
|
|
<type>State</type>
|
|
</typedef>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>State</type>
|
|
<parameter name="">
|
|
<paramtype>typename impl::expr_param</paramtype>
|
|
</parameter>
|
|
<parameter name="state">
|
|
<paramtype>typename impl::state_param</paramtype>
|
|
<description>
|
|
<para>The current state. </para>
|
|
</description>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::data_param</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Returns the current state.
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>state</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_data">
|
|
<inherit><classname>proto::transform</classname>< _data ></inherit>
|
|
<purpose>
|
|
A <conceptname>PrimitiveTransform</conceptname> that returns the current data unmodified.
|
|
If the data (third) parameter is a transform environment, it returns the value associated
|
|
with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns
|
|
the data parameter unmodified.
|
|
</purpose>
|
|
<description>
|
|
<para>
|
|
If the data (third) parameter is a transform environment, it returns the value associated
|
|
with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns
|
|
the data parameter unmodified.
|
|
</para>
|
|
<para>
|
|
<emphasis role="bold">Example:</emphasis>
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
std::string str("hello");
|
|
std::string & d1 = proto::_data()(i, 'a', str);
|
|
assert( &str == &d1 );
|
|
|
|
std::string & d2 = proto::_data()(i, 'a', (<globalname>proto::data</globalname> = boost::ref(str)));
|
|
assert( &str == &d2 );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><type>
|
|
mpl::if_c<
|
|
<classname>proto::is_env</classname><Data>::value,
|
|
<classname>proto::_env_var</classname><<classname>proto::data_type</classname>>,
|
|
<classname>proto::_env</classname>
|
|
>::type::template impl<Expr, State, Data></type></inherit>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_child_c">
|
|
<template>
|
|
<template-nontype-parameter name="N">
|
|
<type>int</type>
|
|
</template-nontype-parameter>
|
|
</template>
|
|
<inherit><classname>proto::transform</classname>< _child_c<N> ></inherit>
|
|
<purpose>A <conceptname>PrimitiveTransform</conceptname> that returns N-th child of the current expression. </purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
<classname>proto::terminal</classname><int>::type & j = proto::_child_c<0>()(-i);
|
|
assert( boost::addressof(i) == boost::addressof(j) );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit>
|
|
<typedef name="result_type">
|
|
<type>typename <classname>proto::result_of::child_c</classname>< Expr, N >::type</type>
|
|
</typedef>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>typename <classname>proto::result_of::child_c</classname>< Expr, N >::type</type>
|
|
<parameter name="expr">
|
|
<paramtype>typename impl::expr_param</paramtype>
|
|
<description>
|
|
<para>The current expression. </para>
|
|
</description>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::state_param</paramtype>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::data_param</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Returns the N-th child of <computeroutput>expr</computeroutput>
|
|
</para>
|
|
</description>
|
|
<requires>
|
|
<para>
|
|
<computeroutput>Expr::proto_arity::value > N</computeroutput>
|
|
</para>
|
|
</requires>
|
|
<returns>
|
|
<para>
|
|
<computeroutput><functionname>proto::child_c</functionname><N>(expr)</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_value">
|
|
<inherit><classname>proto::transform</classname>< _value ></inherit>
|
|
<purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the value of the current terminal expression. </purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
int j = proto::_value()(i);
|
|
assert( 42 == j );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit>
|
|
<typedef name="result_type">
|
|
<type>typename <classname>proto::result_of::value</classname>< Expr >::type</type>
|
|
</typedef>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>typename <classname>proto::result_of::value</classname>< Expr >::type</type>
|
|
<parameter name="expr">
|
|
<paramtype>typename impl::expr_param</paramtype>
|
|
<description>
|
|
<para>The current expression. </para>
|
|
</description>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::state_param</paramtype>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::data_param</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Returns the value of the specified terminal expression.
|
|
</para>
|
|
</description>
|
|
<requires>
|
|
<para>
|
|
<computeroutput>Expr::proto_arity::value == 0</computeroutput>.
|
|
</para>
|
|
</requires>
|
|
<returns>
|
|
<para>
|
|
<computeroutput><functionname>proto::value</functionname>(expr)</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_void">
|
|
<inherit><classname>proto::transform</classname>< _void ></inherit>
|
|
<purpose>A <conceptname>PrimitiveTransform</conceptname> that does nothing and returns void. </purpose>
|
|
<struct name="impl">
|
|
<template>
|
|
<template-type-parameter name="Expr"/>
|
|
<template-type-parameter name="State"/>
|
|
<template-type-parameter name="Data"/>
|
|
</template>
|
|
<inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit>
|
|
<typedef name="result_type">
|
|
<type>void</type>
|
|
</typedef>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>void</type>
|
|
<parameter name="">
|
|
<paramtype>typename impl::expr_param</paramtype>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::state_param</paramtype>
|
|
</parameter>
|
|
<parameter name="">
|
|
<paramtype>typename impl::data_param</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Does nothing.
|
|
</para>
|
|
</description>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</struct>
|
|
|
|
<struct name="_byref">
|
|
<inherit><classname>proto::callable</classname></inherit>
|
|
<purpose>A unary callable <conceptname>PolymorphicFunctionObject</conceptname> that wraps its argument
|
|
in a <computeroutput>boost::reference_wrapper<></computeroutput>.</purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
boost::reference_wrapper<<classname>proto::terminal</classname><int>::type> j
|
|
= <classname>proto::when</classname><<classname>proto::_</classname>, proto::_byref(_)>()(i);
|
|
assert( boost::addressof(i) == boost::addressof(j.get()) );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(T &)</template-arg>
|
|
</specialization>
|
|
<typedef name="type">
|
|
<type>boost::reference_wrapper< T > const</type>
|
|
</typedef>
|
|
</struct-specialization>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(T)</template-arg>
|
|
</specialization>
|
|
<typedef name="type">
|
|
<type>boost::reference_wrapper< T const > const</type>
|
|
</typedef>
|
|
</struct-specialization>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>boost::reference_wrapper< T > const</type>
|
|
<template>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<parameter name="t">
|
|
<paramtype>T &</paramtype>
|
|
<description>
|
|
<para>The object to wrap </para>
|
|
</description>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Wrap the parameter <computeroutput>t</computeroutput> in a
|
|
<computeroutput>boost::reference_wrapper<></computeroutput>
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>boost::ref(t)</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
<method name="operator()" cv="const">
|
|
<type>boost::reference_wrapper< T const > const</type>
|
|
<template>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<parameter name="t">
|
|
<paramtype>T const &</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para>
|
|
</description>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
|
|
<struct name="_byval">
|
|
<inherit><classname>proto::callable</classname></inherit>
|
|
<purpose>
|
|
A unary callable <conceptname>PolymorphicFunctionObject</conceptname> that strips references and
|
|
<computeroutput>boost::reference_wrapper<></computeroutput> from its argument.
|
|
</purpose>
|
|
<description>
|
|
<para>
|
|
Example:
|
|
<programlisting><classname>proto::terminal</classname><int>::type i = {42};
|
|
int j = 67;
|
|
int k = <classname>proto::when</classname><<classname>proto::_</classname>, proto::_byval(<classname>proto::_state</classname>)>()(i, boost::ref(j));
|
|
assert( 67 == k );</programlisting>
|
|
</para>
|
|
</description>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(boost::reference_wrapper< T >)</template-arg>
|
|
</specialization>
|
|
<inherit>result<This(T)></inherit>
|
|
</struct-specialization>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(T &)</template-arg>
|
|
</specialization>
|
|
<inherit>result<This(T)></inherit>
|
|
</struct-specialization>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(T)</template-arg>
|
|
</specialization>
|
|
<typedef name="type">
|
|
<type>T</type>
|
|
</typedef>
|
|
</struct-specialization>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>T</type>
|
|
<template>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<parameter name="t">
|
|
<paramtype>T const &</paramtype>
|
|
<description>
|
|
<para>The object to unref </para>
|
|
</description>
|
|
</parameter>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>t</computeroutput>
|
|
</para>
|
|
</returns>
|
|
<throws>
|
|
<simpara>Will not throw.</simpara>
|
|
</throws>
|
|
</method>
|
|
<method name="operator()" cv="const">
|
|
<type>T</type>
|
|
<template>
|
|
<template-type-parameter name="T"/>
|
|
</template>
|
|
<parameter name="t">
|
|
<paramtype>boost::reference_wrapper< T > const &</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para>
|
|
</description>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</namespace>
|
|
</namespace>
|
|
</header>
|