Chris@16: // Copyright David Abrahams 2002. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef PYOBJECT_TRAITS_DWA2002720_HPP Chris@16: # define PYOBJECT_TRAITS_DWA2002720_HPP Chris@16: Chris@16: # include Chris@16: # include Chris@16: Chris@16: namespace boost { namespace python { namespace converter { Chris@16: Chris@16: template struct pyobject_traits; Chris@16: Chris@16: template <> Chris@16: struct pyobject_traits Chris@16: { Chris@16: // All objects are convertible to PyObject Chris@16: static bool check(PyObject*) { return true; } Chris@16: static PyObject* checked_downcast(PyObject* x) { return x; } Chris@16: #ifndef BOOST_PYTHON_NO_PY_SIGNATURES Chris@16: static PyTypeObject const* get_pytype() { return 0; } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: // Chris@16: // Specializations Chris@16: // Chris@16: Chris@16: # define BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(T) \ Chris@16: template <> struct pyobject_traits \ Chris@16: : pyobject_type {} Chris@16: Chris@16: // This is not an exhaustive list; should be expanded. Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Type); Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(List); Chris@16: #if PY_VERSION_HEX < 0x03000000 Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Int); Chris@16: #endif Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Long); Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Dict); Chris@16: BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Tuple); Chris@16: Chris@16: }}} // namespace boost::python::converter Chris@16: Chris@16: #endif // PYOBJECT_TRAITS_DWA2002720_HPP