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

#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcborstream.sip"
#include <qcborstream.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"

#line 26 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qiodevice.sip"
#include <qiodevice.h>
#line 33 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"
#line 30 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qbytearray.sip"
#include <qbytearray.h>
#line 36 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"
#line 27 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qstring.sip"
#include <qstring.h>
#line 39 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"


PyDoc_STRVAR(doc_QCborStreamWriter_setDevice, "setDevice(self, QIODevice)");

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

    {
         ::QIODevice* a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ8", &sipSelf, sipType_QCborStreamWriter, &sipCpp, sipType_QIODevice, &a0))
        {
            sipCpp->setDevice(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_setDevice, doc_QCborStreamWriter_setDevice);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_device, "device(self) -> QIODevice");

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

    {
        const  ::QCborStreamWriter *sipCpp;

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

            sipRes = sipCpp->device();

            return sipConvertFromType(sipRes,sipType_QIODevice,SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_device, doc_QCborStreamWriter_device);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_append, "append(self, QCborSimpleType)\n"
"append(self, QCborKnownTags)\n"
"append(self, str)\n"
"append(self, Union[QByteArray, bytes, bytearray])\n"
"append(self, bool)\n"
"append(self, float)\n"
"append(self, int)");

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

    {
         ::QCborSimpleType a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BE", &sipSelf, sipType_QCborStreamWriter, &sipCpp, sipType_QCborSimpleType, &a0))
        {
            sipCpp->append(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
         ::QCborKnownTags a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BE", &sipSelf, sipType_QCborStreamWriter, &sipCpp, sipType_QCborKnownTags, &a0))
        {
            sipCpp->append(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        const  ::QString* a0;
        int a0State = 0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QCborStreamWriter, &sipCpp, sipType_QString, &a0, &a0State))
        {
            sipCpp->append(a0);
            sipReleaseType(const_cast< ::QString *>(a0), sipType_QString, a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

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

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QCborStreamWriter, &sipCpp, sipType_QByteArray, &a0, &a0State))
        {
            sipCpp->append(*a0);
            sipReleaseType(const_cast< ::QByteArray *>(a0), sipType_QByteArray, a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        bool a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BXb", &sipSelf, sipType_QCborStreamWriter, &sipCpp, &a0))
        {
            sipCpp->append(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        double a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BXd", &sipSelf, sipType_QCborStreamWriter, &sipCpp, &a0))
        {
#line 44 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcborstream.sip"
        // Use the smallest type without losing precision.
        
        qfloat16 a0_16 = a0;
        
        if (qIsNaN(a0) || a0_16 == a0)
        {
            sipCpp->append(a0_16);
        }
        else
        {
            float a0_float = a0;
        
            if (a0_float == a0)
                sipCpp->append(a0_float);
            else
                sipCpp->append(a0);
        }
#line 209 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        PyObject * a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BP0", &sipSelf, sipType_QCborStreamWriter, &sipCpp, &a0))
        {
            sipErrorState sipError = sipErrorNone;

#line 65 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcborstream.sip"
        #if PY_MAJOR_VERSION < 3
        if (PyLong_Check(a0))
        #endif
        {
            static PyObject *zero = 0;
        
            if (!zero)
                zero = PyLong_FromLong(0);
        
            if (PyObject_RichCompareBool(a0, zero, Py_LT) > 0)
            {
                PyErr_Clear();
                qint64 val = sipLong_AsLongLong(a0);
        
                if (PyErr_Occurred())
                    sipError = sipErrorFail;
                else
                    sipCpp->append(val);
            }
            else
            {
                PyErr_Clear();
                quint64 val = sipLong_AsUnsignedLongLong(a0);
        
                if (PyErr_Occurred())
                    sipError = sipErrorFail;
                else
                    sipCpp->append(val);
            }
        }
        #if PY_MAJOR_VERSION < 3
        else if (PyInt_Check(a0))
        {
            PyErr_Clear();
            long val = PyInt_AsLong(a0);
        
            if (PyErr_Occurred())
                sipError = sipErrorFail;
            else if (val < 0)
                sipCpp->append((qint64)val);
            else
                sipCpp->append((quint64)val);
        }
        #endif
#line 269 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQCborStreamWriter.cpp"

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            Py_INCREF(Py_None);
            return Py_None;
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_append, doc_QCborStreamWriter_append);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_appendNull, "appendNull(self)");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            sipCpp->appendNull();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_appendNull, doc_QCborStreamWriter_appendNull);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_appendUndefined, "appendUndefined(self)");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            sipCpp->appendUndefined();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_appendUndefined, doc_QCborStreamWriter_appendUndefined);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_startArray, "startArray(self)\n"
"startArray(self, int)");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            sipCpp->startArray();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
         ::quint64 a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bo", &sipSelf, sipType_QCborStreamWriter, &sipCpp, &a0))
        {
            sipCpp->startArray(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_startArray, doc_QCborStreamWriter_startArray);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_endArray, "endArray(self) -> bool");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            bool sipRes;

            sipRes = sipCpp->endArray();

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_endArray, doc_QCborStreamWriter_endArray);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_startMap, "startMap(self)\n"
"startMap(self, int)");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            sipCpp->startMap();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
         ::quint64 a0;
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bo", &sipSelf, sipType_QCborStreamWriter, &sipCpp, &a0))
        {
            sipCpp->startMap(a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_startMap, doc_QCborStreamWriter_startMap);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QCborStreamWriter_endMap, "endMap(self) -> bool");

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

    {
         ::QCborStreamWriter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QCborStreamWriter, &sipCpp))
        {
            bool sipRes;

            sipRes = sipCpp->endMap();

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_QCborStreamWriter, sipName_endMap, doc_QCborStreamWriter_endMap);

    return SIP_NULLPTR;
}


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


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


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

    {
         ::QIODevice* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J8", sipType_QIODevice, &a0))
        {
            sipCpp = new  ::QCborStreamWriter(a0);

            return sipCpp;
        }
    }

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J0", sipType_QByteArray, &a0, &a0State))
        {
            sipCpp = new  ::QCborStreamWriter(a0);
            sipReleaseType(a0, sipType_QByteArray, a0State);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_QCborStreamWriter[] = {
    {sipName_append, meth_QCborStreamWriter_append, METH_VARARGS, doc_QCborStreamWriter_append},
    {sipName_appendNull, meth_QCborStreamWriter_appendNull, METH_VARARGS, doc_QCborStreamWriter_appendNull},
    {sipName_appendUndefined, meth_QCborStreamWriter_appendUndefined, METH_VARARGS, doc_QCborStreamWriter_appendUndefined},
    {sipName_device, meth_QCborStreamWriter_device, METH_VARARGS, doc_QCborStreamWriter_device},
    {sipName_endArray, meth_QCborStreamWriter_endArray, METH_VARARGS, doc_QCborStreamWriter_endArray},
    {sipName_endMap, meth_QCborStreamWriter_endMap, METH_VARARGS, doc_QCborStreamWriter_endMap},
    {sipName_setDevice, meth_QCborStreamWriter_setDevice, METH_VARARGS, doc_QCborStreamWriter_setDevice},
    {sipName_startArray, meth_QCborStreamWriter_startArray, METH_VARARGS, doc_QCborStreamWriter_startArray},
    {sipName_startMap, meth_QCborStreamWriter_startMap, METH_VARARGS, doc_QCborStreamWriter_startMap}
};

PyDoc_STRVAR(doc_QCborStreamWriter, "\1QCborStreamWriter(QIODevice)\n"
"QCborStreamWriter(Union[QByteArray, bytes, bytearray])");


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


sipClassTypeDef sipTypeDef_QtCore_QCborStreamWriter = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QCborStreamWriter,
        SIP_NULLPTR,
        &plugin_QCborStreamWriter
    },
    {
        sipNameNr_QCborStreamWriter,
        {0, 0, 1},
        9, methods_QCborStreamWriter,
        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_QCborStreamWriter,
    -1,
    sipNameNr_sip_simplewrapper,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_QCborStreamWriter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QCborStreamWriter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_QCborStreamWriter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof ( ::QCborStreamWriter),
};
