summaryrefslogtreecommitdiffstats
path: root/libshiboken/sbkconverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libshiboken/sbkconverter.cpp')
-rw-r--r--libshiboken/sbkconverter.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/libshiboken/sbkconverter.cpp b/libshiboken/sbkconverter.cpp
index c5e64f3d..34705d9e 100644
--- a/libshiboken/sbkconverter.cpp
+++ b/libshiboken/sbkconverter.cpp
@@ -26,9 +26,35 @@
#include "sbkdbg.h"
+static SbkConverter** PrimitiveTypeConverters;
+
namespace Shiboken {
namespace Conversions {
+void init()
+{
+ static SbkConverter* primitiveTypeConverters[] = {
+ Primitive<PY_LONG_LONG>::createConverter(),
+ Primitive<bool>::createConverter(),
+ Primitive<char>::createConverter(),
+ Primitive<const char*>::createConverter(),
+ Primitive<double>::createConverter(),
+ Primitive<float>::createConverter(),
+ Primitive<int>::createConverter(),
+ Primitive<long>::createConverter(),
+ Primitive<short>::createConverter(),
+ Primitive<signed char>::createConverter(),
+ Primitive<std::string>::createConverter(),
+ Primitive<unsigned PY_LONG_LONG>::createConverter(),
+ Primitive<unsigned char>::createConverter(),
+ Primitive<unsigned int>::createConverter(),
+ Primitive<unsigned long>::createConverter(),
+ Primitive<unsigned short>::createConverter(),
+ Primitive<void*>::createConverter()
+ };
+ PrimitiveTypeConverters = primitiveTypeConverters;
+}
+
static SbkConverter* createConverterObject(PyTypeObject* type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
@@ -113,7 +139,6 @@ PyObject* referenceToPython(SbkObjectType* type, const void* cppIn)
static inline PyObject* CopyCppToPython(SbkConverter* converter, const void* cppIn)
{
- assert(cppIn);
return converter->copyToPython(cppIn);
}
PyObject* copyToPython(SbkObjectType* type, const void* cppIn)
@@ -228,4 +253,9 @@ bool isImplicitConversion(SbkObjectType* type, PythonToCppFunc toCppFunc)
return toCppFunc != (*conv).second;
}
+SbkConverter* primitiveTypeConverter(int index)
+{
+ return PrimitiveTypeConverters[index];
+}
+
} } // namespace Shiboken::Conversions