mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 05:22:45 +00:00
Still further rationalized conversion registry
[SVN r14462]
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#ifndef ARG_FROM_PYTHON_DWA2002127_HPP
|
||||
# define ARG_FROM_PYTHON_DWA2002127_HPP
|
||||
|
||||
# include <boost/python/converter/find_from_python.hpp>
|
||||
# include <boost/python/converter/from_python.hpp>
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright David Abrahams 2002. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef CALLBACK_FROM_PYTHON_BASE_DWA200237_HPP
|
||||
# define CALLBACK_FROM_PYTHON_BASE_DWA200237_HPP
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
struct rvalue_from_python_stage1_data;
|
||||
struct registration;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
BOOST_PYTHON_DECL void* convert_rvalue(PyObject*, rvalue_from_python_stage1_data&, void* storage);
|
||||
BOOST_PYTHON_DECL void* callback_convert_reference(PyObject*, registration const&);
|
||||
BOOST_PYTHON_DECL void* callback_convert_pointer(PyObject*, registration const&);
|
||||
BOOST_PYTHON_DECL void absorb_result(PyObject*);
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::converter
|
||||
|
||||
#endif // CALLBACK_FROM_PYTHON_BASE_DWA200237_HPP
|
||||
@@ -18,11 +18,20 @@ struct rvalue_from_python_chain;
|
||||
BOOST_PYTHON_DECL void* get_lvalue_from_python(
|
||||
PyObject* source, registration const&);
|
||||
|
||||
BOOST_PYTHON_DECL rvalue_from_python_chain const* implicit_conversion_chain(
|
||||
PyObject* source, registration const&);
|
||||
|
||||
BOOST_PYTHON_DECL rvalue_from_python_stage1_data rvalue_from_python_stage1(
|
||||
PyObject* source, registration const&);
|
||||
|
||||
BOOST_PYTHON_DECL rvalue_from_python_chain const* implicit_conversion_chain(
|
||||
PyObject* source, registration const&);
|
||||
BOOST_PYTHON_DECL void* rvalue_from_python_stage2(
|
||||
PyObject*, rvalue_from_python_stage1_data&, void* storage);
|
||||
|
||||
BOOST_PYTHON_DECL void* reference_from_python(PyObject*, registration const&);
|
||||
BOOST_PYTHON_DECL void* pointer_from_python(PyObject*, registration const&);
|
||||
|
||||
BOOST_PYTHON_DECL void void_from_python(PyObject*);
|
||||
|
||||
|
||||
}}} // namespace boost::python::converter
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef RETURN_FROM_PYTHON_DWA200265_HPP
|
||||
# define RETURN_FROM_PYTHON_DWA200265_HPP
|
||||
|
||||
# include <boost/python/converter/callback_from_python_base.hpp>
|
||||
# include <boost/python/converter/from_python.hpp>
|
||||
# include <boost/python/converter/rvalue_from_python_data.hpp>
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/converter/registered_pointee.hpp>
|
||||
@@ -77,7 +77,7 @@ struct return_from_python<void>
|
||||
|
||||
result_type operator()(PyObject* x) const
|
||||
{
|
||||
converter::detail::absorb_result(x);
|
||||
converter::void_from_python(x);
|
||||
# ifdef BOOST_NO_VOID_RETURNS
|
||||
return result_type();
|
||||
# endif
|
||||
@@ -101,21 +101,21 @@ namespace detail
|
||||
inline typename return_rvalue_from_python<T>::result_type
|
||||
return_rvalue_from_python<T>::operator()(PyObject* obj)
|
||||
{
|
||||
return *(T*)convert_rvalue(obj, m_data.stage1, m_data.storage.bytes);
|
||||
return *(T*)rvalue_from_python_stage2(obj, m_data.stage1, m_data.storage.bytes);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T return_reference_from_python<T>::operator()(PyObject* obj) const
|
||||
{
|
||||
return python::detail::void_ptr_to_reference(
|
||||
callback_convert_reference(obj, registered<T>::converters)
|
||||
reference_from_python(obj, registered<T>::converters)
|
||||
, (T(*)())0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T return_pointer_from_python<T>::operator()(PyObject* obj) const
|
||||
{
|
||||
return T(callback_convert_pointer(obj, registered_pointee<T>::converters));
|
||||
return T(pointer_from_python(obj, registered_pointee<T>::converters));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user