mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
added to from_python() functions to gen_extclass.py
(these were formerly only present on extclass.h and thus overwritten) [SVN r8164]
This commit is contained in:
10
extclass.h
10
extclass.h
@@ -82,7 +82,7 @@ class ExtensionClassBase : public Class<ExtensionInstance>
|
||||
void* try_base_class_conversions(InstanceHolderBase*) const;
|
||||
void* try_derived_class_conversions(InstanceHolderBase*) const;
|
||||
|
||||
void set_attribute(const char* name, PyObject* x_);
|
||||
void set_attribute(const char* name, PyObject* x);
|
||||
void set_attribute(const char* name, Ptr x);
|
||||
|
||||
private:
|
||||
@@ -234,6 +234,14 @@ class PyExtensionClassConverters
|
||||
friend const T* from_python(PyObject* p, py::Type<const T*>)
|
||||
{ return from_python(p, py::Type<T*>()); }
|
||||
|
||||
// Convert to const T* const&
|
||||
friend const T* from_python(PyObject* p, py::Type<const T *const&>)
|
||||
{ return from_python(p, py::Type<const T*>()); }
|
||||
|
||||
// Convert to T* const&
|
||||
friend T* from_python(PyObject* p, py::Type<T* const&>)
|
||||
{ return from_python(p, py::Type<T*>()); }
|
||||
|
||||
// Convert to T&
|
||||
friend T& from_python(PyObject* p, py::Type<T&>)
|
||||
{ return *py::check_non_null(from_python(p, py::Type<T*>())); }
|
||||
|
||||
@@ -87,7 +87,7 @@ class ExtensionClassBase : public Class<ExtensionInstance>
|
||||
void* try_base_class_conversions(InstanceHolderBase*) const;
|
||||
void* try_derived_class_conversions(InstanceHolderBase*) const;
|
||||
|
||||
void set_attribute(const char* name, PyObject* x_);
|
||||
void set_attribute(const char* name, PyObject* x);
|
||||
void set_attribute(const char* name, Ptr x);
|
||||
|
||||
private:
|
||||
@@ -239,6 +239,14 @@ class PyExtensionClassConverters
|
||||
friend const T* from_python(PyObject* p, py::Type<const T*>)
|
||||
{ return from_python(p, py::Type<T*>()); }
|
||||
|
||||
// Convert to const T* const&
|
||||
friend const T* from_python(PyObject* p, py::Type<const T *const&>)
|
||||
{ return from_python(p, py::Type<const T*>()); }
|
||||
|
||||
// Convert to T* const&
|
||||
friend T* from_python(PyObject* p, py::Type<T* const&>)
|
||||
{ return from_python(p, py::Type<T*>()); }
|
||||
|
||||
// Convert to T&
|
||||
friend T& from_python(PyObject* p, py::Type<T&>)
|
||||
{ return *py::check_non_null(from_python(p, py::Type<T*>())); }
|
||||
|
||||
Reference in New Issue
Block a user