123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- <?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>
|