]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2014 Joel de Guzman | |
3 | Copyright (c) 2001-2012 Hartmut Kaiser | |
4 | http://spirit.sourceforge.net/ | |
5 | ||
6 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | =============================================================================*/ | |
9 | #if !defined(BOOST_SPIRIT_X3_ATTRIBUTE_TRANSFORM_JAN_8_2012_0721PM) | |
10 | #define BOOST_SPIRIT_X3_ATTRIBUTE_TRANSFORM_JAN_8_2012_0721PM | |
11 | ||
12 | #include <boost/mpl/identity.hpp> | |
13 | ||
14 | namespace boost { namespace spirit { namespace x3 { namespace traits | |
15 | { | |
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // transform_attribute | |
18 | // | |
19 | // Sometimes the user needs to transform the attribute types for certain | |
20 | // attributes. This template can be used as a customization point, where | |
21 | // the user is able specify specific transformation rules for any attribute | |
22 | // type. | |
23 | /////////////////////////////////////////////////////////////////////////// | |
24 | template <typename Exposed, typename Transformed, typename Tag | |
25 | , typename Enable = void> | |
26 | struct transform_attribute; | |
27 | ||
28 | /////////////////////////////////////////////////////////////////////////// | |
29 | template <typename Tag, typename Transformed, typename Exposed> | |
30 | typename transform_attribute<Exposed, Transformed, Tag>::type | |
31 | pre_transform(Exposed& attr) | |
32 | { | |
33 | return transform_attribute<Exposed, Transformed, Tag>::pre(attr); | |
34 | } | |
35 | ||
36 | template <typename Tag, typename Transformed, typename Exposed> | |
37 | typename transform_attribute<Exposed, Transformed, Tag>::type | |
38 | pre_transform(Exposed const& attr) | |
39 | { | |
40 | return transform_attribute<Exposed const, Transformed, Tag>::pre(attr); | |
41 | } | |
42 | }}}} | |
43 | ||
44 | #endif |