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