• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2010-2011 Christopher Schmidt
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_DEFINE_ASSOC_STRUCT_HPP
9 #define BOOST_FUSION_ADAPTED_STRUCT_DEFINE_ASSOC_STRUCT_HPP
10 
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
13 #include <boost/fusion/adapted/struct/detail/define_struct.hpp>
14 #include <boost/preprocessor/cat.hpp>
15 
16 #define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(X, Y, Z)                      \
17     ((X, Y, Z)) BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1
18 #define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1(X, Y, Z)                      \
19     ((X, Y, Z)) BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0
20 #define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0_END
21 #define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1_END
22 
23 #define BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT(                                   \
24     TEMPLATE_PARAMS_SEQ, NAMESPACE_SEQ, NAME, ATTRIBUTES)                       \
25                                                                                 \
26     BOOST_FUSION_DEFINE_TPL_STRUCT_IMPL(                                        \
27         TEMPLATE_PARAMS_SEQ,                                                    \
28         (0)NAMESPACE_SEQ,                                                       \
29         NAME,                                                                   \
30         BOOST_PP_CAT(                                                           \
31             BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END),   \
32         3)                                                                      \
33                                                                                 \
34     BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(                                        \
35         TEMPLATE_PARAMS_SEQ,                                                    \
36         (BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME)\
37             TEMPLATE_PARAMS_SEQ,                                                \
38         ATTRIBUTES)
39 
40 #define BOOST_FUSION_DEFINE_ASSOC_STRUCT(NAMESPACE_SEQ, NAME, ATTRIBUTES)       \
41     BOOST_FUSION_DEFINE_STRUCT_IMPL(                                            \
42         (0)NAMESPACE_SEQ,                                                       \
43         NAME,                                                                   \
44         BOOST_PP_CAT(                                                           \
45             BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END),   \
46         3)                                                                      \
47                                                                                 \
48     BOOST_FUSION_ADAPT_ASSOC_STRUCT(                                            \
49         BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME, \
50         ATTRIBUTES)
51 
52 #endif
53