summaryrefslogtreecommitdiffstats
path: root/libshiboken/sbkconverter.h
diff options
context:
space:
mode:
Diffstat (limited to 'libshiboken/sbkconverter.h')
-rw-r--r--libshiboken/sbkconverter.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/libshiboken/sbkconverter.h b/libshiboken/sbkconverter.h
index a5b8d113..41126786 100644
--- a/libshiboken/sbkconverter.h
+++ b/libshiboken/sbkconverter.h
@@ -36,8 +36,6 @@
#define SbkObject_TypeCheck(tp, ob) \
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
-#define SbkString_Check(pyObj) (pyObj == Py_None || PyString_Check(pyObj))
-
extern "C"
{
@@ -88,6 +86,36 @@ typedef PythonToCppFunc (*IsConvertibleToCppFunc)(PyObject*);
namespace Shiboken {
namespace Conversions {
+
+class LIBSHIBOKEN_API SpecificConverter
+{
+public:
+ enum Type
+ {
+ InvalidConversion,
+ CopyConversion,
+ PointerConversion,
+ ReferenceConversion
+ };
+
+ explicit SpecificConverter(const char* typeName);
+
+ inline SbkConverter* converter() { return m_converter; }
+ inline operator SbkConverter*() const { return m_converter; }
+
+ inline bool isValid() { return m_type != InvalidConversion; }
+ inline operator bool() const { return m_type != InvalidConversion; }
+
+ inline Type conversionType() { return m_type; }
+
+ PyObject* toPython(const void* cppIn);
+ void toCpp(PyObject* pyIn, void* cppOut);
+private:
+ SbkConverter* m_converter;
+ Type m_type;
+};
+
+
/**
* Creates a converter for a wrapper type.
* \param type A Shiboken.ObjectType that will receive the new converter.
@@ -306,4 +334,5 @@ template<> inline SbkConverter* PrimitiveTypeConverter<void*>() { return primiti
struct _SbkGenericType { PyHeapTypeObject super; SbkConverter** converter; };
#define SBK_CONVERTER(pyType) (*reinterpret_cast<_SbkGenericType*>(pyType)->converter)
+
#endif // SBK_CONVERTER_H