[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_VALUE_ACTOR_HPP
|
---|
| 10 | #define BOOST_SPIRIT_ACTOR_REF_CONST_REF_VALUE_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 | // and a const reference to value_ref.
|
---|
| 18 | // act methods are feed with ref, value_ref and the parse result.
|
---|
| 19 | //
|
---|
| 20 | // (This doc uses convention available in actors.hpp)
|
---|
| 21 | //
|
---|
| 22 | // Constructor:
|
---|
| 23 | // ...(T& ref_, ValueT const& value_ref_);
|
---|
| 24 | // where ref_ and value_ref_ are stored in the holder.
|
---|
| 25 | //
|
---|
| 26 | // Action calls:
|
---|
| 27 | // act(ref, value_ref, value);
|
---|
| 28 | // act(ref, value_ref, first, last);
|
---|
| 29 | //
|
---|
| 30 | // () operators: both
|
---|
| 31 | //
|
---|
| 32 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 33 | template<
|
---|
| 34 | typename T,
|
---|
| 35 | typename ValueT,
|
---|
| 36 | typename ActionT
|
---|
| 37 | >
|
---|
| 38 | class ref_const_ref_value_actor : public ActionT
|
---|
| 39 | {
|
---|
| 40 | private:
|
---|
| 41 | T& ref;
|
---|
| 42 | ValueT const& value_ref;
|
---|
| 43 | public:
|
---|
| 44 | ref_const_ref_value_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,val_); // 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,first_,last_); // defined in ActionT
|
---|
| 68 | }
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 | }}
|
---|
| 72 |
|
---|
| 73 | #endif
|
---|