Rev | Line | |
---|
[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_VALUE_ACTOR_HPP
|
---|
| 10 | #define BOOST_SPIRIT_ACTOR_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 | // act methods are feed with ref and the parse result.
|
---|
| 18 | //
|
---|
| 19 | // (This doc uses convention available in actors.hpp)
|
---|
| 20 | //
|
---|
| 21 | // Constructor:
|
---|
| 22 | // ...(T& ref_);
|
---|
| 23 | // where ref_ is stored.
|
---|
| 24 | //
|
---|
| 25 | // Action calls:
|
---|
| 26 | // act(ref, value);
|
---|
| 27 | // act(ref, first,last);
|
---|
| 28 | //
|
---|
| 29 | // () operators: both
|
---|
| 30 | //
|
---|
| 31 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 32 | template<
|
---|
| 33 | typename T,
|
---|
| 34 | typename ActionT
|
---|
| 35 | >
|
---|
| 36 | class ref_value_actor : public ActionT
|
---|
| 37 | {
|
---|
| 38 | private:
|
---|
| 39 | T& ref;
|
---|
| 40 | public:
|
---|
| 41 | explicit
|
---|
| 42 | ref_value_actor(T& ref_)
|
---|
| 43 | : ref(ref_){}
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | template<typename T2>
|
---|
| 47 | void operator()(T2 const& val_) const
|
---|
| 48 | {
|
---|
| 49 | this->act(ref,val_); // defined in ActionT
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | template<typename IteratorT>
|
---|
| 54 | void operator()(
|
---|
| 55 | IteratorT const& first_,
|
---|
| 56 | IteratorT const& last_
|
---|
| 57 | ) const
|
---|
| 58 | {
|
---|
| 59 | this->act(ref,first_,last_); // defined in ActionT
|
---|
| 60 | }
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | }}
|
---|
| 64 |
|
---|
| 65 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.