aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/handle_conversions.h
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-15 13:36:08 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:07:21 -0300
commitb4d648d09c293816a6f15ffdc2bdc7b0ec0792fb (patch)
treee0abf184f9669801845a75872c0dd2441e5f238e /tests/samplebinding/handle_conversions.h
parentc8892e123c0f4512e7ecd78b85d499b02b31e1e4 (diff)
Created unit test for unknown class holder.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/samplebinding/handle_conversions.h')
-rw-r--r--tests/samplebinding/handle_conversions.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/samplebinding/handle_conversions.h b/tests/samplebinding/handle_conversions.h
new file mode 100644
index 000000000..2c6008077
--- /dev/null
+++ b/tests/samplebinding/handle_conversions.h
@@ -0,0 +1,39 @@
+#ifndef _HANDLE_CONVERSION_H_
+#define _HANDLE_CONVERSION_H_
+
+
+namespace Shiboken {
+template<>
+struct Converter<HANDLE>
+{
+ static inline bool checkType(PyObject* pyObj)
+ {
+ return false;
+ }
+
+ static inline bool isConvertible(PyObject* pyObj)
+ {
+ return PyCObject_Check(pyObj);
+ }
+
+ static inline PyObject* toPython(void* cppobj)
+ {
+ assert(true);
+ return 0;
+ }
+
+ static inline PyObject* toPython(HANDLE cppobj)
+ {
+ return PyCObject_FromVoidPtr(cppobj, 0);
+ }
+
+ static inline HANDLE toCpp(PyObject* pyobj)
+ {
+
+ return (HANDLE) PyCObject_AsVoidPtr(pyobj);
+ }
+};
+}
+
+
+#endif