1 //  Copyright (c) 2001-2011 Hartmut Kaiser
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #if !defined(SPIRIT_SUPPORT_ATTR_CAST_OCT_06_2009_00535PM)
7 #define SPIRIT_SUPPORT_ATTR_CAST_OCT_06_2009_00535PM
8 
9 #if defined(_MSC_VER)
10 #pragma once
11 #endif
12 
13 #include <boost/spirit/home/support/common_terminals.hpp>
14 #include <boost/spirit/home/support/attributes.hpp>
15 #include <boost/utility/enable_if.hpp>
16 
17 namespace boost { namespace spirit
18 {
19     ///////////////////////////////////////////////////////////////////////////
20     // This one is the function that the user can call directly in order
21     // to create a customized attr_cast component
22     template <typename Expr>
23     typename enable_if<proto::is_expr<Expr>
24       , stateful_tag_type<Expr, tag::attr_cast> >::type
attr_cast(Expr const & expr)25     attr_cast(Expr const& expr)
26     {
27         return stateful_tag_type<Expr, tag::attr_cast>(expr);
28     }
29 
30     template <typename Exposed, typename Expr>
31     typename enable_if<proto::is_expr<Expr>
32       , stateful_tag_type<Expr, tag::attr_cast, Exposed> >::type
attr_cast(Expr const & expr)33     attr_cast(Expr const& expr)
34     {
35         return stateful_tag_type<Expr, tag::attr_cast, Exposed>(expr);
36     }
37 
38     template <typename Exposed, typename Transformed, typename Expr>
39     typename enable_if<proto::is_expr<Expr>
40       , stateful_tag_type<Expr, tag::attr_cast, Exposed, Transformed> >::type
attr_cast(Expr const & expr)41     attr_cast(Expr const& expr)
42     {
43         return stateful_tag_type<Expr, tag::attr_cast, Exposed, Transformed>(expr);
44     }
45 }}
46 
47 #endif
48