/*
 * Interface wrapper code.
 *
 * Generated by SIP 4.19.6
 */

#include "sipAPIKCodecs.h"

#include <kcodecs.h>
#include <kcodecs.h>

#include <qbytearray.h>
#include <kcodecs.h>
#include <kcodecs.h>
#include <kcodecs.h>
#include <kcodecs.h>


extern "C" {static PyObject *meth_KCodecs_Codec_codecForName(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_codecForName(PyObject *, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const char* a0;

        if (sipParseArgs(&sipParseErr, sipArgs, "s", &a0))
        {
             ::KCodecs::Codec*sipRes;

            sipRes =  ::KCodecs::Codec::codecForName(a0);

            return sipConvertFromType(sipRes,sipType_KCodecs_Codec,NULL);
        }
    }

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

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

            sipRes =  ::KCodecs::Codec::codecForName(*a0);
            sipReleaseType(const_cast< ::QByteArray *>(a0),sipType_QByteArray,a0State);

            return sipConvertFromType(sipRes,sipType_KCodecs_Codec,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_codecForName, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_maxEncodedSizeFor(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_maxEncodedSizeFor(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        int a0;
         ::KCodecs::Codec::NewlineType a1 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, &a0, sipType_KCodecs_Codec_NewlineType, &a1))
        {
            int sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_Codec, sipName_maxEncodedSizeFor);
                return NULL;
            }

            sipRes = sipCpp->maxEncodedSizeFor(a0,a1);

            return SIPLong_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_maxEncodedSizeFor, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_maxDecodedSizeFor(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_maxDecodedSizeFor(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        int a0;
         ::KCodecs::Codec::NewlineType a1 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, &a0, sipType_KCodecs_Codec_NewlineType, &a1))
        {
            int sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_Codec, sipName_maxDecodedSizeFor);
                return NULL;
            }

            sipRes = sipCpp->maxDecodedSizeFor(a0,a1);

            return SIPLong_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_maxDecodedSizeFor, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_makeEncoder(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_makeEncoder(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
         ::KCodecs::Codec::NewlineType a0 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, sipType_KCodecs_Codec_NewlineType, &a0))
        {
             ::KCodecs::Encoder*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_Codec, sipName_makeEncoder);
                return NULL;
            }

            sipRes = sipCpp->makeEncoder(a0);

            return sipConvertFromType(sipRes,sipType_KCodecs_Encoder,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_makeEncoder, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_makeDecoder(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_makeDecoder(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
         ::KCodecs::Codec::NewlineType a0 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, sipType_KCodecs_Codec_NewlineType, &a0))
        {
             ::KCodecs::Decoder*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_Codec, sipName_makeDecoder);
                return NULL;
            }

            sipRes = sipCpp->makeDecoder(a0);

            return sipConvertFromType(sipRes,sipType_KCodecs_Decoder,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_makeDecoder, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_encode(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_encode(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const  ::QByteArray* a0;
        int a0State = 0;
         ::KCodecs::Codec::NewlineType a1 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, sipType_QByteArray, &a0, &a0State, sipType_KCodecs_Codec_NewlineType, &a1))
        {
             ::QByteArray*sipRes;

            sipRes = new  ::QByteArray((sipSelfWasArg ? sipCpp-> ::KCodecs::Codec::encode(*a0,a1) : sipCpp->encode(*a0,a1)));
            sipReleaseType(const_cast< ::QByteArray *>(a0),sipType_QByteArray,a0State);

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

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_encode, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_decode(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_decode(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const  ::QByteArray* a0;
        int a0State = 0;
         ::KCodecs::Codec::NewlineType a1 = KCodecs::Codec::NewlineLF;
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1|E", &sipSelf, sipType_KCodecs_Codec, &sipCpp, sipType_QByteArray, &a0, &a0State, sipType_KCodecs_Codec_NewlineType, &a1))
        {
             ::QByteArray*sipRes;

            sipRes = new  ::QByteArray((sipSelfWasArg ? sipCpp-> ::KCodecs::Codec::decode(*a0,a1) : sipCpp->decode(*a0,a1)));
            sipReleaseType(const_cast< ::QByteArray *>(a0),sipType_QByteArray,a0State);

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

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_decode, NULL);

    return NULL;
}


extern "C" {static PyObject *meth_KCodecs_Codec_name(PyObject *, PyObject *);}
static PyObject *meth_KCodecs_Codec_name(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        const  ::KCodecs::Codec *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_KCodecs_Codec, &sipCpp))
        {
            const char*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_Codec, sipName_name);
                return NULL;
            }

            sipRes = sipCpp->name();

            if (sipRes == NULL)
            {
                Py_INCREF(Py_None);
                return Py_None;
            }

            return SIPBytes_FromString(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Codec, sipName_name, NULL);

    return NULL;
}


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


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


static PyMethodDef methods_KCodecs_Codec[] = {
    {SIP_MLNAME_CAST(sipName_codecForName), meth_KCodecs_Codec_codecForName, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_decode), meth_KCodecs_Codec_decode, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_encode), meth_KCodecs_Codec_encode, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_makeDecoder), meth_KCodecs_Codec_makeDecoder, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_makeEncoder), meth_KCodecs_Codec_makeEncoder, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_maxDecodedSizeFor), meth_KCodecs_Codec_maxDecodedSizeFor, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_maxEncodedSizeFor), meth_KCodecs_Codec_maxEncodedSizeFor, METH_VARARGS, NULL},
    {SIP_MLNAME_CAST(sipName_name), meth_KCodecs_Codec_name, METH_VARARGS, NULL}
};

static sipEnumMemberDef enummembers_KCodecs_Codec[] = {
    {sipName_NewlineCRLF, static_cast<int>( ::KCodecs::Codec::NewlineCRLF), 4},
    {sipName_NewlineLF, static_cast<int>( ::KCodecs::Codec::NewlineLF), 4},
};


static pyqt5ClassPluginDef plugin_KCodecs_Codec = {
    0,
    0,
    0,
    0
};


sipClassTypeDef sipTypeDef_KCodecs_KCodecs_Codec = {
    {
        -1,
        0,
        0,
        SIP_TYPE_ABSTRACT|SIP_TYPE_SUPER_INIT|SIP_TYPE_CLASS,
        sipNameNr_KCodecs__Codec,
        {0},
        &plugin_KCodecs_Codec
    },
    {
        sipNameNr_Codec,
        {1, 255, 0},
        8, methods_KCodecs_Codec,
        2, enummembers_KCodecs_Codec,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    },
    0,
    -1,
    -1,
    0,
    0,
    0,
    0,
    0,
#if PY_MAJOR_VERSION >= 3
    0,
    0,
#else
    0,
    0,
    0,
    0,
#endif
    dealloc_KCodecs_Codec,
    0,
    0,
    0,
    release_KCodecs_Codec,
    0,
    0,
    0,
    0,
    0,
    0,
    0
};
