aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/handle_conversions.h
blob: 2c6008077ee9353af97a62bc42b48273dd3d3280 (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
33
34
35
36
37
38
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