4 #include <boost/python/module.hpp> 5 #include <boost/python/def.hpp> 6 #include <boost/python/to_python_converter.hpp> 32 return boost::python::incref(boost::python::object(s.
value()).ptr());
40 boost::python::converter::registry
41 ::push_back(&convertible,
43 boost::python::type_id<custom_string>());
48 if (!PyString_Check(obj_ptr))
return 0;
54 boost::python::converter::rvalue_from_python_stage1_data*
data)
56 const char*
value = PyString_AsString(obj_ptr);
57 if (value == 0) boost::python::throw_error_already_set();
59 ((boost::python::converter::rvalue_from_python_storage<custom_string>*)data)
62 data->convertible = storage;
std::size_t size(custom_string const &s)
BOOST_PYTHON_MODULE(libmystring)
std::string const & value() const
static void * convertible(PyObject *obj_ptr)
static void construct(PyObject *obj_ptr, boost::python::converter::rvalue_from_python_stage1_data *data)
custom_string(std::string const &value)
static PyObject * convert(custom_string const &s)
custom_string_from_python_str()