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

#line 27 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qpycore_qhash.sip"
#include <qhash.h>
#line 29 "/build/pyqt6/src/PyQt6-6.4.0/build/QtRemoteObjects/sipQtRemoteObjectsQHash0100QString0100QRemoteObjectSourceLocationInfo.cpp"

#line 28 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtRemoteObjects/qtremoteobjectglobal.sip"
#include <qtremoteobjectglobal.h>
#line 33 "/build/pyqt6/src/PyQt6-6.4.0/build/QtRemoteObjects/sipQtRemoteObjectsQHash0100QString0100QRemoteObjectSourceLocationInfo.cpp"
#line 24 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qstring.sip"
#include <qstring.h>
#line 36 "/build/pyqt6/src/PyQt6-6.4.0/build/QtRemoteObjects/sipQtRemoteObjectsQHash0100QString0100QRemoteObjectSourceLocationInfo.cpp"


extern "C" {static void assign_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(void *, Py_ssize_t, void *);}
static void assign_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast<QHash< ::QString, ::QRemoteObjectSourceLocationInfo> *>(sipDst)[sipDstIdx] = *reinterpret_cast<QHash< ::QString, ::QRemoteObjectSourceLocationInfo> *>(sipSrc);
}


extern "C" {static void *array_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(Py_ssize_t);}
static void *array_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(Py_ssize_t sipNrElem)
{
    return new QHash< ::QString, ::QRemoteObjectSourceLocationInfo>[sipNrElem];
}


extern "C" {static void *copy_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(const void *, Py_ssize_t);}
static void *copy_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new QHash< ::QString, ::QRemoteObjectSourceLocationInfo>(reinterpret_cast<const QHash< ::QString, ::QRemoteObjectSourceLocationInfo> *>(sipSrc)[sipSrcIdx]);
}


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



extern "C" {static int convertTo_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(PyObject *, void **, int *, PyObject *, void **);}
static int convertTo_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(PyObject *sipPy, void **sipCppPtrV, int *sipIsErr, PyObject *sipTransferObj, void **)
{
    QHash< ::QString, ::QRemoteObjectSourceLocationInfo> **sipCppPtr = reinterpret_cast<QHash< ::QString, ::QRemoteObjectSourceLocationInfo> **>(sipCppPtrV);

#line 85 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qpycore_qhash.sip"
    if (!sipIsErr)
        return PyDict_Check(sipPy);

    QHash<QString, QRemoteObjectSourceLocationInfo> *qh = new QHash<QString, QRemoteObjectSourceLocationInfo>;

    Py_ssize_t pos = 0;
    PyObject *kobj, *vobj;
 
    while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
    {
        int kstate;
        QString *k = reinterpret_cast<QString *>(
                sipForceConvertToType(kobj, sipType_QString, sipTransferObj,
                        SIP_NOT_NONE, &kstate, sipIsErr));

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

            delete qh;

            return 0;
        }

        int vstate;
        QRemoteObjectSourceLocationInfo *v = reinterpret_cast<QRemoteObjectSourceLocationInfo *>(
                sipForceConvertToType(vobj, sipType_QRemoteObjectSourceLocationInfo, sipTransferObj,
                        SIP_NOT_NONE, &vstate, sipIsErr));

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

            sipReleaseType(k, sipType_QString, kstate);
            delete qh;

            return 0;
        }

        qh->insert(*k, *v);

        sipReleaseType(v, sipType_QRemoteObjectSourceLocationInfo, vstate);
        sipReleaseType(k, sipType_QString, kstate);
    }
 
    *sipCppPtr = qh;
 
    return sipGetState(sipTransferObj);
#line 128 "/build/pyqt6/src/PyQt6-6.4.0/build/QtRemoteObjects/sipQtRemoteObjectsQHash0100QString0100QRemoteObjectSourceLocationInfo.cpp"
}


extern "C" {static PyObject *convertFrom_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(void *, PyObject *);}
static PyObject *convertFrom_QHash_0100QString_0100QRemoteObjectSourceLocationInfo(void *sipCppV, PyObject *sipTransferObj)
{
   QHash< ::QString, ::QRemoteObjectSourceLocationInfo> *sipCpp = reinterpret_cast<QHash< ::QString, ::QRemoteObjectSourceLocationInfo> *>(sipCppV);

#line 31 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qpycore_qhash.sip"
    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QHash<QString, QRemoteObjectSourceLocationInfo>::const_iterator it = sipCpp->constBegin();
    QHash<QString, QRemoteObjectSourceLocationInfo>::const_iterator end = sipCpp->constEnd();

    while (it != end)
    {
        QString *k = new QString(it.key());
        PyObject *kobj = sipConvertFromNewType(k, sipType_QString,
                sipTransferObj);

        if (!kobj)
        {
            delete k;
            Py_DECREF(d);

            return 0;
        }

        QRemoteObjectSourceLocationInfo *v = new QRemoteObjectSourceLocationInfo(it.value());
        PyObject *vobj = sipConvertFromNewType(v, sipType_QRemoteObjectSourceLocationInfo,
                sipTransferObj);

        if (!vobj)
        {
            delete v;
            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 189 "/build/pyqt6/src/PyQt6-6.4.0/build/QtRemoteObjects/sipQtRemoteObjectsQHash0100QString0100QRemoteObjectSourceLocationInfo.cpp"
}


sipMappedTypeDef sipTypeDef_QtRemoteObjects_QHash_0100QString_0100QRemoteObjectSourceLocationInfo = {
    {
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_51,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_QHash_0100QString_0100QRemoteObjectSourceLocationInfo,
    array_QHash_0100QString_0100QRemoteObjectSourceLocationInfo,
    copy_QHash_0100QString_0100QRemoteObjectSourceLocationInfo,
    release_QHash_0100QString_0100QRemoteObjectSourceLocationInfo,
    convertTo_QHash_0100QString_0100QRemoteObjectSourceLocationInfo,
    convertFrom_QHash_0100QString_0100QRemoteObjectSourceLocationInfo
};
