/*
 * Interface wrapper code.
 *
 * Generated by SIP 4.19.24
 *
 *     Copyright: (c) 2020 by Total Control Software
 *     License:   wxWindows License
 */

#include "sipAPI_richtext.h"

        
        typedef wxList wxRichTextFileHandlerList;

        #include <wx/richtext/richtextbuffer.h>
        
        typedef wxList wxRichTextFileHandlerList;
        class wxRichTextFileHandlerList_iterator {
        public:
            wxRichTextFileHandlerList_iterator(wxRichTextFileHandlerList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextFileHandler* __next__() {
                wxRichTextFileHandler* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextFileHandler*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextFileHandler*)obj;
            }
        private:
            wxRichTextFileHandlerList::compatibility_iterator m_node;
        };


PyDoc_STRVAR(doc_wxRichTextFileHandlerList_index, "index(self, obj: RichTextFileHandler) -> int");

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

    {
         ::wxRichTextFileHandler* obj;
         ::wxRichTextFileHandlerList *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxRichTextFileHandlerList, &sipCpp, sipType_wxRichTextFileHandler, &obj))
        {
            int sipRes = 0;
            sipErrorState sipError = sipErrorNone;

        int idx = sipCpp->IndexOf((wxRichTextFileHandler*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            return SIPLong_FromLong(sipRes);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextFileHandlerList, sipName_index, doc_wxRichTextFileHandlerList_index);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxRichTextFileHandlerList___iter__(PyObject *);}
static PyObject *slot_wxRichTextFileHandlerList___iter__(PyObject *sipSelf)
{
     ::wxRichTextFileHandlerList *sipCpp = reinterpret_cast< ::wxRichTextFileHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextFileHandlerList));

    if (!sipCpp)
        return SIP_NULLPTR;


    {
        {
             ::wxRichTextFileHandlerList_iterator*sipRes = 0;

        sipRes =  new wxRichTextFileHandlerList_iterator(sipCpp->GetFirst());

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

    return 0;
}


extern "C" {static int slot_wxRichTextFileHandlerList___contains__(PyObject *,PyObject *);}
static int slot_wxRichTextFileHandlerList___contains__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxRichTextFileHandlerList *sipCpp = reinterpret_cast< ::wxRichTextFileHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextFileHandlerList));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxRichTextFileHandler* obj;

        if (sipParseArgs(&sipParseErr, sipArg, "1J8", sipType_wxRichTextFileHandler, &obj))
        {
            int sipRes = 0;

        wxRichTextFileHandlerList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextFileHandler*)obj);
        sipRes = node != NULL;

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextFileHandlerList, sipName___contains__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_wxRichTextFileHandlerList___getitem__(PyObject *,PyObject *);}
static PyObject *slot_wxRichTextFileHandlerList___getitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxRichTextFileHandlerList *sipCpp = reinterpret_cast< ::wxRichTextFileHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextFileHandlerList));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

        if (sipParseArgs(&sipParseErr, sipArg, "1l", &index))
        {
             ::wxRichTextFileHandler*sipRes = 0;
            sipErrorState sipError = sipErrorNone;

        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextFileHandlerList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextFileHandler*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            return sipConvertFromType(sipRes,sipType_wxRichTextFileHandler,SIP_NULLPTR);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextFileHandlerList, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static SIP_SSIZE_T slot_wxRichTextFileHandlerList___len__(PyObject *);}
static SIP_SSIZE_T slot_wxRichTextFileHandlerList___len__(PyObject *sipSelf)
{
     ::wxRichTextFileHandlerList *sipCpp = reinterpret_cast< ::wxRichTextFileHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextFileHandlerList));

    if (!sipCpp)
        return 0;


    {
        {
            SIP_SSIZE_T sipRes = 0;

        sipRes = sipCpp->size();

            return sipRes;
        }
    }

    return 0;
}


/* Call the instance's destructor. */
extern "C" {static void release_wxRichTextFileHandlerList(void *, int);}
static void release_wxRichTextFileHandlerList(void *sipCppV, int)
{
    Py_BEGIN_ALLOW_THREADS

    delete reinterpret_cast< ::wxRichTextFileHandlerList *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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


extern "C" {static void assign_wxRichTextFileHandlerList(void *, SIP_SSIZE_T, void *);}
static void assign_wxRichTextFileHandlerList(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxRichTextFileHandlerList *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxRichTextFileHandlerList *>(sipSrc);
}


extern "C" {static void *copy_wxRichTextFileHandlerList(const void *, SIP_SSIZE_T);}
static void *copy_wxRichTextFileHandlerList(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
{
    return new  ::wxRichTextFileHandlerList(reinterpret_cast<const  ::wxRichTextFileHandlerList *>(sipSrc)[sipSrcIdx]);
}


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


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

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

            return sipCpp;
        }
    }

    {
        const  ::wxRichTextFileHandlerList* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxRichTextFileHandlerList, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxRichTextFileHandlerList(*a0);
            Py_END_ALLOW_THREADS

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxRichTextFileHandlerList[] = {
    {(void *)slot_wxRichTextFileHandlerList___iter__, iter_slot},
    {(void *)slot_wxRichTextFileHandlerList___contains__, contains_slot},
    {(void *)slot_wxRichTextFileHandlerList___getitem__, getitem_slot},
    {(void *)slot_wxRichTextFileHandlerList___len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxRichTextFileHandlerList[] = {
    {SIP_MLNAME_CAST(sipName_index), SIP_MLMETH_CAST(meth_wxRichTextFileHandlerList_index), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRichTextFileHandlerList_index)}
};

PyDoc_STRVAR(doc_wxRichTextFileHandlerList, "\1RichTextFileHandlerList()\n"
"RichTextFileHandlerList(RichTextFileHandlerList)");


sipClassTypeDef sipTypeDef__richtext_wxRichTextFileHandlerList = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxRichTextFileHandlerList,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_RichTextFileHandlerList,
        {0, 0, 1},
        1, methods_wxRichTextFileHandlerList,
        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_wxRichTextFileHandlerList,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxRichTextFileHandlerList,
    init_type_wxRichTextFileHandlerList,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxRichTextFileHandlerList,
    assign_wxRichTextFileHandlerList,
    array_wxRichTextFileHandlerList,
    copy_wxRichTextFileHandlerList,
    release_wxRichTextFileHandlerList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
