adapt_struct.hpp 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*=============================================================================
  2. Copyright (c) 2001-2007 Joel de Guzman
  3. Copyright (c) 2009-2011 Christopher Schmidt
  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. #ifndef BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
  8. #define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
  9. #include <boost/preprocessor/cat.hpp>
  10. #include <boost/preprocessor/empty.hpp>
  11. #include <boost/type_traits/add_reference.hpp>
  12. #include <boost/type_traits/is_const.hpp>
  13. #include <boost/type_traits/add_const.hpp>
  14. #include <boost/type_traits/remove_const.hpp>
  15. #include <boost/fusion/adapted/struct/detail/extension.hpp>
  16. #include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
  17. #include <boost/fusion/adapted/struct/detail/at_impl.hpp>
  18. #include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
  19. #include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
  20. #include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
  21. #include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
  22. #include <boost/fusion/adapted/struct/detail/size_impl.hpp>
  23. #include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
  24. #include <boost/fusion/adapted/struct/detail/end_impl.hpp>
  25. #include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
  26. #include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
  27. #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \
  28. ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_1
  29. #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \
  30. ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_0
  31. #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
  32. #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
  33. #define BOOST_FUSION_ADAPT_STRUCT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE)\
  34. BOOST_FUSION_ADAPT_STRUCT_C_BASE( \
  35. TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE,2)
  36. #define BOOST_FUSION_ADAPT_TPL_STRUCT(TEMPLATE_PARAMS_SEQ,NAME_SEQ, ATTRIBUTES) \
  37. BOOST_FUSION_ADAPT_STRUCT_BASE( \
  38. (1)TEMPLATE_PARAMS_SEQ, \
  39. (1)NAME_SEQ, \
  40. struct_tag, \
  41. 0, \
  42. ((0,0)) BOOST_PP_CAT( \
  43. BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
  44. BOOST_FUSION_ADAPT_STRUCT_C)
  45. #define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \
  46. BOOST_FUSION_ADAPT_STRUCT_BASE( \
  47. (0), \
  48. (0)(NAME), \
  49. struct_tag, \
  50. 0, \
  51. BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
  52. BOOST_FUSION_ADAPT_STRUCT_C)
  53. #define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
  54. BOOST_FUSION_ADAPT_STRUCT_BASE( \
  55. (0), \
  56. (0)(NAME), \
  57. struct_tag, \
  58. 1, \
  59. BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
  60. BOOST_FUSION_ADAPT_STRUCT_C)
  61. #endif