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

#include "sipAPI_core.h"
        #include <wx/bmpbndl.h>


extern "C" {static void assign_wxVector_0100wxBitmapBundle(void *, Py_ssize_t, void *);}
static void assign_wxVector_0100wxBitmapBundle(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast<wxVector<::wxBitmapBundle> *>(sipDst)[sipDstIdx] = *reinterpret_cast<wxVector<::wxBitmapBundle> *>(sipSrc);
}


extern "C" {static void *array_wxVector_0100wxBitmapBundle(Py_ssize_t);}
static void *array_wxVector_0100wxBitmapBundle(Py_ssize_t sipNrElem)
{
    return new wxVector<::wxBitmapBundle>[sipNrElem];
}


extern "C" {static void *copy_wxVector_0100wxBitmapBundle(const void *, Py_ssize_t);}
static void *copy_wxVector_0100wxBitmapBundle(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new wxVector<::wxBitmapBundle>(reinterpret_cast<const wxVector<::wxBitmapBundle> *>(sipSrc)[sipSrcIdx]);
}


/* Call the mapped type's destructor. */
extern "C" {static void release_wxVector_0100wxBitmapBundle(void *, int);}
static void release_wxVector_0100wxBitmapBundle(void *sipCppV, int)
{
    wxVector<::wxBitmapBundle> *sipCpp = reinterpret_cast<wxVector<::wxBitmapBundle> *>(sipCppV);
    Py_BEGIN_ALLOW_THREADS
    delete sipCpp;
    Py_END_ALLOW_THREADS
}



extern "C" {static int convertTo_wxVector_0100wxBitmapBundle(PyObject *, void **, int *, PyObject *);}
static int convertTo_wxVector_0100wxBitmapBundle(PyObject *sipPy, void **sipCppPtrV, int *sipIsErr, PyObject *sipTransferObj)
{
    wxVector<::wxBitmapBundle> **sipCppPtr = reinterpret_cast<wxVector<::wxBitmapBundle> **>(sipCppPtrV);
        PyObject *iter = PyObject_GetIter(sipPy);

        if (!sipIsErr) {
            PyErr_Clear();
            Py_XDECREF(iter);

            return (iter
#if PY_MAJOR_VERSION < 3
                    && !PyString_Check(sipPy)
#endif
                    && !PyUnicode_Check(sipPy));
        }

        if (!iter) {
            *sipIsErr = 1;

            return 0;
        }

        wxVector<wxBitmapBundle> *wv = new wxVector<wxBitmapBundle>;

        for (Py_ssize_t i = 0; ; ++i) {
            PyErr_Clear();
            PyObject *itm = PyIter_Next(iter);

            if (!itm) {
                if (PyErr_Occurred()) {
                    delete wv;
                    Py_DECREF(iter);
                    *sipIsErr = 1;

                    return 0;
                }

                break;
            }

            int state;
            wxBitmapBundle *t = reinterpret_cast<wxBitmapBundle *>(
                    sipForceConvertToType(itm, sipType_wxBitmapBundle, sipTransferObj,
                            SIP_NOT_NONE, &state, sipIsErr));

            if (*sipIsErr) {
                PyErr_Format(PyExc_TypeError,
                        "index %zd has type '%s' but 'wxBitmapBundle' is expected", i,
                        sipPyTypeName(Py_TYPE(itm)));

                Py_DECREF(itm);
                delete wv;
                Py_DECREF(iter);

                return 0;
            }

            wv->push_back(*t);

            sipReleaseType(t, sipType_wxBitmapBundle, state);
            Py_DECREF(itm);
        }

        Py_DECREF(iter);
 
        *sipCppPtr = wv;
 
        return sipGetState(sipTransferObj);
}


extern "C" {static PyObject *convertFrom_wxVector_0100wxBitmapBundle(void *, PyObject *);}
static PyObject *convertFrom_wxVector_0100wxBitmapBundle(void *sipCppV, PyObject *sipTransferObj)
{
    wxVector<::wxBitmapBundle> *sipCpp = reinterpret_cast<wxVector<::wxBitmapBundle> *>(sipCppV);
        PyObject *l = PyList_New(sipCpp->size());

        if (!l)
            return 0;

        for (int i = 0; i < sipCpp->size(); ++i) {
            wxBitmapBundle *t = new wxBitmapBundle(sipCpp->at(i));
            PyObject *tobj = sipConvertFromNewType(t, sipType_wxBitmapBundle,
                    sipTransferObj);

            if (!tobj) {
                delete t;
                Py_DECREF(l);

                return 0;
            }

            PyList_SetItem(l, i, tobj);
        }

        return l;
}


sipMappedTypeDef sipTypeDef__core_wxVector_0100wxBitmapBundle = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_23546,
        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_wxVector_0100wxBitmapBundle,
    array_wxVector_0100wxBitmapBundle,
    copy_wxVector_0100wxBitmapBundle,
    release_wxVector_0100wxBitmapBundle,
    convertTo_wxVector_0100wxBitmapBundle,
    convertFrom_wxVector_0100wxBitmapBundle
};
