PageRenderTime 36ms CodeModel.GetById 19ms app.highlight 8ms RepoModel.GetById 7ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/classic/actor/assign_key_actor.hpp

http://hadesmem.googlecode.com/
C++ Header | 96 lines | 78 code | 11 blank | 7 comment | 0 complexity | 205e9a3be738a7633e44e14c8b63af3f 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_ASSIGN_KEY_ACTOR_HPP
 9#define BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
10
11#include <boost/spirit/home/classic/namespace.hpp>
12#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
13#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
14
15namespace boost { namespace spirit {
16
17BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
18
19    struct assign_key_action
20    {
21        template<
22            typename T,
23            typename ValueT,
24            typename KeyT
25        >
26        void act(T& ref_, ValueT const& value_, KeyT const& key_) const
27        {
28            ref_[ key_ ] = value_;
29        }
30
31        template<
32            typename T,
33            typename ValueT,
34            typename IteratorT
35        >
36        void act(
37            T& ref_,
38            ValueT const& value_,
39            IteratorT const& first_,
40            IteratorT const& last_
41            ) const
42        {
43            typedef typename T::key_type key_type;
44            key_type key(first_,last_);
45
46            ref_[key] = value_;
47        }
48    };
49
50    template<
51        typename T,
52        typename ValueT
53    >
54    inline ref_const_ref_value_actor<T,ValueT,assign_key_action>
55        assign_key_a(T& ref_, ValueT const& value_)
56    {
57        return ref_const_ref_value_actor<T,ValueT,assign_key_action>(
58            ref_,
59            value_
60            );
61    }
62
63    template<
64        typename T,
65        typename ValueT,
66        typename KeyT
67    >
68    inline ref_const_ref_const_ref_actor<
69        T,
70        ValueT,
71        KeyT,
72        assign_key_action
73    >
74        assign_key_a(
75            T& ref_,
76            ValueT const& value_,
77            KeyT const& key_
78    )
79    {
80        return ref_const_ref_const_ref_actor<
81            T,
82            ValueT,
83            KeyT,
84            assign_key_action
85        >(
86            ref_,
87            value_,
88            key_
89            );
90    }
91
92BOOST_SPIRIT_CLASSIC_NAMESPACE_END
93
94}}
95
96#endif