summaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/null_conversions.h
blob: cbe159f85c56192c8c94b928537bed7cca3e1d7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
    }
};
}