aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-02-12 18:18:50 -0200
committerHugo Lima <hugo.lima@openbossa.org>2010-02-12 18:35:24 -0200
commit21151a2f4dc03ef6d62efcfb4a0f1f9d3dcb5183 (patch)
tree07c45ee29ccf4a2bfb216c00611f2369887c00ca /libshiboken
parentfa5740279daa22be3c424c8fab4468447b3cbcaf (diff)
Do not export Sbk*Type variables.
To access Sbk*Type variables from other modules, you need to use the array provided via CObjects. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp16
-rw-r--r--libshiboken/basewrapper.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 2dda3a4bc..dc86fa831 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -196,6 +196,22 @@ void SbkBaseWrapper_clearReferences(SbkBaseWrapper* self)
delete self->referredObjects;
}
+bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
+{
+ Shiboken::AutoDecRef module(PyImport_ImportModule(moduleName));
+ if (module.isNull())
+ return false;
+
+ Shiboken::AutoDecRef cppApi(PyObject_GetAttrString(module, "_Cpp_Api"));
+ if (cppApi.isNull())
+ return false;
+
+ if (PyCObject_Check(cppApi))
+ *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCObject_AsVoidPtr(cppApi));
+
+ return true;
+}
+
// Wrapper metatype and base type ----------------------------------------------------------
extern "C"
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index 7d834da0e..e8ea7cc1b 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -256,6 +256,8 @@ void SbkBaseWrapper_Dealloc(PyObject* self)
LIBSHIBOKEN_API PyAPI_FUNC(void) SbkBaseWrapper_Dealloc_PrivateDtor(PyObject* self);
+LIBSHIBOKEN_API bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr);
+
} // namespace Shiboken
#endif // BASEWRAPPER_H