1 // Copyright Daniel Wallin 2006. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_NAME_HPP 7 #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_NAME_HPP 8 9 #define BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_static () 10 /**/ 11 12 #include <boost/parameter/aux_/preprocessor/is_nullary.hpp> 13 #include <boost/preprocessor/cat.hpp> 14 15 #define BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \ 16 BOOST_PARAMETER_IS_NULLARY( \ 17 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_, name) \ 18 ) 19 /**/ 20 21 #include <boost/preprocessor/seq/seq.hpp> 22 #include <boost/config.hpp> 23 24 #if defined(BOOST_MSVC) 25 26 // Workaround for MSVC preprocessor. 27 // 28 // When stripping static from "static f", msvc will produce " f". The leading 29 // whitespace doesn't go away when pasting the token with something else, so 30 // this thing is a hack to strip the whitespace. 31 #define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static ( 32 /**/ 33 34 #define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \ 35 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name)) 36 /**/ 37 38 #define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \ 39 BOOST_PP_SEQ_HEAD( \ 40 BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \ 41 ) 42 /**/ 43 44 #else 45 46 #define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static 47 /**/ 48 49 #define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \ 50 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name) 51 /**/ 52 53 #endif // MSVC workarounds needed 54 55 #include <boost/preprocessor/control/expr_if.hpp> 56 57 #define BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \ 58 BOOST_PP_EXPR_IF( \ 59 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name), static \ 60 ) 61 /**/ 62 63 #include <boost/preprocessor/control/if.hpp> 64 #include <boost/preprocessor/tuple/eat.hpp> 65 66 #define BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \ 67 BOOST_PP_IF( \ 68 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \ 69 , BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC \ 70 , name BOOST_PP_TUPLE_EAT(1) \ 71 )(name) 72 /**/ 73 74 // Produces a name for a parameter specification for the function named base. 75 #define BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(base, is_const) \ 76 BOOST_PP_CAT( \ 77 BOOST_PP_CAT( \ 78 BOOST_PP_IF( \ 79 is_const \ 80 , boost_param_parameters_const_ \ 81 , boost_param_parameters_ \ 82 ) \ 83 , __LINE__ \ 84 ) \ 85 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \ 86 ) 87 /**/ 88 89 // Produces a name for a result type metafunction for the no-spec function 90 // named base. 91 #define BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(base, is_const) \ 92 BOOST_PP_CAT( \ 93 BOOST_PP_CAT( \ 94 BOOST_PP_IF( \ 95 is_const \ 96 , boost_param_no_spec_result_const_ \ 97 , boost_param_no_spec_result_ \ 98 ) \ 99 , __LINE__ \ 100 ) \ 101 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \ 102 ) 103 /**/ 104 105 // Produces a name for a result type metafunction for the function named base. 106 #define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base, is_const) \ 107 BOOST_PP_CAT( \ 108 BOOST_PP_CAT( \ 109 BOOST_PP_IF( \ 110 is_const \ 111 , boost_param_result_const_ \ 112 , boost_param_result_ \ 113 ) \ 114 , __LINE__ \ 115 ) \ 116 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \ 117 ) 118 /**/ 119 120 // Produces a name for the implementation function to which the no-spec 121 // function named base forwards its result type and argument pack. 122 #define BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME(base, is_const) \ 123 BOOST_PP_CAT( \ 124 BOOST_PP_CAT( \ 125 BOOST_PP_IF( \ 126 is_const \ 127 , boost_param_no_spec_impl_const \ 128 , boost_param_no_spec_impl \ 129 ) \ 130 , __LINE__ \ 131 ) \ 132 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \ 133 ) 134 /**/ 135 136 // Can't do boost_param_impl_ ## basee 137 // because base might start with an underscore. 138 // daniel: what? how is that relevant? the reason for using CAT() 139 // is to make sure base is expanded. i'm not sure we need to here, 140 // but it's more stable to do it. 141 #define BOOST_PARAMETER_FUNCTION_IMPL_NAME(base, is_const) \ 142 BOOST_PP_CAT( \ 143 BOOST_PP_CAT( \ 144 BOOST_PP_IF(is_const, boost_param_impl_const, boost_param_impl) \ 145 , __LINE__ \ 146 ) \ 147 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \ 148 ) 149 /**/ 150 151 #endif // include guard 152 153