/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.5.0
 *
 * Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQtDataVisualization.
 * 
 * This file may be used under the terms of the GNU General Public License
 * version 3.0 as published by the Free Software Foundation and appearing in
 * the file LICENSE included in the packaging of this file.  Please review the
 * following information to ensure the GNU General Public License version 3.0
 * requirements will be met: http://www.gnu.org/copyleft/gpl.html.
 * 
 * If you do not wish to use this file under the terms of the GPL version 3.0
 * then you may purchase a commercial license.  For more information contact
 * info@riverbankcomputing.com.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtDataVisualization.h"

#line 30 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
#include <qimage.h>
#include <qvector.h>
#line 30 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector0101QImage.cpp"

#line 26 "/usr/lib/python3.10/site-packages/PyQt5/bindings/QtGui/qimage.sip"
#include <qimage.h>
#line 34 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector0101QImage.cpp"


extern "C" {static void assign_QVector_0101QImage(void *, Py_ssize_t, void *);}
static void assign_QVector_0101QImage(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QVector< ::QImage*> *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QVector< ::QImage*> *>(sipSrc);
}


extern "C" {static void *array_QVector_0101QImage(Py_ssize_t);}
static void *array_QVector_0101QImage(Py_ssize_t sipNrElem)
{
    return new  ::QVector< ::QImage*>[sipNrElem];
}


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


/* Call the mapped type's destructor. */
extern "C" {static void release_QVector_0101QImage(void *, int);}
static void release_QVector_0101QImage(void *sipCppV, int)
{
     ::QVector< ::QImage*> *sipCpp = reinterpret_cast< ::QVector< ::QImage*> *>(sipCppV);
    delete sipCpp;
}



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

#line 60 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
    PyObject *iter = PyObject_GetIter(sipPy);

    if (!sipIsErr)
    {
        Py_XDECREF(iter);

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

    if (!iter)
    {
        *sipIsErr = 1;

        return 0;
    }

    QVector<QImage *> *ql = new QVector<QImage *>;
 
    for (SIP_SSIZE_T i = 0; ; ++i)
    {
        PyErr_Clear();
        PyObject *itm = PyIter_Next(iter);

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

                return 0;
            }

            break;
        }

        QImage *t = reinterpret_cast<QImage *>(
                sipForceConvertToType(itm, sipType_QImage, sipTransferObj, 0,
                        0, sipIsErr));
 
        if (*sipIsErr)
        {
            PyErr_Format(PyExc_TypeError,
                    "index " SIP_SSIZE_T_FORMAT " has type '%s' but 'QImage' is expected",
                    i, sipPyTypeName(Py_TYPE(itm)));

            Py_DECREF(itm);
            delete ql;
            Py_DECREF(iter);

            return 0;
        }

        ql->append(t);

        Py_DECREF(itm);
    }

    Py_DECREF(iter);
 
    *sipCppPtr = ql;
 
    return sipGetState(sipTransferObj);
#line 142 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector0101QImage.cpp"
}


extern "C" {static PyObject *convertFrom_QVector_0101QImage(void *, PyObject *);}
static PyObject *convertFrom_QVector_0101QImage(void *sipCppV, PyObject *sipTransferObj)
{
    ::QVector< ::QImage*> *sipCpp = reinterpret_cast< ::QVector< ::QImage*> *>(sipCppV);

#line 35 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
    PyObject *l = PyList_New(sipCpp->size());

    if (!l)
        return 0;

    for (int i = 0; i < sipCpp->size(); ++i)
    {
        QImage *t = sipCpp->at(i);

        PyObject *tobj = sipConvertFromType(t, sipType_QImage, sipTransferObj);

        if (!tobj)
        {
            Py_DECREF(l);

            return 0;
        }

        PyList_SetItem(l, i, tobj);
    }

    return l;
#line 174 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector0101QImage.cpp"
}


sipMappedTypeDef sipTypeDef_QtDataVisualization_QVector_0101QImage = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_10360,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_QVector_0101QImage,
    array_QVector_0101QImage,
    copy_QVector_0101QImage,
    release_QVector_0101QImage,
    convertTo_QVector_0101QImage,
    convertFrom_QVector_0101QImage
};
