
// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

// default includes
#include <shiboken.h>
#include <sbkpep.h>
#include <sbkpepbuffer.h>

#define PYSIDE6_COMOPT_COMPRESS 1

#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QtCore/QDebug>
#include <pysideqenum.h>
#include <pysideutils.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED


// module include
#include "kxmlgui_python.h"

// main header
#include "kundoactions_wrapper.h"

// Argument includes
#include <QString>
#include <kactioncollection.h>
#include <qaction.h>

#include <cctype>
#include <cstring>
#include <iterator>
#include <type_traits>
#include <typeinfo>


// Target ---------------------------------------------------------

extern "C" {
static int Sbk_KUndoActions_Init(PyObject *, PyObject *, PyObject *)
{
    Shiboken::Errors::setInstantiateNamespace("KUndoActions");
    return -1;
}

static PyObject *Sbk_KUndoActionsFunc_createRedoAction([[maybe_unused]] PyObject *self, PyObject *args, [[maybe_unused]] PyObject *kwds)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[3];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr, nullptr};

    // invalid argument lengths
    errInfo.reset(Shiboken::checkInvalidArgumentCount(numArgs, 2, 3));
    if (!errInfo.isNull())
        return Shiboken::returnWrongArguments(args, "createRedoAction", errInfo, SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);

    if (PyArg_ParseTuple(args, "|OOO:createRedoAction", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static KUndoActions::createRedoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
    if (numArgs >= 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtGuiTypeStructs[SBK_QUndoStack_IDX]), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKXmlGuiTypeStructs[SBK_KActionCollection_IDX]), (pyArgs[1])))) {
        if (numArgs == 2) {
            overloadId = 0; // createRedoAction(QUndoStack*,KActionCollection*,QString)
        } else if (numArgs >= 3
            && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[2])))) {
            overloadId = 0; // static KUndoActions::createRedoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
        }
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "createRedoAction", SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);

    // Call function/method
    {
        if (kwds != nullptr && PyDict_Size(kwds) > 0) {
            static const Shiboken::ArgumentNameIndexMapping mapping[1] = {{"actionName", 2}};
            if (!Shiboken::parseKeywordArguments(kwds, mapping, 1, errInfo, pyArgs)
                || (pyArgs[2] != nullptr && !((pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[2])))))) {
                Py_XINCREF(errInfo.object());
                return Shiboken::returnWrongArguments(args, "createRedoAction", errInfo, SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);
            }
        }
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return {};
        ::QUndoStack *cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::KActionCollection *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);
        ::QString cppArg2 = QString();
        if (pythonToCpp[2])
            pythonToCpp[2](pyArgs[2], &cppArg2);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static KUndoActions::createRedoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
            QAction * cppResult = ::KUndoActions::createRedoAction(cppArg0, cppArg1, cppArg2);
            pyResult = Shiboken::Conversions::pointerToPython(Shiboken::Module::get(SbkPySide6_QtGuiTypeStructs[SBK_QAction_IDX]), cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KUndoActionsFunc_createUndoAction([[maybe_unused]] PyObject *self, PyObject *args, [[maybe_unused]] PyObject *kwds)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[3];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr, nullptr};

    // invalid argument lengths
    errInfo.reset(Shiboken::checkInvalidArgumentCount(numArgs, 2, 3));
    if (!errInfo.isNull())
        return Shiboken::returnWrongArguments(args, "createUndoAction", errInfo, SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);

    if (PyArg_ParseTuple(args, "|OOO:createUndoAction", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static KUndoActions::createUndoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
    if (numArgs >= 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtGuiTypeStructs[SBK_QUndoStack_IDX]), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKXmlGuiTypeStructs[SBK_KActionCollection_IDX]), (pyArgs[1])))) {
        if (numArgs == 2) {
            overloadId = 0; // createUndoAction(QUndoStack*,KActionCollection*,QString)
        } else if (numArgs >= 3
            && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[2])))) {
            overloadId = 0; // static KUndoActions::createUndoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
        }
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "createUndoAction", SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);

    // Call function/method
    {
        if (kwds != nullptr && PyDict_Size(kwds) > 0) {
            static const Shiboken::ArgumentNameIndexMapping mapping[1] = {{"actionName", 2}};
            if (!Shiboken::parseKeywordArguments(kwds, mapping, 1, errInfo, pyArgs)
                || (pyArgs[2] != nullptr && !((pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[2])))))) {
                Py_XINCREF(errInfo.object());
                return Shiboken::returnWrongArguments(args, "createUndoAction", errInfo, SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX]);
            }
        }
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return {};
        ::QUndoStack *cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::KActionCollection *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);
        ::QString cppArg2 = QString();
        if (pythonToCpp[2])
            pythonToCpp[2](pyArgs[2], &cppArg2);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static KUndoActions::createUndoAction(QUndoStack*,KActionCollection*,const QString&=)->QAction*
            QAction * cppResult = ::KUndoActions::createUndoAction(cppArg0, cppArg1, cppArg2);
            pyResult = Shiboken::Conversions::pointerToPython(Shiboken::Module::get(SbkPySide6_QtGuiTypeStructs[SBK_QAction_IDX]), cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}


static const char *Sbk_KUndoActions_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_KUndoActions_methods[] = {
    {"createRedoAction", reinterpret_cast<PyCFunction>(Sbk_KUndoActionsFunc_createRedoAction), METH_VARARGS|METH_KEYWORDS|METH_STATIC, nullptr},
    {"createUndoAction", reinterpret_cast<PyCFunction>(Sbk_KUndoActionsFunc_createUndoAction), METH_VARARGS|METH_KEYWORDS|METH_STATIC, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

} // extern "C"

static int Sbk_KUndoActions_traverse(PyObject *self, visitproc visit, void *arg)
{
    auto traverseProc = reinterpret_cast<traverseproc>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_traverse));
    ;
    return traverseProc(self, visit, arg);
}
static int Sbk_KUndoActions_clear(PyObject *self)
{
    auto clearProc = reinterpret_cast<inquiry>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_clear));
    ;
    return clearProc(self);
}

// Class Definition -----------------------------------------------
extern "C" {

static PyType_Slot Sbk_KUndoActions_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(Sbk_object_dealloc /* PYSIDE-832: Prevent replacement of "0" with subtype_dealloc. */)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_KUndoActions_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_KUndoActions_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_KUndoActions_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_KUndoActions_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkDummyNew /* PYSIDE-595: Prevent replacement of "0" with base->tp_new. */)},
    {0, nullptr}
};
static PyType_Spec Sbk_KUndoActions_spec = {
    "1:KXmlGui.KUndoActions",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_KUndoActions_slots
};

} //extern "C"

// Type conversion functions.

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *KXmlGuiKUndoActions_SignatureStrings[] = {
    "KXmlGui.KUndoActions.createRedoAction(undoStack:PySide6.QtGui.QUndoStack,actionCollection:KXmlGui.KActionCollection,actionName:QString=QString())->PySide6.QtGui.QAction",
    "KXmlGui.KUndoActions.createUndoAction(undoStack:PySide6.QtGui.QUndoStack,actionCollection:KXmlGui.KActionCollection,actionName:QString=QString())->PySide6.QtGui.QAction",
    nullptr}; // Sentinel
#else
static constexpr size_t KXmlGuiKUndoActions_SignatureByteSize = 117;
static constexpr uint8_t KXmlGuiKUndoActions_SignatureBytes[117] = {
    0x78, 0xda, 0xf3, 0x8e, 0xc8, 0xcd, 0x71, 0x2f, 0xcd, 0xd4, 0xf3, 0x0e, 0xcd, 0x4b, 0xc9, 0x77,
    0x4c, 0x2e, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x4b, 0x2e, 0x4a, 0x4d, 0x2c, 0x49, 0x0d, 0x4a, 0x85,
    0x89, 0x68, 0x94, 0x02, 0x25, 0x83, 0x4b, 0x12, 0x93, 0xb3, 0xad, 0x02, 0x2a, 0x83, 0x33, 0x53,
    0x52, 0xcd, 0xf4, 0x02, 0x4b, 0x40, 0xba, 0x02, 0x43, 0x61, 0x12, 0x3a, 0x89, 0x60, 0x95, 0xce,
    0xf9, 0x39, 0x39, 0xa9, 0x60, 0x96, 0x95, 0x37, 0xcc, 0x64, 0x47, 0x34, 0x19, 0xa8, 0x52, 0xbf,
    0xc4, 0xdc, 0x54, 0xab, 0xc0, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x5b, 0x28, 0xad, 0xa1, 0xa9,
    0xa9, 0x6b, 0x87, 0x66, 0x05, 0x44, 0x3b, 0x97, 0x37, 0x6e, 0x87, 0x22, 0x44, 0x06, 0x83, 0x43,
    0x01, 0x99, 0xf3, 0x7b, 0xa9
};
#endif

PyTypeObject *init_KXmlGuiKUndoActions(PyObject *module)
{
    auto &typeStruct = SbkKXmlGuiTypeStructs[SBK_KXmlGuiKUndoActions_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

    auto *base1 = SbkObject_TypeF();
    Shiboken::AutoDecRef Sbk_KUndoActions_Type_bases(PyTuple_Pack(1, base1));

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        module,
        "KUndoActions",
        "KUndoActions",
        &Sbk_KUndoActions_spec,
        nullptr,
        Sbk_KUndoActions_Type_bases.object(),
        0);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, KXmlGuiKUndoActions_SignatureStrings);
#else
    InitSignatureBytes(pyType, KXmlGuiKUndoActions_SignatureBytes, KXmlGuiKUndoActions_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_KUndoActions_PropertyStrings);
    typeStruct.type = pyType;



    return pyType;
}
