2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00
Files
python/test/test_builtin_converters.cpp
Dave Abrahams 6a75fa83b5 New conversion methods, builtin converters
----------------------------------------------------------------------

Committing in .

Modified Files:
	boost/python/reference_from_python.hpp
	boost/python/value_from_python.hpp
	boost/python/converter/body.hpp
	boost/python/converter/handle.hpp
	libs/python/src/converter/builtin_converters.cpp
	libs/python/test/m1.cpp libs/python/test/m2.cpp
Added Files:
	boost/python/converter/builtin_converters.hpp
	boost/python/converter/builtin_to_python_converters.hpp
	boost/python/converter/from_python.hpp
	boost/python/converter/from_python_data.hpp
	boost/python/converter/from_python_function.hpp
	boost/python/converter/to_python.hpp
	boost/python/converter/to_python_function.hpp
	boost/python/object/auto_ptr_generator.hpp
	boost/python/object/pointer_holder.hpp
	libs/python/src/converter/from_python.cpp
	libs/python/src/converter/to_python.cpp
	libs/python/test/test_builtin_converters.cpp
	libs/python/test/test_builtin_converters.py
Removed Files:
	boost/python/convert.hpp boost/python/converter/unwrap.hpp
	boost/python/converter/unwrapper.hpp
	boost/python/converter/wrap.hpp
	boost/python/converter/wrapper.hpp
	boost/python/object/class_unwrapper.hpp
----------------------------------------------------------------------


[SVN r12596]
2002-01-31 05:53:54 +00:00

66 lines
2.7 KiB
C++

// 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.
#include <string>
#include <boost/python/module.hpp>
#include <boost/mpl/type_list.hpp>
#include <boost/mpl/for_each.hpp>
template <class T>
struct by_value
{
static T rewrap(T x)
{
return x;
}
};
template <class T>
struct by_const_reference
{
static T rewrap(T const& x)
{
return x;
}
};
BOOST_PYTHON_MODULE_INIT(builtin_converters_ext)
{
boost::python::module("builtin_converters_ext")
.def("rewrap_value_signed_char", by_value<signed char>::rewrap)
.def("rewrap_value_unsigned_char", by_value<unsigned char>::rewrap)
.def("rewrap_value_int", by_value<int>::rewrap)
.def("rewrap_value_unsigned_int", by_value<unsigned int>::rewrap)
.def("rewrap_value_short", by_value<short>::rewrap)
.def("rewrap_value_unsigned_short", by_value<unsigned short>::rewrap)
.def("rewrap_value_long", by_value<long>::rewrap)
.def("rewrap_value_unsigned_long", by_value<unsigned long>::rewrap)
.def("rewrap_value_float", by_value<float>::rewrap)
.def("rewrap_value_double", by_value<double>::rewrap)
.def("rewrap_value_long_double", by_value<long double>::rewrap)
.def("rewrap_value_string", by_value<std::string>::rewrap)
.def("rewrap_value_cstring", by_value<char const*>::rewrap)
.def("rewrap_const_reference_signed_char", by_const_reference<signed char>::rewrap)
.def("rewrap_const_reference_unsigned_char", by_const_reference<unsigned char>::rewrap)
.def("rewrap_const_reference_int", by_const_reference<int>::rewrap)
.def("rewrap_const_reference_unsigned_int", by_const_reference<unsigned int>::rewrap)
.def("rewrap_const_reference_short", by_const_reference<short>::rewrap)
.def("rewrap_const_reference_unsigned_short", by_const_reference<unsigned short>::rewrap)
.def("rewrap_const_reference_long", by_const_reference<long>::rewrap)
.def("rewrap_const_reference_unsigned_long", by_const_reference<unsigned long>::rewrap)
.def("rewrap_const_reference_float", by_const_reference<float>::rewrap)
.def("rewrap_const_reference_double", by_const_reference<double>::rewrap)
.def("rewrap_const_reference_long_double", by_const_reference<long double>::rewrap)
.def("rewrap_const_reference_string", by_const_reference<std::string>::rewrap)
.def("rewrap_const_reference_cstring", by_const_reference<char const*>::rewrap)
;
}