Update contrib.
1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef REGISTRATIONS_DWA2002223_HPP
6 # define REGISTRATIONS_DWA2002223_HPP
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/type_id.hpp>
12 # include <boost/python/converter/convertible_function.hpp>
13 # include <boost/python/converter/constructor_function.hpp>
14 # include <boost/python/converter/to_python_function_type.hpp>
16 # include <boost/detail/workaround.hpp>
18 namespace boost { namespace python { namespace converter {
20 struct lvalue_from_python_chain
22 convertible_function convert;
23 lvalue_from_python_chain* next;
26 struct rvalue_from_python_chain
28 convertible_function convertible;
29 constructor_function construct;
30 rvalue_from_python_chain* next;
33 struct BOOST_PYTHON_DECL registration
35 public: // member functions
36 explicit registration(type_info target, bool is_shared_ptr = false);
38 // Convert the appropriately-typed data to Python
39 PyObject* to_python(void const volatile*) const;
41 // Return the class object, or raise an appropriate Python
42 // exception if no class has been registered.
43 PyTypeObject* get_class_object() const;
45 public: // data members. So sue me.
46 const python::type_info target_type;
48 // The chain of eligible from_python converters when an lvalue is required
49 lvalue_from_python_chain* lvalue_chain;
51 // The chain of eligible from_python converters when an rvalue is acceptable
52 rvalue_from_python_chain* rvalue_chain;
54 // The class object associated with this type
55 PyTypeObject* m_class_object;
57 // The unique to_python converter for the associated C++ type.
58 to_python_function_t m_to_python;
60 // True iff this type is a shared_ptr. Needed for special rvalue
61 // from_python handling.
62 const bool is_shared_ptr;
64 # if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
66 void operator=(registration); // This is not defined, and just keeps MWCW happy.
73 inline registration::registration(type_info target_type, bool is_shared_ptr)
74 : target_type(target_type)
79 , is_shared_ptr(is_shared_ptr)
82 inline bool operator<(registration const& lhs, registration const& rhs)
84 return lhs.target_type < rhs.target_type;
87 }}} // namespace boost::python::converter
89 #endif // REGISTRATIONS_DWA2002223_HPP