adapt_base_assoc_attr_filler.hpp 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*=============================================================================
  2. Copyright (c) 2013-2014 Damien Buhl
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #ifndef BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
  7. #define BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
  8. #include <boost/config.hpp>
  9. #include <boost/fusion/adapted/struct/detail/adapt_auto.hpp>
  10. #include <boost/fusion/adapted/adt/detail/adapt_base_attr_filler.hpp>
  11. #include <boost/mpl/aux_/preprocessor/token_equal.hpp>
  12. #include <boost/preprocessor/config/config.hpp>
  13. #include <boost/preprocessor/control/iif.hpp>
  14. #include <boost/preprocessor/variadic/size.hpp>
  15. #include <boost/preprocessor/arithmetic/dec.hpp>
  16. #if BOOST_PP_VARIADICS
  17. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(...) \
  18. BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
  19. BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
  20. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(...) \
  21. BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
  22. BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
  23. #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(...) \
  24. ((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
  25. #else // BOOST_PP_VARIADICS
  26. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(A, B, C, D, E) \
  27. BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
  28. BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
  29. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(A, B, C, D, E) \
  30. BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
  31. BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
  32. #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
  33. BOOST_PP_IIF(BOOST_MPL_PP_TOKEN_EQUAL(auto, A), \
  34. ((3, (C,D,E))), \
  35. ((5, (A,B,C,D,E))) \
  36. )
  37. #endif // BOOST_PP_VARIADICS
  38. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0_END
  39. #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1_END
  40. #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) \
  41. BOOST_PP_TUPLE_ELEM( \
  42. BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
  43. BOOST_PP_DEC(BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE)), \
  44. BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE))
  45. #endif