/*
 * 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 "sipAPIQtNfc.h"

#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefmessage.sip"
#include <qndefmessage.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"

#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefrecord.sip"
#include <qndefrecord.h>
#line 33 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"
#line 38 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qpycore_qlist.sip"
#include <qlist.h>
#line 36 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"
#line 30 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qbytearray.sip"
#include <qbytearray.h>
#line 39 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"


PyDoc_STRVAR(doc_QNdefMessage_toByteArray, "toByteArray(self) -> QByteArray");

extern "C" {static PyObject *meth_QNdefMessage_toByteArray(PyObject *, PyObject *);}
static PyObject *meth_QNdefMessage_toByteArray(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::QNdefMessage *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QNdefMessage, &sipCpp))
        {
             ::QByteArray*sipRes;

            sipRes = new  ::QByteArray(sipCpp->toByteArray());

            return sipConvertFromNewType(sipRes,sipType_QByteArray,SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QNdefMessage, sipName_toByteArray, doc_QNdefMessage_toByteArray);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QNdefMessage_fromByteArray, "fromByteArray(Union[QByteArray, bytes, bytearray]) -> QNdefMessage");

extern "C" {static PyObject *meth_QNdefMessage_fromByteArray(PyObject *, PyObject *);}
static PyObject *meth_QNdefMessage_fromByteArray(PyObject *, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::QByteArray* a0;
        int a0State = 0;

        if (sipParseArgs(&sipParseErr, sipArgs, "J1", sipType_QByteArray, &a0, &a0State))
        {
             ::QNdefMessage*sipRes;

            sipRes = new  ::QNdefMessage( ::QNdefMessage::fromByteArray(*a0));
            sipReleaseType(const_cast< ::QByteArray *>(a0), sipType_QByteArray, a0State);

            return sipConvertFromNewType(sipRes,sipType_QNdefMessage,SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QNdefMessage, sipName_fromByteArray, doc_QNdefMessage_fromByteArray);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_QNdefMessage___ne__(PyObject *,PyObject *);}
static PyObject *slot_QNdefMessage___ne__(PyObject *sipSelf,PyObject *sipArg)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::QNdefMessage* a0;

        if (sipParseArgs(&sipParseErr, sipArg, "1J9", sipType_QNdefMessage, &a0))
        {
            bool sipRes;

            sipRes = !sipCpp-> ::QNdefMessage::operator==(*a0);

            return PyBool_FromLong(sipRes);
        }
    }

    Py_XDECREF(sipParseErr);

    if (sipParseErr == Py_None)
        return SIP_NULLPTR;

    return sipPySlotExtend(&sipModuleAPI_QtNfc, ne_slot, sipType_QNdefMessage, sipSelf, sipArg);
}


extern "C" {static int slot_QNdefMessage___delitem__(PyObject *,PyObject *);}
static int slot_QNdefMessage___delitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        int a0;

        if (sipParseArgs(&sipParseErr, sipArg, "1i", &a0))
        {
            int sipIsErr = 0;

#line 65 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefmessage.sip"
        if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0)
            sipIsErr = 1;
        else
            sipCpp->removeAt(a0);
#line 152 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"

            if (sipIsErr)
                return -1;

            return 0;
        }
    }

    sipNoMethod(sipParseErr, sipName_QNdefMessage, sipName___delitem__, SIP_NULLPTR);

    return -1;
}


extern "C" {static int slot_QNdefMessage___setitem__(PyObject *,PyObject *);}
static int slot_QNdefMessage___setitem__(PyObject *sipSelf,PyObject *sipArgs)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        int a0;
        const  ::QNdefRecord* a1;

        if (sipParseArgs(&sipParseErr, sipArgs, "iJ9", &a0, sipType_QNdefRecord, &a1))
        {
            int sipIsErr = 0;

#line 55 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefmessage.sip"
        int len = sipCpp->count();
        
        if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
            sipIsErr = 1;
        else
            (*sipCpp)[a0] = *a1;
#line 192 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"

            if (sipIsErr)
                return -1;

            return 0;
        }
    }

    sipNoMethod(sipParseErr, sipName_QNdefMessage, sipName___setitem__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_QNdefMessage___getitem__(PyObject *,PyObject *);}
static PyObject *slot_QNdefMessage___getitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        int a0;

        if (sipParseArgs(&sipParseErr, sipArg, "1i", &a0))
        {
             ::QNdefRecord*sipRes = 0;
            int sipIsErr = 0;

#line 45 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefmessage.sip"
        Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
        
        if (idx < 0)
            sipIsErr = 1;
        else
            sipRes = new QNdefRecord(sipCpp->at((int)idx));
#line 232 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"

            if (sipIsErr)
                return 0;

            return sipConvertFromNewType(sipRes,sipType_QNdefRecord,SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QNdefMessage, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static Py_ssize_t slot_QNdefMessage___len__(PyObject *);}
static Py_ssize_t slot_QNdefMessage___len__(PyObject *sipSelf)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return 0;


    {
        {
            int sipRes = 0;

#line 40 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtNfc/qndefmessage.sip"
        sipRes = sipCpp->count();
#line 262 "/build/pyqt5/src/PyQt5-5.15.7/build/QtNfc/sipQtNfcQNdefMessage.cpp"

            return sipRes;
        }
    }

    return 0;
}


extern "C" {static PyObject *slot_QNdefMessage___eq__(PyObject *,PyObject *);}
static PyObject *slot_QNdefMessage___eq__(PyObject *sipSelf,PyObject *sipArg)
{
     ::QNdefMessage *sipCpp = reinterpret_cast< ::QNdefMessage *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNdefMessage));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::QNdefMessage* a0;

        if (sipParseArgs(&sipParseErr, sipArg, "1J9", sipType_QNdefMessage, &a0))
        {
            bool sipRes;

            sipRes = sipCpp-> ::QNdefMessage::operator==(*a0);

            return PyBool_FromLong(sipRes);
        }
    }

    Py_XDECREF(sipParseErr);

    if (sipParseErr == Py_None)
        return SIP_NULLPTR;

    return sipPySlotExtend(&sipModuleAPI_QtNfc, eq_slot, sipType_QNdefMessage, sipSelf, sipArg);
}


/* Call the instance's destructor. */
extern "C" {static void release_QNdefMessage(void *, int);}
static void release_QNdefMessage(void *sipCppV, int)
{
    delete reinterpret_cast< ::QNdefMessage *>(sipCppV);
}


extern "C" {static void *array_QNdefMessage(Py_ssize_t);}
static void *array_QNdefMessage(Py_ssize_t sipNrElem)
{
    return new  ::QNdefMessage[sipNrElem];
}


extern "C" {static void array_delete_QNdefMessage(void *);}
static void array_delete_QNdefMessage(void *sipCpp)
{
    delete[] reinterpret_cast< ::QNdefMessage *>(sipCpp);
}


extern "C" {static void assign_QNdefMessage(void *, Py_ssize_t, void *);}
static void assign_QNdefMessage(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QNdefMessage *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QNdefMessage *>(sipSrc);
}


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


extern "C" {static void dealloc_QNdefMessage(sipSimpleWrapper *);}
static void dealloc_QNdefMessage(sipSimpleWrapper *sipSelf)
{
    if (sipIsOwnedByPython(sipSelf))
    {
        release_QNdefMessage(sipGetAddress(sipSelf), 0);
    }
}


extern "C" {static void *init_type_QNdefMessage(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_QNdefMessage(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
     ::QNdefMessage *sipCpp = SIP_NULLPTR;

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            sipCpp = new  ::QNdefMessage();

            return sipCpp;
        }
    }

    {
        const  ::QNdefRecord* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_QNdefRecord, &a0))
        {
            sipCpp = new  ::QNdefMessage(*a0);

            return sipCpp;
        }
    }

    {
        const  ::QNdefMessage* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_QNdefMessage, &a0))
        {
            sipCpp = new  ::QNdefMessage(*a0);

            return sipCpp;
        }
    }

    {
        const QList< ::QNdefRecord>* a0;
        int a0State = 0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J1", sipType_QList_0100QNdefRecord, &a0, &a0State))
        {
            sipCpp = new  ::QNdefMessage(*a0);
            sipReleaseType(const_cast<QList< ::QNdefRecord> *>(a0), sipType_QList_0100QNdefRecord, a0State);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_QNdefMessage[] = {
    {(void *)slot_QNdefMessage___ne__, ne_slot},
    {(void *)slot_QNdefMessage___delitem__, delitem_slot},
    {(void *)slot_QNdefMessage___setitem__, setitem_slot},
    {(void *)slot_QNdefMessage___getitem__, getitem_slot},
    {(void *)slot_QNdefMessage___len__, len_slot},
    {(void *)slot_QNdefMessage___eq__, eq_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_QNdefMessage[] = {
    {sipName_fromByteArray, meth_QNdefMessage_fromByteArray, METH_VARARGS, doc_QNdefMessage_fromByteArray},
    {sipName_toByteArray, meth_QNdefMessage_toByteArray, METH_VARARGS, doc_QNdefMessage_toByteArray}
};

PyDoc_STRVAR(doc_QNdefMessage, "\1QNdefMessage()\n"
"QNdefMessage(QNdefRecord)\n"
"QNdefMessage(QNdefMessage)\n"
"QNdefMessage(Iterable[QNdefRecord])");


static pyqt5ClassPluginDef plugin_QNdefMessage = {
    SIP_NULLPTR,
    0,
    SIP_NULLPTR,
    SIP_NULLPTR
};


sipClassTypeDef sipTypeDef_QtNfc_QNdefMessage = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QNdefMessage,
        SIP_NULLPTR,
        &plugin_QNdefMessage
    },
    {
        sipNameNr_QNdefMessage,
        {0, 0, 1},
        2, methods_QNdefMessage,
        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},
    },
    doc_QNdefMessage,
    -1,
    sipNameNr_sip_simplewrapper,
    SIP_NULLPTR,
    slots_QNdefMessage,
    init_type_QNdefMessage,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QNdefMessage,
    assign_QNdefMessage,
    array_QNdefMessage,
    copy_QNdefMessage,
    release_QNdefMessage,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_QNdefMessage,
    sizeof ( ::QNdefMessage),
};
