Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:01:52

0001 /*=============================================================================
0002     Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
0003     http://spirit.sourceforge.net/
0004 
0005   Distributed under the Boost Software License, Version 1.0. (See accompanying
0006   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 =============================================================================*/
0008 #ifndef BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
0009 #define BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
0010 
0011 #include <boost/spirit/home/classic/namespace.hpp>
0012 #include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
0013 #include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
0014 
0015 namespace boost { namespace spirit {
0016 
0017 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0018 
0019     struct assign_key_action
0020     {
0021         template<
0022             typename T,
0023             typename ValueT,
0024             typename KeyT
0025         >
0026         void act(T& ref_, ValueT const& value_, KeyT const& key_) const
0027         {
0028             ref_[ key_ ] = value_;
0029         }
0030 
0031         template<
0032             typename T,
0033             typename ValueT,
0034             typename IteratorT
0035         >
0036         void act(
0037             T& ref_,
0038             ValueT const& value_,
0039             IteratorT const& first_,
0040             IteratorT const& last_
0041             ) const
0042         {
0043             typedef typename T::key_type key_type;
0044             key_type key(first_,last_);
0045 
0046             ref_[key] = value_;
0047         }
0048     };
0049 
0050     template<
0051         typename T,
0052         typename ValueT
0053     >
0054     inline ref_const_ref_value_actor<T,ValueT,assign_key_action>
0055         assign_key_a(T& ref_, ValueT const& value_)
0056     {
0057         return ref_const_ref_value_actor<T,ValueT,assign_key_action>(
0058             ref_,
0059             value_
0060             );
0061     }
0062 
0063     template<
0064         typename T,
0065         typename ValueT,
0066         typename KeyT
0067     >
0068     inline ref_const_ref_const_ref_actor<
0069         T,
0070         ValueT,
0071         KeyT,
0072         assign_key_action
0073     >
0074         assign_key_a(
0075             T& ref_,
0076             ValueT const& value_,
0077             KeyT const& key_
0078     )
0079     {
0080         return ref_const_ref_const_ref_actor<
0081             T,
0082             ValueT,
0083             KeyT,
0084             assign_key_action
0085         >(
0086             ref_,
0087             value_,
0088             key_
0089             );
0090     }
0091 
0092 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0093 
0094 }}
0095 
0096 #endif