1 /*============================================================================= 2 Copyright (c) 2001-2009 Joel de Guzman 3 Copyright (c) 2007 Dan Marsden 4 Copyright (c) 2010-2011 Christopher Schmidt 5 Copyright (c) 2013-2014 Damien Buhl 6 7 Distributed under the Boost Software License, Version 1.0. (See accompanying 8 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 ==============================================================================*/ 10 11 #ifndef BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_HPP 12 #define BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_HPP 13 14 #include <boost/fusion/support/config.hpp> 15 #include <boost/preprocessor/cat.hpp> 16 #include <boost/preprocessor/empty.hpp> 17 #include <boost/preprocessor/control/if.hpp> 18 19 #include <boost/fusion/adapted/struct/detail/extension.hpp> 20 #include <boost/fusion/adapted/struct/detail/adapt_base.hpp> 21 #include <boost/fusion/adapted/struct/detail/at_impl.hpp> 22 #include <boost/fusion/adapted/struct/detail/is_view_impl.hpp> 23 #include <boost/fusion/adapted/struct/detail/proxy_type.hpp> 24 #include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp> 25 #include <boost/fusion/adapted/struct/detail/value_at_impl.hpp> 26 #include <boost/fusion/adapted/struct/detail/category_of_impl.hpp> 27 #include <boost/fusion/adapted/struct/detail/size_impl.hpp> 28 #include <boost/fusion/adapted/struct/detail/begin_impl.hpp> 29 #include <boost/fusion/adapted/struct/detail/end_impl.hpp> 30 #include <boost/fusion/adapted/struct/detail/value_of_impl.hpp> 31 #include <boost/fusion/adapted/struct/detail/deref_impl.hpp> 32 #include <boost/fusion/adapted/struct/detail/deref_data_impl.hpp> 33 #include <boost/fusion/adapted/struct/detail/key_of_impl.hpp> 34 #include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp> 35 #include <boost/fusion/adapted/adt/detail/extension.hpp> 36 #include <boost/fusion/adapted/adt/detail/adapt_base.hpp> 37 #include <boost/fusion/adapted/adt/detail/adapt_base_assoc_attr_filler.hpp> 38 39 #define BOOST_FUSION_ADAPT_ASSOC_ADT_C( \ 40 TEMPLATE_PARAMS_SEQ, NAME_SEQ, IS_VIEW, I, ATTRIBUTE) \ 41 \ 42 BOOST_FUSION_ADAPT_ADT_C_BASE( \ 43 TEMPLATE_PARAMS_SEQ, \ 44 NAME_SEQ, \ 45 I, \ 46 BOOST_PP_IIF(IS_VIEW, BOOST_FUSION_PROXY_PREFIX, BOOST_PP_EMPTY), \ 47 BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE), \ 48 BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \ 49 BOOST_PP_LESS( \ 50 BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), 5)) \ 51 \ 52 template< \ 53 BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ 54 > \ 55 struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \ 56 { \ 57 typedef BOOST_FUSION_ADAPT_ASSOC_ADT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) type;\ 58 }; 59 60 #define BOOST_FUSION_ADAPT_ASSOC_TPL_ADT( \ 61 TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \ 62 \ 63 BOOST_FUSION_ADAPT_STRUCT_BASE( \ 64 (1)TEMPLATE_PARAMS_SEQ, \ 65 (1)NAME_SEQ, \ 66 assoc_struct_tag, \ 67 0, \ 68 BOOST_PP_CAT( \ 69 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \ 70 BOOST_FUSION_ADAPT_ASSOC_ADT_C) 71 72 #define BOOST_FUSION_ADAPT_ASSOC_ADT(NAME, ATTRIBUTES) \ 73 BOOST_FUSION_ADAPT_STRUCT_BASE( \ 74 (0), \ 75 (0)(NAME), \ 76 assoc_struct_tag, \ 77 0, \ 78 BOOST_PP_CAT( \ 79 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \ 80 BOOST_FUSION_ADAPT_ASSOC_ADT_C) 81 82 #define BOOST_FUSION_ADAPT_ASSOC_ADT_AS_VIEW(NAME, ATTRIBUTES) \ 83 BOOST_FUSION_ADAPT_STRUCT_BASE( \ 84 (0), \ 85 (0)(NAME), \ 86 assoc_struct_tag, \ 87 1, \ 88 BOOST_PP_CAT( \ 89 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \ 90 BOOST_FUSION_ADAPT_ASSOC_ADT_C) 91 92 #endif 93