From c1253405144232e4c6db791ce43bd6d4f25ea9f6 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Sat, 28 May 2011 15:09:55 -0300 Subject: Added class to be treated as a specific (bool, in this case) primitive type in Python. Unit tests were also added. --- tests/minimalbinding/minbool_conversions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/minimalbinding/minbool_conversions.h (limited to 'tests/minimalbinding/minbool_conversions.h') diff --git a/tests/minimalbinding/minbool_conversions.h b/tests/minimalbinding/minbool_conversions.h new file mode 100644 index 000000000..f343a4711 --- /dev/null +++ b/tests/minimalbinding/minbool_conversions.h @@ -0,0 +1,10 @@ +namespace Shiboken { +template <> +struct Converter : public ValueTypeConverter +{ + static bool isConvertible(PyObject* pyObj) { return PyBool_Check(pyObj); } + using ValueTypeConverter::toPython; + static PyObject* toPython(const MinBool& holder) { return PyBool_FromLong(holder.value()); } + static MinBool toCpp(PyObject* pyobj) { return MinBool(pyobj == Py_True); } +}; +} -- cgit v1.2.3