/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.15.3
 *
 * Copyright (c) 2026 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 28 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtBluetooth/qpybluetooth_qmultihash.sip"
#include <QMultiHash>
#line 29 "/build/pyqt6/src/pyqt6-6.11.0/build/QtBluetooth/sipQtBluetoothQMultiHash16000100QByteArray.cpp"

#line 30 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qbytearray.sip"
#include <qbytearray.h>
#line 33 "/build/pyqt6/src/pyqt6-6.11.0/build/QtBluetooth/sipQtBluetoothQMultiHash16000100QByteArray.cpp"


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


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


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


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



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

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

    if (!d)
        return 0;

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

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

        if (!kobj)
        {
            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 137 "/build/pyqt6/src/pyqt6-6.11.0/build/QtBluetooth/sipQtBluetoothQMultiHash16000100QByteArray.cpp"
}


sipMappedTypeDef sipTypeDef_QtBluetooth_QMultiHash_1600_0100QByteArray = {
    {
        SIP_NULLPTR,
        SIP_TYPE_MAPPED,
        sipNameNr_2702,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        -1,
        {0, 0, 1},
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR}
    },
    assign_QMultiHash_1600_0100QByteArray,
    array_QMultiHash_1600_0100QByteArray,
    copy_QMultiHash_1600_0100QByteArray,
    release_QMultiHash_1600_0100QByteArray,
    SIP_NULLPTR,
    convertFrom_QMultiHash_1600_0100QByteArray
};
