/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.6.1
 *
 * Copyright (c) 2022 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQt6-Charts.
 * 
 * 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 "sipAPIQtCharts.h"

#line 143 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/sip/QtCharts/qhash.sip"
#include <qhash.h>
#include <qvariant.h>
#include <qxyseries.h>
#line 31 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/build/QtCharts/sipQtChartsQHash18000600QHash0100QXYSeriesPointConfiguration0100QVariant.cpp"



extern "C" {static void assign_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *, Py_ssize_t, void *);}
static void assign_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *>(sipSrc);
}


extern "C" {static void *array_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(Py_ssize_t);}
static void *array_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(Py_ssize_t sipNrElem)
{
    return new  ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> >[sipNrElem];
}


extern "C" {static void *copy_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(const void *, Py_ssize_t);}
static void *copy_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new  ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> >(reinterpret_cast<const  ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *>(sipSrc)[sipSrcIdx]);
}


/* Call the mapped type's destructor. */
extern "C" {static void release_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *, int, void *);}
static void release_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *sipCppV, int, void *)
{
     ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *sipCpp = reinterpret_cast< ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *>(sipCppV);
    delete sipCpp;
}



extern "C" {static int convertTo_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(PyObject *, void **, int *, PyObject *, void **);}
static int convertTo_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(PyObject *sipPy, void **sipCppPtrV, int *sipIsErr, PyObject *sipTransferObj, void **)
{
     ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > **sipCppPtr = reinterpret_cast< ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > **>(sipCppPtrV);

#line 207 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/sip/QtCharts/qhash.sip"
    if (!sipIsErr)
        return PyDict_Check(sipPy);

    static const sipTypeDef *value_td = SIP_NULLPTR;

    if (!value_td)
    {
        value_td = sipFindType(
                "QHash<QXYSeries::PointConfiguration,QVariant>");
        Q_ASSERT(value_td);
    }

    QHash<int, QHash<QXYSeries::PointConfiguration, QVariant> > *qh = new QHash<int, QHash<QXYSeries::PointConfiguration, QVariant> >;

    Py_ssize_t pos = 0;
    PyObject *kobj, *vobj;
 
    while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
    {
        int k = sipLong_AsInt(kobj);

        if (PyErr_Occurred())
        {
            PyErr_Format(PyExc_TypeError,
                    "a key has type '%s' but 'int' is expected",
                    sipPyTypeName(Py_TYPE(kobj)));

            delete qh;
            *sipIsErr = 1;

            return 0;
        }

        int vstate;
        QHash<QXYSeries::PointConfiguration, QVariant> *v = reinterpret_cast<QHash<QXYSeries::PointConfiguration, QVariant>*>(
                sipForceConvertToType(vobj, value_td, sipTransferObj,
                        SIP_NOT_NONE, &vstate, sipIsErr));

        if (*sipIsErr)
        {
            PyErr_Format(PyExc_TypeError,
                    "a dict value has type '%s' but 'dict' is expected",
                    sipPyTypeName(Py_TYPE(vobj)));

            delete qh;

            return 0;
        }

        qh->insert(k, *v);

        sipReleaseType(v, value_td, vstate);
    }
 
    *sipCppPtr = qh;
 
    return sipGetState(sipTransferObj);
#line 129 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/build/QtCharts/sipQtChartsQHash18000600QHash0100QXYSeriesPointConfiguration0100QVariant.cpp"
}


extern "C" {static PyObject *convertFrom_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *, PyObject *);}
static PyObject *convertFrom_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant(void *sipCppV, PyObject *sipTransferObj)
{
    ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *sipCpp = reinterpret_cast< ::QHash<int,QHash<QXYSeries::PointConfiguration,QVariant> > *>(sipCppV);

#line 149 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/sip/QtCharts/qhash.sip"
    static const sipTypeDef *value_td = SIP_NULLPTR;

    if (!value_td)
    {
        value_td = sipFindType(
                "QHash<QXYSeries::PointConfiguration,QVariant>");
        Q_ASSERT(value_td);
    }

    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QHash<int, QHash<QXYSeries::PointConfiguration, QVariant> >::const_iterator it = sipCpp->constBegin();
    QHash<int, QHash<QXYSeries::PointConfiguration, QVariant> >::const_iterator end = sipCpp->constEnd();

    while (it != end)
    {
        PyObject *kobj = PyLong_FromLong(it.key());

        if (!kobj)
        {
            Py_DECREF(d);

            return 0;
        }

        QHash<QXYSeries::PointConfiguration, QVariant> v = it.value();
        PyObject *vobj = sipConvertFromType(&v, value_td, sipTransferObj);

        if (!vobj)
        {
            Py_DECREF(kobj);
            Py_DECREF(d);

            return 0;
        }

        int rc = PyDict_SetItem(d, kobj, vobj);

        Py_DECREF(vobj);
        Py_DECREF(kobj);

        if (rc < 0)
        {
            Py_DECREF(d);

            return 0;
        }

        ++it;
    }

    return d;
#line 194 "/build/pyqt6-charts/src/PyQt6_Charts-6.3.0/build/QtCharts/sipQtChartsQHash18000600QHash0100QXYSeriesPointConfiguration0100QVariant.cpp"
}


sipMappedTypeDef sipTypeDef_QtCharts_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant = {
    {
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_0,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant,
    array_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant,
    copy_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant,
    release_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant,
    convertTo_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant,
    convertFrom_QHash_1800_0600QHash_0100QXYSeries_PointConfiguration_0100QVariant
};
