source: NonGTP/Boost/boost/spirit/actor/ref_const_ref_actor.hpp @ 857

Revision 857, 2.2 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3    http://spirit.sourceforge.net/
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8=============================================================================*/
9#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
10#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
11
12namespace boost { namespace spirit {
13
14    ///////////////////////////////////////////////////////////////////////////
15    //  Summary:
16    //  A semantic action policy holder. This holder stores a reference to ref
17    //  and a const reference to value_ref.
18    //  act methods are feed with ref and value_ref. The parse result is
19    //  not used by this holder.
20    //
21    //  (This doc uses convention available in actors.hpp)
22    //
23    //  Constructor:
24    //      ...(T& ref_, ValueT const& value_ref_);
25    //      where ref_ and value_ref_ are stored in the holder.
26    //
27    //  Action calls:
28    //      act(ref, value_ref);
29    //
30    //  () operators: both
31    //
32    ///////////////////////////////////////////////////////////////////////////
33    template<
34        typename T,
35        typename ValueT,
36        typename ActionT
37    >
38    class ref_const_ref_actor : public ActionT
39    {
40    private:
41        T& ref;
42        ValueT const& value_ref;
43    public:
44        ref_const_ref_actor(
45            T& ref_,
46            ValueT const& value_ref_
47            )
48        :
49            ref(ref_),
50            value_ref(value_ref_)
51        {}
52
53
54        template<typename T2>
55        void operator()(T2 const& /*val*/) const
56        {
57            this->act(ref,value_ref); // defined in ActionT
58        }
59
60
61        template<typename IteratorT>
62            void operator()(
63            IteratorT const& /*first*/,
64            IteratorT const& /*last*/
65            ) const
66        {
67            this->act(ref,value_ref); // defined in ActionT
68        }
69    };
70
71}}
72
73#endif
Note: See TracBrowser for help on using the repository browser.