/*
 * Interface wrapper code.
 *
 * Generated by SIP 4.19.24
 *
 *     Copyright: (c) 2020 by Total Control Software
 *     License:   wxWindows License
 */

#include "sipAPI_core.h"

    #include <wx/setup.h>
    #include <wxPython/wxpy_api.h>



extern "C" {static void assign_wxIntPtr(void *, SIP_SSIZE_T, void *);}
static void assign_wxIntPtr(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxIntPtr *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxIntPtr *>(sipSrc);
}


extern "C" {static void *array_wxIntPtr(SIP_SSIZE_T);}
static void *array_wxIntPtr(SIP_SSIZE_T sipNrElem)
{
    return new  ::wxIntPtr[sipNrElem];
}


extern "C" {static void *copy_wxIntPtr(const void *, SIP_SSIZE_T);}
static void *copy_wxIntPtr(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
{
    return new  ::wxIntPtr(reinterpret_cast<const  ::wxIntPtr *>(sipSrc)[sipSrcIdx]);
}


/* Call the mapped type's destructor. */
extern "C" {static void release_wxIntPtr(void *, int);}
static void release_wxIntPtr(void *ptr, int)
{
    Py_BEGIN_ALLOW_THREADS
    delete reinterpret_cast< ::wxIntPtr *>(ptr);
    Py_END_ALLOW_THREADS
}



extern "C" {static int convertTo_wxIntPtr(PyObject *, void **, int *, PyObject *);}
static int convertTo_wxIntPtr(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
     ::wxIntPtr **sipCppPtr = reinterpret_cast< ::wxIntPtr **>(sipCppPtrV);

        // Allow conversions from any number type
        if (!sipIsErr) {
            if (PyNumber_Check(sipPy))
                return TRUE;
            return FALSE;
        }

        // Do the conversion
        #if SIZEOF_LONG >= SIZEOF_VOID_P
            *sipCppPtr = new wxIntPtr(wxPyInt_AsLong(sipPy));
        #else
            *sipCppPtr = new wxIntPtr(wxPyInt_AsSsize_t(sipPy));
        #endif
        return sipGetState(sipTransferObj);
}


extern "C" {static PyObject *convertFrom_wxIntPtr(void *, PyObject *);}
static PyObject *convertFrom_wxIntPtr(void *sipCppV, PyObject *)
{
    ::wxIntPtr *sipCpp = reinterpret_cast< ::wxIntPtr *>(sipCppV);

        #if SIZEOF_LONG >= SIZEOF_VOID_P
            return wxPyInt_FromLong(*sipCpp);
        #else
            return wxPyInt_FromSsize_t(*sipCpp);
        #endif
}


sipMappedTypeDef sipTypeDef__core_wxIntPtr = {
    {
        -1,
        SIP_NULLPTR,
        0,
        SIP_TYPE_MAPPED,
        sipNameNr_wxIntPtr,     /* wxIntPtr */
        {0},
        0
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_wxIntPtr,
    array_wxIntPtr,
    copy_wxIntPtr,
    release_wxIntPtr,
    convertTo_wxIntPtr,
    convertFrom_wxIntPtr
};
