PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/contrib/boost/spirit/home/classic/actor/decrement_actor.hpp

http://pythonocc.googlecode.com/
C++ Header | 60 lines | 24 code | 8 blank | 28 comment | 0 complexity | 31fb10a54021baad1f845dd175fe64d9 MD5 | raw file
 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_DECREMENT_ACTOR_HPP
 9#define BOOST_SPIRIT_ACTOR_DECREMENT_ACTOR_HPP
10
11#include <boost/spirit/home/classic/namespace.hpp>
12#include <boost/spirit/home/classic/actor/ref_actor.hpp>
13
14namespace boost { namespace spirit {
15
16BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
17
18    ///////////////////////////////////////////////////////////////////////////
19    //  Summary:
20    //  A semantic action policy that calls the -- operator on a reference.
21    //  (This doc uses convention available in actors.hpp)
22    //
23    //  Actions:
24    //      --ref;
25    //
26    //  Policy name:
27    //      decrement_action
28    //
29    //  Policy holder, corresponding helper method:
30    //      ref_actor, decrement_a( ref );
31    //
32    //  () operators: both.
33    //
34    //  See also ref_actor for more details.
35    ///////////////////////////////////////////////////////////////////////////
36    struct decrement_action
37    {
38        template<
39            typename T
40        >
41        void act(T& ref_) const
42        {
43            --ref_;
44        }
45    };
46
47    ///////////////////////////////////////////////////////////////////////////
48    // helper method that creates a and_assign_actor.
49    ///////////////////////////////////////////////////////////////////////////
50    template<typename T>
51    inline ref_actor<T,decrement_action> decrement_a(T& ref_)
52    {
53        return ref_actor<T,decrement_action>(ref_);
54    }
55
56BOOST_SPIRIT_CLASSIC_NAMESPACE_END
57
58}}
59
60#endif