Update contrib.
1 #if !defined(BOOST_PP_IS_ITERATING)
3 // Copyright David Abrahams 2004. Distributed under the Boost
4 // 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 #ifndef OVERRIDE_DWA2004721_HPP
7 # define OVERRIDE_DWA2004721_HPP
9 # include <boost/python/detail/prefix.hpp>
11 # include <boost/python/converter/return_from_python.hpp>
13 # include <boost/python/extract.hpp>
14 # include <boost/python/handle.hpp>
16 # include <boost/preprocessor/iterate.hpp>
17 # include <boost/preprocessor/repeat.hpp>
18 # include <boost/preprocessor/debug/line.hpp>
19 # include <boost/preprocessor/repetition/enum_params.hpp>
20 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
22 # include <boost/type.hpp>
24 namespace boost { namespace python {
32 // The result of calling a method.
36 friend class boost::python::override;
37 explicit method_result(PyObject* x)
45 converter::return_from_python<T> converter;
46 return converter(m_obj.release());
49 # if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(140050215))
53 converter::return_from_python<T*> converter;
54 return converter(m_obj.release());
58 # if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) || BOOST_WORKAROUND(BOOST_INTEL_WIN, >= 900)
65 converter::return_from_python<T&> converter;
66 return converter(const_cast<handle<>&>(m_obj).release());
73 converter::return_from_python<T> converter;
74 return converter(m_obj.release());
78 T unchecked(type<T>* = 0)
80 return extract<T>(m_obj)();
83 mutable handle<> m_obj;
87 class override : public object
90 friend class detail::wrapper_base;
99 detail::method_result x(
102 , const_cast<char*>("()")
107 # define BOOST_PYTHON_fast_arg_to_python_get(z, n, _) \
108 , converter::arg_to_python<A##n>(a##n).get()
110 # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/override.hpp>))
111 # include BOOST_PP_ITERATE()
113 # undef BOOST_PYTHON_fast_arg_to_python_get
116 }} // namespace boost::python
118 #endif // OVERRIDE_DWA2004721_HPP
121 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
122 && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
123 # line BOOST_PP_LINE(__LINE__, override.hpp)
126 # define N BOOST_PP_ITERATION()
129 BOOST_PP_ENUM_PARAMS_Z(1, N, class A)
131 detail::method_result
132 operator()( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) ) const
134 detail::method_result x(
137 , const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")")
138 BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_fast_arg_to_python_get, nil)