aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-07-18 15:29:21 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:03 -0300
commite205a94df825fd6becf5ff7514ae9d40ddc7f456 (patch)
treed2133cfe4de2f663103783b1f61ffe1f1ddbab14 /libshiboken
parent553cfa3fd5d49fbcf2e143c19eabeb25129389dc (diff)
Improved documentation on ObjectType's cast related functions.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp12
-rw-r--r--libshiboken/basewrapper.h19
2 files changed, 22 insertions, 9 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 3e9b08a3a..ddfc770ed 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -554,19 +554,19 @@ bool isExternalConvertible(SbkObjectType* self, PyObject* obj)
return self->d->ext_isconvertible && self->d->ext_isconvertible(obj);
}
-bool hasCast(SbkObjectType* self)
+bool hasCast(SbkObjectType* type)
{
- return self->d->mi_specialcast;
+ return type->d->mi_specialcast;
}
-void* cast(SbkObjectType* self, SbkObject* obj, PyTypeObject *target)
+void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType)
{
- return self->d->mi_specialcast(Object::cppPointer(obj, target), reinterpret_cast<SbkObjectType*>(target));
+ return sourceType->d->mi_specialcast(Object::cppPointer(obj, targetType), reinterpret_cast<SbkObjectType*>(targetType));
}
-void setCastFunction(SbkObjectType* self, SpecialCastFunction func)
+void setCastFunction(SbkObjectType* type, SpecialCastFunction func)
{
- self->d->mi_specialcast = func;
+ type->d->mi_specialcast = func;
}
void setOriginalName(SbkObjectType* self, const char* name)
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index 4bcd35e33..f9f2a36a3 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -133,9 +133,22 @@ LIBSHIBOKEN_API bool hasExternalCppConversions(SbkObjectType* self);
LIBSHIBOKEN_API bool isExternalConvertible(SbkObjectType* self, PyObject* obj);
LIBSHIBOKEN_API void* callExternalCppConversion(SbkObjectType* self, PyObject* obj);
-LIBSHIBOKEN_API bool hasCast(SbkObjectType* self);
-LIBSHIBOKEN_API void* cast(SbkObjectType* self, SbkObject* obj, PyTypeObject* target);
-LIBSHIBOKEN_API void setCastFunction(SbkObjectType* self, SpecialCastFunction func);
+/**
+ * Tells if the \p type represents an object of a class with multiple inheritance in C++.
+ * When this occurs, the C++ pointer held by the Python wrapper will need to be cast when
+ * passed as a parameter that expects a type of its ancestry.
+ * \returns true if a call to ObjectType::cast() is needed to obtain the correct
+ * C++ pointer for Python objects of type \p type.
+ */
+LIBSHIBOKEN_API bool hasCast(SbkObjectType* type);
+/**
+ * Cast the C++ pointer held by a Python object \p obj of type \p sourceType,
+ * to a C++ pointer of a C++ class indicated by type \p targetType.
+ * \returns The cast C++ pointer.
+ */
+LIBSHIBOKEN_API void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType);
+/// Set the C++ cast function for \p type.
+LIBSHIBOKEN_API void setCastFunction(SbkObjectType* type, SpecialCastFunction func);
LIBSHIBOKEN_API void setOriginalName(SbkObjectType* self, const char* name);
LIBSHIBOKEN_API const char* getOriginalName(SbkObjectType* self);