enum.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_ENUM_HPP)
  6. #define BOOST_VMD_ENUM_HPP
  7. #include <boost/vmd/detail/setup.hpp>
  8. #if BOOST_PP_VARIADICS
  9. #include <boost/vmd/detail/sequence_enum.hpp>
  10. /*
  11. The succeeding comments in this file are in doxygen format.
  12. */
  13. /** \file
  14. */
  15. /** \def BOOST_VMD_ENUM(...)
  16. \brief Converts a sequence to comma-separated elements which are the elements of the sequence.
  17. ... = Variadic parameters.
  18. The first variadic parameter is required and is the sequence to convert.
  19. Further optional variadic parameters can be return type parameters. Return type
  20. parameters allow each element in the sequence to be converted to a two-element
  21. tuple where the first tuple element is the type and the second tuple element
  22. is the element data.
  23. The BOOST_VMD_RETURN_NO_TYPE, the default, does not return the type as part of each
  24. converted element but just the data. All of the rest return the type and data as the
  25. two-element tuple. If BOOST_VMD_RETURN_TYPE is specified the specific type of the element
  26. is returned in the tuple. If BOOST_VMD_RETURN_TYPE_ARRAY is specified an array type is
  27. returned if the element is an array, else a tuple type is returned if the element is a tuple,
  28. else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_LIST is specified
  29. a list type is returned if the element is a list, else a tuple type is returned if the element
  30. is a tuple, else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_TUPLE
  31. is specified a tuple type is returned for all tuple-like data, else the actual type is returned
  32. for non-tuple data. If more than one return type optional parameter is specified the last one
  33. specified determines the return type.
  34. returns = Comma-separated data, otherwise known as variadic data.
  35. If the sequence is empty the variadic data is empty. If an
  36. optional return type other than BOOST_VMD_RETURN_NO_TYPE
  37. is specified the type and the data of each element is
  38. returned as part of the variadic data. Otherwise just the data
  39. of each element is returned, which is the default.
  40. */
  41. #define BOOST_VMD_ENUM(...) \
  42. BOOST_VMD_DETAIL_SEQUENCE_ENUM(__VA_ARGS__) \
  43. /**/
  44. /** \def BOOST_VMD_ENUM_D(d,...)
  45. \brief Converts a sequence to comma-separated elements which are the elements of the sequence. Re-entrant version.
  46. d = The next available BOOST_PP_WHILE iteration.
  47. ... = Variadic parameters.
  48. The first variadic parameter is required and is the sequence to convert.
  49. Further optional variadic parameters can be return type parameters. Return type
  50. parameters allow each element in the sequence to be converted to a two-element
  51. tuple where the first tuple element is the type and the second tuple element
  52. is the element data.
  53. The BOOST_VMD_RETURN_NO_TYPE, the default, does not return the type as part of each
  54. converted element but just the data. All of the rest return the type and data as the
  55. two-element tuple. If BOOST_VMD_RETURN_TYPE is specified the specific type of the element
  56. is returned in the tuple. If BOOST_VMD_RETURN_TYPE_ARRAY is specified an array type is
  57. returned if the element is an array, else a tuple type is returned if the element is a tuple,
  58. else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_LIST is specified
  59. a list type is returned if the element is a list, else a tuple type is returned if the element
  60. is a tuple, else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_TUPLE
  61. is specified a tuple type is returned for all tuple-like data, else the actual type is returned
  62. for non-tuple data. If more than one return type optional parameter is specified the last one
  63. specified determines the return type.
  64. returns = Comma-separated data, otherwise known as variadic data.
  65. If the sequence is empty the variadic data is empty. If an
  66. optional return type other than BOOST_VMD_RETURN_NO_TYPE
  67. is specified the type and the data of each element is
  68. returned as part of the variadic data. Otherwise just the data
  69. of each element is returned, which is the default.
  70. */
  71. #define BOOST_VMD_ENUM_D(d,...) \
  72. BOOST_VMD_DETAIL_SEQUENCE_ENUM_D(d,__VA_ARGS__) \
  73. /**/
  74. #endif /* BOOST_PP_VARIADICS */
  75. #endif /* BOOST_VMD_ENUM_HPP */