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

#line 29 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNetwork/qpynetwork_qmap.sip"
#include <qmap.h>
#include <qssl.h>
#line 30 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNetwork/sipQtNetworkQMultiMap0100QSslAlternativeNameEntryType0100QString.cpp"

#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNetwork/qssl.sip"
#include <qssl.h>
#line 34 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNetwork/sipQtNetworkQMultiMap0100QSslAlternativeNameEntryType0100QString.cpp"
#line 27 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qstring.sip"
#include <qstring.h>
#line 37 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNetwork/sipQtNetworkQMultiMap0100QSslAlternativeNameEntryType0100QString.cpp"


extern "C" {static void assign_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(void *, Py_ssize_t, void *);}
static void assign_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString> *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString> *>(sipSrc);
}


extern "C" {static void *array_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(Py_ssize_t);}
static void *array_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(Py_ssize_t sipNrElem)
{
    return new  ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString>[sipNrElem];
}


extern "C" {static void *copy_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(const void *, Py_ssize_t);}
static void *copy_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new  ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString>(reinterpret_cast<const  ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString> *>(sipSrc)[sipSrcIdx]);
}


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



extern "C" {static int convertTo_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(PyObject *, void **, int *, PyObject *);}
static int convertTo_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(PyObject *sipPy, void **, int *sipIsErr, PyObject *)
{
#line 204 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNetwork/qpynetwork_qmap.sip"
    if (!sipIsErr)
        return PyDict_Check(sipPy);

    PyErr_SetString(PyExc_NotImplementedError,
            "converting to QMultiMap<QSsl::AlternativeNameEntryType, QString> is unsupported");

    return 0;
#line 82 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNetwork/sipQtNetworkQMultiMap0100QSslAlternativeNameEntryType0100QString.cpp"
}


extern "C" {static PyObject *convertFrom_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(void *, PyObject *);}
static PyObject *convertFrom_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString(void *sipCppV, PyObject *sipTransferObj)
{
    ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString> *sipCpp = reinterpret_cast< ::QMultiMap< ::QSsl::AlternativeNameEntryType, ::QString> *>(sipCppV);

#line 34 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNetwork/qpynetwork_qmap.sip"
    // Get the enum member objects that are the dictionary keys.
    static PyObject *email_entry = 0;

    if (!email_entry)
    {
        email_entry = PyObject_GetAttrString(
                (PyObject *)sipTypeAsPyTypeObject(sipType_QSsl), "EmailEntry");

        if (!email_entry)
            return 0;
    }

    static PyObject *dns_entry = 0;

    if (!dns_entry)
    {
        dns_entry = PyObject_GetAttrString(
                (PyObject *)sipTypeAsPyTypeObject(sipType_QSsl), "DnsEntry");

        if (!dns_entry)
            return 0;
    }

#if QT_VERSION >= 0x050d00
    static PyObject *ip_address_entry = 0;

    if (!ip_address_entry)
    {
        ip_address_entry = PyObject_GetAttrString(
                (PyObject *)sipTypeAsPyTypeObject(sipType_QSsl), "IpAddressEntry");

        if (!ip_address_entry)
            return 0;
    }
#endif

    // Create the dictionary.
    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QList<QString> vl;

    // Handle the Qssl::EmailEntry key.
    vl = sipCpp->values(QSsl::EmailEntry);

    if (!vl.isEmpty())
    {
        PyObject *vlobj = PyList_New(vl.count());

        if (!vlobj)
        {
            Py_DECREF(d);
            return 0;
        }

        int rc = PyDict_SetItem(d, email_entry, vlobj);

        Py_DECREF(vlobj);

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

        for (int i = 0; i < vl.count(); ++i)
        {
            QString *s = new QString(vl.at(i));
            PyObject *vobj = sipConvertFromNewType(s, sipType_QString,
                    sipTransferObj);

            if (!vobj)
            {
                delete s;
                Py_DECREF(d);
                return 0;
            }

            PyList_SetItem(vlobj, i, vobj);
        }
    }

    // Handle the Qssl::DnsEntry key.
    vl = sipCpp->values(QSsl::DnsEntry);

    if (!vl.isEmpty())
    {
        PyObject *vlobj = PyList_New(vl.count());

        if (!vlobj)
        {
            Py_DECREF(d);
            return 0;
        }

        int rc = PyDict_SetItem(d, dns_entry, vlobj);

        Py_DECREF(vlobj);

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

        for (int i = 0; i < vl.count(); ++i)
        {
            QString *s = new QString(vl.at(i));
            PyObject *vobj = sipConvertFromNewType(s, sipType_QString,
                    sipTransferObj);

            if (!vobj)
            {
                delete s;
                Py_DECREF(d);
                return 0;
            }

            PyList_SetItem(vlobj, i, vobj);
        }
    }

#if QT_VERSION >= 0x050d00
    // Handle the Qssl::IpAddressEntry key.
    vl = sipCpp->values(QSsl::IpAddressEntry);

    if (!vl.isEmpty())
    {
        PyObject *vlobj = PyList_New(vl.count());

        if (!vlobj)
        {
            Py_DECREF(d);
            return 0;
        }

        int rc = PyDict_SetItem(d, ip_address_entry, vlobj);

        Py_DECREF(vlobj);

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

        for (int i = 0; i < vl.count(); ++i)
        {
            QString *s = new QString(vl.at(i));
            PyObject *vobj = sipConvertFromNewType(s, sipType_QString,
                    sipTransferObj);

            if (!vobj)
            {
                delete s;
                Py_DECREF(d);
                return 0;
            }

            PyList_SetItem(vlobj, i, vobj);
        }
    }
#endif

    return d;
#line 259 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNetwork/sipQtNetworkQMultiMap0100QSslAlternativeNameEntryType0100QString.cpp"
}


sipMappedTypeDef sipTypeDef_QtNetwork_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString = {
    {
        -1,
        SIP_NULLPTR,
        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, 0, 0}
    },
    assign_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString,
    array_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString,
    copy_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString,
    release_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString,
    convertTo_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString,
    convertFrom_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString
};
