File indexing completed on 2025-01-18 09:50:42
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_PP_IS_ITERATING)
0010
0011 # ifndef SIGNATURE_JDG20020813_HPP
0012 # define SIGNATURE_JDG20020813_HPP
0013
0014 # include <boost/python/detail/prefix.hpp>
0015
0016 # include <boost/mpl/if.hpp>
0017
0018 # include <boost/python/detail/preprocessor.hpp>
0019 # include <boost/python/detail/type_traits.hpp>
0020 # include <boost/preprocessor/repeat.hpp>
0021 # include <boost/preprocessor/enum.hpp>
0022 # include <boost/preprocessor/enum_params.hpp>
0023 # include <boost/preprocessor/empty.hpp>
0024 # include <boost/preprocessor/arithmetic/sub.hpp>
0025 # include <boost/preprocessor/iterate.hpp>
0026 # include <boost/python/detail/type_list.hpp>
0027
0028 # include <boost/preprocessor/debug/line.hpp>
0029 # include <boost/preprocessor/arithmetic/sub.hpp>
0030 # include <boost/preprocessor/arithmetic/inc.hpp>
0031 # include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0032
0033 # define BOOST_PYTHON_LIST_INC(n) \
0034 BOOST_PP_CAT(mpl::vector, BOOST_PP_INC(n))
0035
0036
0037 namespace boost { namespace python { namespace detail {
0038
0039
0040
0041 template <class C1, class C2>
0042 struct most_derived
0043 {
0044 typedef typename mpl::if_<
0045 detail::is_convertible<C1*,C2*>
0046 , C1
0047 , C2
0048 >::type type;
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113 # define BOOST_PYTHON_FN_CC
0114
0115 # define BOOST_PP_ITERATION_PARAMS_1 \
0116 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))
0117
0118 # include BOOST_PP_ITERATE()
0119
0120 # undef BOOST_PYTHON_FN_CC
0121
0122
0123
0124 # if defined(BOOST_PYTHON_ENABLE_CDECL)
0125
0126 # define BOOST_PYTHON_FN_CC __cdecl
0127 # define BOOST_PYTHON_FN_CC_IS_CDECL
0128
0129 # define BOOST_PP_ITERATION_PARAMS_1 \
0130 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))
0131
0132 # include BOOST_PP_ITERATE()
0133
0134 # undef BOOST_PYTHON_FN_CC
0135 # undef BOOST_PYTHON_FN_CC_IS_CDECL
0136
0137 # endif
0138
0139
0140
0141 # if defined(BOOST_PYTHON_ENABLE_STDCALL)
0142
0143 # define BOOST_PYTHON_FN_CC __stdcall
0144
0145 # define BOOST_PP_ITERATION_PARAMS_1 \
0146 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))
0147
0148 # include BOOST_PP_ITERATE()
0149
0150 # undef BOOST_PYTHON_FN_CC
0151
0152 # endif
0153
0154
0155
0156 # if defined(BOOST_PYTHON_ENABLE_FASTCALL)
0157
0158 # define BOOST_PYTHON_FN_CC __fastcall
0159
0160 # define BOOST_PP_ITERATION_PARAMS_1 \
0161 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))
0162
0163 # include BOOST_PP_ITERATE()
0164
0165 # undef BOOST_PYTHON_FN_CC
0166
0167 # endif
0168
0169 # undef BOOST_PYTHON_LIST_INC
0170
0171
0172
0173 }}}
0174
0175
0176 # endif
0177
0178
0179
0180 #else
0181 #if BOOST_PP_ITERATION_DEPTH() == 1
0182
0183 # define N BOOST_PP_ITERATION()
0184
0185
0186
0187
0188 # if !defined(BOOST_PYTHON_FN_CC_IS_CDECL)
0189
0190 template <
0191 class RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)>
0192 inline BOOST_PYTHON_LIST_INC(N)<
0193 RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)>
0194 get_signature(RT(BOOST_PYTHON_FN_CC *)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)), void* = 0)
0195 {
0196 return BOOST_PYTHON_LIST_INC(N)<
0197 RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)
0198 >();
0199 }
0200
0201 # endif
0202
0203 # undef N
0204
0205 # define BOOST_PP_ITERATION_PARAMS_2 \
0206 (3, (0, 3, <boost/python/signature.hpp>))
0207 # include BOOST_PP_ITERATE()
0208
0209 #else
0210
0211 # define N BOOST_PP_RELATIVE_ITERATION(1)
0212 # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_ITERATION())
0213
0214 template <
0215 class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)>
0216 inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))<
0217 RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)>
0218 get_signature(RT(BOOST_PYTHON_FN_CC ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q)
0219 {
0220 return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))<
0221 RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)
0222 >();
0223 }
0224
0225 template <
0226 class Target
0227 , class RT
0228 , class ClassT
0229 BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)
0230 >
0231 inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))<
0232 RT
0233 , typename most_derived<Target, ClassT>::type&
0234 BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)
0235 >
0236 get_signature(
0237 RT(BOOST_PYTHON_FN_CC ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q
0238 , Target*
0239 )
0240 {
0241 return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))<
0242 RT
0243 , BOOST_DEDUCED_TYPENAME most_derived<Target, ClassT>::type&
0244 BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)
0245 >();
0246 }
0247
0248 # undef Q
0249 # undef N
0250
0251 #endif
0252 #endif