diff options
Diffstat (limited to 'tests/samplebinding/null_conversions.h')
-rw-r--r-- | tests/samplebinding/null_conversions.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/samplebinding/null_conversions.h b/tests/samplebinding/null_conversions.h new file mode 100644 index 000000000..cbe159f85 --- /dev/null +++ b/tests/samplebinding/null_conversions.h @@ -0,0 +1,32 @@ +namespace Shiboken { +template<> +struct Converter<Null> +{ + static inline bool checkType(PyObject* pyObj) + { + return false; + } + + static inline bool isConvertible(PyObject* pyObj) + { + if (pyObj == 0 || pyObj == Py_None) + return true; + return false; + } + + static inline PyObject* toPython(void* cppobj) + { + Py_RETURN_NONE; + } + + static inline PyObject* toPython(const Null& cpx) + { + Py_RETURN_NONE; + } + + static inline Null toCpp(PyObject* pyobj) + { + return Null(pyobj == 0); + } +}; +} |