aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-09 18:52:40 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:08:57 -0300
commit28debb4e820b03c1acdf09715b7570ae30e47dcc (patch)
tree626ec49d82cae1f241d6a96f162b6f438c3d0c02 /libshiboken
parente3148eaf9a7be5633d1ff4339ba94f0a9f085930 (diff)
Replace Shiboken::cppObjectIsInvalid by Shiboken::Wraper::isValid
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp21
-rw-r--r--libshiboken/basewrapper.h7
2 files changed, 14 insertions, 14 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 255bee329..7aa5ed0ec 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -333,17 +333,6 @@ PyObject* SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*)
return reinterpret_cast<PyObject*>(self);
}
-bool cppObjectIsInvalid(PyObject* wrapper)
-{
- if (!wrapper || wrapper == Py_None
- || wrapper->ob_type->ob_type != &Shiboken::SbkBaseWrapperType_Type
- || ((SbkObject*)wrapper)->d->validCppObject) {
- return false;
- }
- PyErr_SetString(PyExc_RuntimeError, "Internal C++ object already deleted.");
- return true;
-}
-
void setTypeUserData(SbkObject* wrapper, void *user_data, DeleteUserDataFunc d_func)
{
SbkBaseWrapperType* ob_type = reinterpret_cast<SbkBaseWrapperType*>(wrapper->ob_type);
@@ -728,6 +717,16 @@ bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
return !alreadyInitialized;
}
+bool isValid(PyObject* pyObj)
+{
+ if (!pyObj || pyObj == Py_None
+ || pyObj->ob_type->ob_type != &Shiboken::SbkBaseWrapperType_Type
+ || ((SbkObject*)pyObj)->d->validCppObject) {
+ return true;
+ }
+ PyErr_Format(PyExc_RuntimeError, "Internal C++ object (%s) already deleted.", pyObj->ob_type->tp_name);
+ return false;
+}
} // namespace Wrapper
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index bb76f7ba8..d8511dd82 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -189,9 +189,6 @@ SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*);
*/
LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append=false);
-/// Returns true and sets a Python RuntimeError if the Python wrapper is not marked as valid.
-LIBSHIBOKEN_API bool cppObjectIsInvalid(PyObject* wrapper);
-
/// Dealloc the python object \p pyObj and the C++ object represented by it.
LIBSHIBOKEN_API void deallocWrapper(PyObject* pyObj);
@@ -227,6 +224,10 @@ LIBSHIBOKEN_API void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType);
*/
LIBSHIBOKEN_API bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr);
+/// Returns false and sets a Python RuntimeError if the Python wrapper is not marked as valid.
+LIBSHIBOKEN_API bool isValid(PyObject* wrapper);
+
+
} // namespace Wrapper
} // namespace Shiboken