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_CLEAR_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP
10 
11 #include <boost/spirit/home/classic/namespace.hpp>
12 #include <boost/spirit/home/classic/actor/ref_actor.hpp>
13 
14 namespace boost { namespace spirit {
15 
16 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
17 
18     ///////////////////////////////////////////////////////////////////////////
19     //  Summary:
20     //  A semantic action policy that calls clear method.
21     //  (This doc uses convention available in actors.hpp)
22     //
23     //  Actions (what it does):
24     //      ref.clear();
25     //
26     //  Policy name:
27     //      clear_action
28     //
29     //  Policy holder, corresponding helper method:
30     //      ref_actor, clear_a( ref );
31     //
32     //  () operators: both.
33     //
34     //  See also ref_actor for more details.
35     ///////////////////////////////////////////////////////////////////////////
36     struct clear_action
37     {
38         template<
39             typename T
40         >
actboost::spirit::clear_action41         void act(T& ref_) const
42         {
43             ref_.clear();
44         }
45     };
46 
47     ///////////////////////////////////////////////////////////////////////////
48     // helper method that creates a and_assign_actor.
49     ///////////////////////////////////////////////////////////////////////////
50     template<typename T>
clear_a(T & ref_)51     inline ref_actor<T,clear_action> clear_a(T& ref_)
52     {
53         return ref_actor<T,clear_action>(ref_);
54     }
55 
56 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
57 
58 }}
59 
60 #endif
61 
62