]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2013-2014 Damien Buhl | |
3 | ||
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ==============================================================================*/ | |
7 | ||
8 | #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP | |
9 | #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP | |
10 | ||
11 | #include <boost/config.hpp> | |
12 | ||
13 | #include <boost/fusion/adapted/struct/detail/adapt_auto.hpp> | |
14 | #include <boost/fusion/adapted/struct/detail/preprocessor/is_seq.hpp> | |
15 | ||
16 | #include <boost/mpl/aux_/preprocessor/token_equal.hpp> | |
17 | ||
18 | #include <boost/preprocessor/config/config.hpp> | |
19 | #include <boost/preprocessor/control/iif.hpp> | |
20 | #include <boost/preprocessor/control/expr_iif.hpp> | |
21 | #include <boost/preprocessor/logical/compl.hpp> | |
22 | #include <boost/preprocessor/tuple/elem.hpp> | |
23 | #include <boost/preprocessor/seq/for_each.hpp> | |
24 | #include <boost/preprocessor/seq/push_front.hpp> | |
25 | #include <boost/preprocessor/facilities/expand.hpp> | |
26 | #include <boost/preprocessor/facilities/is_empty.hpp> | |
27 | ||
28 | ||
29 | #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \ | |
30 | BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X,Y) \ | |
31 | BOOST_FUSION_ADAPT_STRUCT_FILLER_1 | |
32 | ||
33 | #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \ | |
34 | BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X,Y) \ | |
35 | BOOST_FUSION_ADAPT_STRUCT_FILLER_0 | |
36 | ||
37 | #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END | |
38 | #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END | |
39 | ||
40 | #define BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X, Y) \ | |
41 | BOOST_PP_IIF(BOOST_MPL_PP_TOKEN_EQUAL(auto, BOOST_PP_EXPAND(X)), \ | |
42 | ((1, (Y))), \ | |
43 | ((2, (X,Y))) \ | |
44 | ) | |
45 | ||
46 | #define BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE) \ | |
47 | BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) | |
48 | ||
49 | #define BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR(ATTRIBUTE) \ | |
50 | BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE) | |
51 | ||
52 | ||
53 | #if BOOST_PP_VARIADICS | |
54 | ||
55 | # define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP(r, unused, elem) \ | |
56 | BOOST_PP_IIF(BOOST_FUSION_PP_IS_SEQ(elem), \ | |
57 | BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 elem ,_END), \ | |
58 | BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(BOOST_PP_IS_EMPTY(elem)), \ | |
59 | BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(auto, elem))) | |
60 | ||
61 | # define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(VA_ARGS_SEQ) \ | |
62 | BOOST_PP_SEQ_PUSH_FRONT( \ | |
63 | BOOST_PP_SEQ_FOR_EACH( \ | |
64 | BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP, \ | |
65 | unused, VA_ARGS_SEQ), \ | |
66 | (0,0)) | |
67 | ||
68 | #endif // BOOST_PP_VARIADICS | |
69 | ||
70 | #endif |