/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.6.2
 *
 * 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 "sipAPIQtBluetooth.h"

#line 109 "/build/pyqt6/src/PyQt6-6.3.1/sip/QtBluetooth/qpybluetooth_qmultihash.sip"
#include <QMultiHash>
#line 29 "/build/pyqt6/src/PyQt6-6.3.1/build/QtBluetooth/sipQtBluetoothQMultiHash0100QBluetoothUuid0100QByteArray.cpp"

#line 28 "/build/pyqt6/src/PyQt6-6.3.1/sip/QtBluetooth/qbluetoothuuid.sip"
#include <qbluetoothuuid.h>
#line 33 "/build/pyqt6/src/PyQt6-6.3.1/build/QtBluetooth/sipQtBluetoothQMultiHash0100QBluetoothUuid0100QByteArray.cpp"
#line 30 "/build/pyqt6/src/PyQt6-6.3.1/sip/QtCore/qbytearray.sip"
#include <qbytearray.h>
#line 36 "/build/pyqt6/src/PyQt6-6.3.1/build/QtBluetooth/sipQtBluetoothQMultiHash0100QBluetoothUuid0100QByteArray.cpp"


extern "C" {static void assign_QMultiHash_0100QBluetoothUuid_0100QByteArray(void *, Py_ssize_t, void *);}
static void assign_QMultiHash_0100QBluetoothUuid_0100QByteArray(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast<QMultiHash< ::QBluetoothUuid, ::QByteArray> *>(sipDst)[sipDstIdx] = *reinterpret_cast<QMultiHash< ::QBluetoothUuid, ::QByteArray> *>(sipSrc);
}


extern "C" {static void *array_QMultiHash_0100QBluetoothUuid_0100QByteArray(Py_ssize_t);}
static void *array_QMultiHash_0100QBluetoothUuid_0100QByteArray(Py_ssize_t sipNrElem)
{
    return new QMultiHash< ::QBluetoothUuid, ::QByteArray>[sipNrElem];
}


extern "C" {static void *copy_QMultiHash_0100QBluetoothUuid_0100QByteArray(const void *, Py_ssize_t);}
static void *copy_QMultiHash_0100QBluetoothUuid_0100QByteArray(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new QMultiHash< ::QBluetoothUuid, ::QByteArray>(reinterpret_cast<const QMultiHash< ::QBluetoothUuid, ::QByteArray> *>(sipSrc)[sipSrcIdx]);
}


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



extern "C" {static PyObject *convertFrom_QMultiHash_0100QBluetoothUuid_0100QByteArray(void *, PyObject *);}
static PyObject *convertFrom_QMultiHash_0100QBluetoothUuid_0100QByteArray(void *sipCppV, PyObject *sipTransferObj)
{
   QMultiHash< ::QBluetoothUuid, ::QByteArray> *sipCpp = reinterpret_cast<QMultiHash< ::QBluetoothUuid, ::QByteArray> *>(sipCppV);

#line 113 "/build/pyqt6/src/PyQt6-6.3.1/sip/QtBluetooth/qpybluetooth_qmultihash.sip"
    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QMultiHash<QBluetoothUuid, QByteArray>::const_iterator it = sipCpp->constBegin();
    QMultiHash<QBluetoothUuid, QByteArray>::const_iterator end = sipCpp->constEnd();

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

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

            return 0;
        }

        QList<QByteArray> values = sipCpp->values(it.key());

        PyObject *py_values = PyList_New(values.size());

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

            return 0;
        }

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

        Py_DECREF(py_values);
        Py_DECREF(kobj);

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

            return 0;
        }

        for (int i = 0; i < values.size(); ++i)
        {
            QByteArray *v = new QByteArray(values.at(i));
            PyObject *vobj = sipConvertFromNewType(v, sipType_QByteArray,
                    sipTransferObj);

            if (!vobj)
            {
                delete v;
                Py_DECREF(d);

                return 0;
            }

            PyList_SetItem(py_values, i, vobj);
        }

        ++it;
    }

    return d;
#line 143 "/build/pyqt6/src/PyQt6-6.3.1/build/QtBluetooth/sipQtBluetoothQMultiHash0100QBluetoothUuid0100QByteArray.cpp"
}


sipMappedTypeDef sipTypeDef_QtBluetooth_QMultiHash_0100QBluetoothUuid_0100QByteArray = {
    {
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_1437,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_QMultiHash_0100QBluetoothUuid_0100QByteArray,
    array_QMultiHash_0100QBluetoothUuid_0100QByteArray,
    copy_QMultiHash_0100QBluetoothUuid_0100QByteArray,
    release_QMultiHash_0100QBluetoothUuid_0100QByteArray,
    SIP_NULLPTR,
    convertFrom_QMultiHash_0100QBluetoothUuid_0100QByteArray
};
