/*
 * 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 135 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
#include <qvector.h>
#line 29 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector1300.cpp"



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


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


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


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



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

#line 143 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
    if (!sipIsErr)
#if PY_VERSION_HEX >= 0x03000000
        return sipGetBufferInfo(sipPy, NULL);
#elif PY_VERSION_HEX >= 0x02060300
        return (PyObject_CheckBuffer(sipPy) || PyObject_CheckReadBuffer(sipPy));
#else
        return PyObject_CheckReadBuffer(sipPy);
#endif

    const void *buffer;
    SIP_SSIZE_T buffer_len;

#if PY_VERSION_HEX >= 0x03000000
    sipBufferInfoDef bi;

    if (sipGetBufferInfo(sipPy, &bi) < 0)
    {
        *sipIsErr = 1;
        return 0;
    }

    if (bi.bi_format != NULL && *bi.bi_format != 'B')
    {
        PyErr_SetString(PyExc_TypeError,
                "a buffer of unsigned bytes is required");
        *sipIsErr = 1;
        return 0;
    }

    buffer = bi.bi_buf;
    buffer_len = bi.bi_len;
#else
    if (PyObject_AsReadBuffer(sipPy, &buffer, &buffer_len) < 0)
    {
        *sipIsErr = 1;
        return 0;
    }
#endif

    QVector<unsigned char> *qv = new QVector<unsigned char>(buffer_len);

    for (SIP_SSIZE_T i = 0; i < buffer_len; ++i)
        (*qv)[i] = reinterpret_cast<const uchar *>(buffer)[i];

    *sipCppPtr = qv;
 
#if PY_VERSION_HEX >= 0x03000000
    sipReleaseBufferInfo(&bi);
#endif

    return sipGetState(sipTransferObj);
#line 121 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector1300.cpp"
}


extern "C" {static PyObject *convertFrom_QVector_1300(void *, PyObject *);}
static PyObject *convertFrom_QVector_1300(void *sipCppV, PyObject *)
{
    ::QVector<unsigned char> *sipCpp = reinterpret_cast< ::QVector<unsigned char> *>(sipCppV);

#line 139 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/sip/QtDataVisualization/qcustom3dvolume.sip"
    return sipConvertToArray(reinterpret_cast<void *>(sipCpp->data()), "B", sipCpp->size(), 0);
#line 132 "/build/pyqt5-datavisualization/src/PyQtDataVisualization-5.15.5/build/QtDataVisualization/sipQtDataVisualizationQVector1300.cpp"
}


sipMappedTypeDef sipTypeDef_QtDataVisualization_QVector_1300 = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_5479,
        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_1300,
    array_QVector_1300,
    copy_QVector_1300,
    release_QVector_1300,
    convertTo_QVector_1300,
    convertFrom_QVector_1300
};
