/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.10.0
 *
 *     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 *, Py_ssize_t, void *);}
static void assign_wxIntPtr(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast<::wxIntPtr *>(sipDst)[sipDstIdx] = *reinterpret_cast<::wxIntPtr *>(sipSrc);
}


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


extern "C" {static void *copy_wxIntPtr(const void *, Py_ssize_t);}
static void *copy_wxIntPtr(const void *sipSrc, Py_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 *sipCppV, int)
{
    ::wxIntPtr *sipCpp = reinterpret_cast<::wxIntPtr *>(sipCppV);
    Py_BEGIN_ALLOW_THREADS
    delete sipCpp;
    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,
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_wxIntPtr,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        -1,
        {0, 0, 1},
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR}
    },
    assign_wxIntPtr,
    array_wxIntPtr,
    copy_wxIntPtr,
    release_wxIntPtr,
    convertTo_wxIntPtr,
    convertFrom_wxIntPtr
};
