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

#line 87 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qstringconverter.sip"
#include <qstringconverter.h>
#line 29 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"

#line 54 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qstringconverter_base.sip"
#include <qstringconverter_base.h>
#line 33 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"
#line 25 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qflags.sip"
#include <qglobal.h>
#line 36 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"
#line 28 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qstringconverter_base.sip"
#include <qstringconverter_base.h>
#line 39 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"
#line 30 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qbytearray.sip"
#include <qbytearray.h>
#line 42 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"
#line 24 "/build/pyqt6/src/PyQt6-6.4.0/sip/QtCore/qstringview.sip"
#include <qstringview.h>
#line 45 "/build/pyqt6/src/PyQt6-6.4.0/build/QtCore/sipQtCoreQStringEncoder.cpp"


PyDoc_STRVAR(doc_QStringEncoder_encode, "encode(self, str) -> QByteArray");

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

    {
         ::QStringView* a0;
        int a0State = 0;
        void *a0UserState = SIP_NULLPTR;
         ::QStringEncoder *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QStringEncoder, &sipCpp, sipType_QStringView, &a0, &a0State, &a0UserState))
        {
             ::QByteArray*sipRes;

            sipRes = new  ::QByteArray(sipCpp->encode(*a0));
            sipReleaseTypeUS(a0, sipType_QStringView, a0State, a0UserState);

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

    sipNoMethod(sipParseErr, sipName_QStringEncoder, sipName_encode, doc_QStringEncoder_encode);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_QStringEncoder___call__(PyObject *,PyObject *,PyObject *);}
static PyObject *slot_QStringEncoder___call__(PyObject *sipSelf,PyObject *sipArgs,PyObject *)
{
     ::QStringEncoder *sipCpp = reinterpret_cast< ::QStringEncoder *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QStringEncoder));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
         ::QStringView* a0;
        int a0State = 0;
        void *a0UserState = SIP_NULLPTR;

        if (sipParseArgs(&sipParseErr, sipArgs, "J1", sipType_QStringView, &a0, &a0State, &a0UserState))
        {
             ::QByteArray*sipRes;

            sipRes = new  ::QByteArray((*sipCpp)(*a0));
            sipReleaseTypeUS(a0, sipType_QStringView, a0State, a0UserState);

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

    sipNoMethod(sipParseErr, sipName_QStringEncoder, sipName___call__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


/* Cast a pointer to a type somewhere in its inheritance hierarchy. */
extern "C" {static void *cast_QStringEncoder(void *, const sipTypeDef *);}
static void *cast_QStringEncoder(void *sipCppV, const sipTypeDef *targetType)
{
     ::QStringEncoder *sipCpp = reinterpret_cast< ::QStringEncoder *>(sipCppV);

    if (targetType == sipType_QStringEncoder)
        return sipCppV;

    sipCppV = ((const sipClassTypeDef *)sipType_QStringConverter)->ctd_cast(static_cast< ::QStringConverter *>(sipCpp), targetType);
    if (sipCppV)
        return sipCppV;

    return SIP_NULLPTR;
}


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


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


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


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


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

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

            return sipCpp;
        }
    }

    {
         ::QStringConverter::Encoding a0;
         ::QStringConverterBase::Flags a1def = QStringConverterBase::Flag::Default;
         ::QStringConverterBase::Flags* a1 = &a1def;
        int a1State = 0;

        static const char *sipKwdList[] = {
            SIP_NULLPTR,
            sipName_flags,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "E|J1", sipType_QStringConverter_Encoding, &a0, sipType_QFlags_0100QStringConverterBase_Flag, &a1, &a1State))
        {
            sipCpp = new  ::QStringEncoder(a0,*a1);
            sipReleaseType(a1, sipType_QFlags_0100QStringConverterBase_Flag, a1State);

            return sipCpp;
        }
    }

    {
        const char* a0;
        PyObject *a0Keep;
         ::QStringConverterBase::Flags a1def = QStringConverterBase::Flag::Default;
         ::QStringConverterBase::Flags* a1 = &a1def;
        int a1State = 0;

        static const char *sipKwdList[] = {
            SIP_NULLPTR,
            sipName_flags,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "AA|J1", &a0Keep, &a0, sipType_QFlags_0100QStringConverterBase_Flag, &a1, &a1State))
        {
            sipCpp = new  ::QStringEncoder(a0,*a1);
            Py_DECREF(a0Keep);
            sipReleaseType(a1, sipType_QFlags_0100QStringConverterBase_Flag, a1State);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's super-types. */
static sipEncodedTypeDef supers_QStringEncoder[] = {{292, 255, 1}};


/* Define this type's Python slots. */
static sipPySlotDef slots_QStringEncoder[] = {
    {(void *)slot_QStringEncoder___call__, call_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_QStringEncoder[] = {
    {sipName_encode, meth_QStringEncoder_encode, METH_VARARGS, doc_QStringEncoder_encode}
};

PyDoc_STRVAR(doc_QStringEncoder, "\1QStringEncoder()\n"
"QStringEncoder(QStringConverter.Encoding, flags: QStringConverterBase.Flag = QStringConverterBase.Flag.Default)\n"
"QStringEncoder(str, flags: QStringConverterBase.Flag = QStringConverterBase.Flag.Default)");


sipClassTypeDef sipTypeDef_QtCore_QStringEncoder = {
    {
        SIP_NULLPTR,
        SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QStringEncoder,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        sipNameNr_QStringEncoder,
        {0, 0, 1},
        1, methods_QStringEncoder,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_QStringEncoder,
    -1,
    -1,
    supers_QStringEncoder,
    slots_QStringEncoder,
    init_type_QStringEncoder,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QStringEncoder,
    SIP_NULLPTR,
    array_QStringEncoder,
    SIP_NULLPTR,
    release_QStringEncoder,
    cast_QStringEncoder,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_QStringEncoder,
    sizeof ( ::QStringEncoder),
};
