[857] | 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_CONST_REF_ACTOR_HPP
|
---|
| 10 | #define BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP
|
---|
| 11 |
|
---|
| 12 | namespace boost { namespace spirit {
|
---|
| 13 |
|
---|
| 14 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 15 | // Summary:
|
---|
| 16 | // A semantic action policy holder. This holder stores a reference to ref
|
---|
| 17 | // , a const reference to value1_ref and a const reference to value2_ref.
|
---|
| 18 | // Typically, value1_ref is a key and value2_ref is value for associative
|
---|
| 19 | // container operations.
|
---|
| 20 | // act methods are feed with ref, value1_ref, value2_ref. The parse result
|
---|
| 21 | // is not used by this holder.
|
---|
| 22 | //
|
---|
| 23 | // (This doc uses convention available in actors.hpp)
|
---|
| 24 | //
|
---|
| 25 | // Constructor:
|
---|
| 26 | // ...(
|
---|
| 27 | // T& ref_,
|
---|
| 28 | // Value1T const& value1_ref_,
|
---|
| 29 | // Value2T const& value2_ref_ );
|
---|
| 30 | // where ref_, value1_ref and value2_ref_ are stored in the holder.
|
---|
| 31 | //
|
---|
| 32 | // Action calls:
|
---|
| 33 | // act(ref, value1_ref, value2_ref);
|
---|
| 34 | //
|
---|
| 35 | // () operators: both
|
---|
| 36 | //
|
---|
| 37 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 38 | template<
|
---|
| 39 | typename T,
|
---|
| 40 | typename Value1T,
|
---|
| 41 | typename Value2T,
|
---|
| 42 | typename ActionT
|
---|
| 43 | >
|
---|
| 44 | class ref_const_ref_const_ref_actor : public ActionT
|
---|
| 45 | {
|
---|
| 46 | private:
|
---|
| 47 | T& ref;
|
---|
| 48 | Value1T const& value1_ref;
|
---|
| 49 | Value2T const& value2_ref;
|
---|
| 50 | public:
|
---|
| 51 | ref_const_ref_const_ref_actor(
|
---|
| 52 | T& ref_,
|
---|
| 53 | Value1T const& value1_ref_,
|
---|
| 54 | Value2T const& value2_ref_
|
---|
| 55 | )
|
---|
| 56 | :
|
---|
| 57 | ref(ref_),
|
---|
| 58 | value1_ref(value1_ref_),
|
---|
| 59 | value2_ref(value2_ref_)
|
---|
| 60 | {}
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | template<typename T2>
|
---|
| 64 | void operator()(T2 const& /*val*/) const
|
---|
| 65 | {
|
---|
| 66 | this->act(ref,value1_ref,value2_ref); // defined in ActionT
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 |
|
---|
| 70 | template<typename IteratorT>
|
---|
| 71 | void operator()(
|
---|
| 72 | IteratorT const& /*first*/,
|
---|
| 73 | IteratorT const& /*last*/
|
---|
| 74 | ) const
|
---|
| 75 | {
|
---|
| 76 | this->act(ref,value1_ref,value2_ref); // defined in ActionT
|
---|
| 77 | }
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | }}
|
---|
| 81 |
|
---|
| 82 | #endif
|
---|