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