1 /*=============================================================================
2     Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3     http://spirit.sourceforge.net/
4 
5   Distributed under the Boost Software License, Version 1.0. (See accompanying
6   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP
10 
11 #include <boost/spirit/home/classic/namespace.hpp>
12 
13 namespace boost { namespace spirit {
14 
15 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
16 
17     ///////////////////////////////////////////////////////////////////////////
18     //  Summary:
19     //  A semantic action policy holder. This holder stores a reference to ref
20     //  , a const reference to value1_ref and a const reference to value2_ref.
21     //  Typically, value1_ref is a key and value2_ref is value for associative
22     //  container operations.
23     //  act methods are feed with ref, value1_ref, value2_ref. The parse result
24     //  is not used by this holder.
25     //
26     //  (This doc uses convention available in actors.hpp)
27     //
28     //  Constructor:
29     //      ...(
30     //          T& ref_,
31     //          Value1T const& value1_ref_,
32     //          Value2T const& value2_ref_ );
33     //      where ref_, value1_ref and value2_ref_ are stored in the holder.
34     //
35     //  Action calls:
36     //      act(ref, value1_ref, value2_ref);
37     //
38     //  () operators: both
39     //
40     ///////////////////////////////////////////////////////////////////////////
41     template<
42         typename T,
43         typename Value1T,
44         typename Value2T,
45         typename ActionT
46     >
47     class ref_const_ref_const_ref_actor : public ActionT
48     {
49     private:
50         T& ref;
51         Value1T const& value1_ref;
52         Value2T const& value2_ref;
53     public:
ref_const_ref_const_ref_actor(T & ref_,Value1T const & value1_ref_,Value2T const & value2_ref_)54         ref_const_ref_const_ref_actor(
55             T& ref_,
56             Value1T const& value1_ref_,
57             Value2T const& value2_ref_
58             )
59         :
60             ref(ref_),
61             value1_ref(value1_ref_),
62             value2_ref(value2_ref_)
63         {}
64 
65 
66         template<typename T2>
operator ()(T2 const &) const67         void operator()(T2 const& /*val*/) const
68         {
69             this->act(ref,value1_ref,value2_ref); // defined in ActionT
70         }
71 
72 
73         template<typename IteratorT>
operator ()(IteratorT const &,IteratorT const &) const74             void operator()(
75             IteratorT const& /*first*/,
76             IteratorT const& /*last*/
77             ) const
78         {
79             this->act(ref,value1_ref,value2_ref); // defined in ActionT
80         }
81     };
82 
83 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
84 
85 }}
86 
87 #endif
88