/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//workaround to access protected functions
#define protected public

// default includes
#include <shiboken.h>
#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QDebug>
#include <pysidesignal.h>
#include <pysideproperty.h>
#include <pyside.h>
#include <pysideqenum.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED

#include <typeinfo>
#include <iterator>

// module include
#include "pyside6_qtscxml_python.h"

// main header
#include "qscxmlexecutablecontent_evaluatorinfo_wrapper.h"

// inner classes

#include <cctype>
#include <cstring>

using namespace QScxmlExecutableContent;



template <class T>
static const char *typeNameOf(const T &t)
{
    const char *typeName =  typeid(t).name();
    auto size = std::strlen(typeName);
#if defined(Q_CC_MSVC) // MSVC: "class QPaintDevice * __ptr64"
    if (auto lastStar = strchr(typeName, '*')) {
        // MSVC: "class QPaintDevice * __ptr64"
        while (*--lastStar == ' ') {
        }
        size = lastStar - typeName + 1;
    }
#else // g++, Clang: "QPaintDevice *" -> "P12QPaintDevice"
    if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) {
        ++typeName;
        --size;
    }
#endif
    char *result = new char[size + 1];
    result[size] = '\0';
    memcpy(result, typeName, size);
    return result;
}


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

extern "C" {
static int
Sbk_QScxmlExecutableContent_EvaluatorInfo_Init(PyObject *self, PyObject *args, PyObject *kwds)
{
    SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::QScxmlExecutableContent::EvaluatorInfo >()))
        return -1;

    ::QScxmlExecutableContent::EvaluatorInfo *cptr{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo.__init__";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[1];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "EvaluatorInfo", 0, 1, &(pyArgs[0])))
        return -1;


    // Overloaded function decisor
    // 0: EvaluatorInfo::EvaluatorInfo()
    // 1: EvaluatorInfo::EvaluatorInfo(QScxmlExecutableContent::EvaluatorInfo)
    if (numArgs == 0) {
        overloadId = 0; // EvaluatorInfo()
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], (pyArgs[0])))) {
        overloadId = 1; // EvaluatorInfo(QScxmlExecutableContent::EvaluatorInfo)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QScxmlExecutableContent_EvaluatorInfo_Init_TypeError;

    // Call function/method
    switch (overloadId) {
        case 0: // EvaluatorInfo()
        {

            if (!PyErr_Occurred()) {
                // EvaluatorInfo()
                cptr = new ::QScxmlExecutableContent::EvaluatorInfo();
            }
            break;
        }
        case 1: // EvaluatorInfo(const QScxmlExecutableContent::EvaluatorInfo & EvaluatorInfo)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QScxmlExecutableContent::EvaluatorInfo cppArg0_local;
            ::QScxmlExecutableContent::EvaluatorInfo *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);


            if (!PyErr_Occurred()) {
                // EvaluatorInfo(QScxmlExecutableContent::EvaluatorInfo)
                cptr = new ::QScxmlExecutableContent::EvaluatorInfo(*cppArg0);
            }
            break;
        }
    }

    if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::QScxmlExecutableContent::EvaluatorInfo >(), cptr)) {
        delete cptr;
        return -1;
    }
    if (!cptr) goto Sbk_QScxmlExecutableContent_EvaluatorInfo_Init_TypeError;

    Shiboken::Object::setValidCpp(sbkSelf, true);
    if (Shiboken::BindingManager::instance().hasWrapper(cptr)) {
        Shiboken::BindingManager::instance().releaseWrapper(Shiboken::BindingManager::instance().retrieveWrapper(cptr));
    }
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);


    return 1;

    Sbk_QScxmlExecutableContent_EvaluatorInfo_Init_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return -1;
}

static PyObject *Sbk_QScxmlExecutableContent_EvaluatorInfo___copy__(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto &cppSelf = *reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], &cppSelf);
    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


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

static PyMethodDef Sbk_QScxmlExecutableContent_EvaluatorInfo_methods[] = {

    {"__copy__", reinterpret_cast<PyCFunction>(Sbk_QScxmlExecutableContent_EvaluatorInfo___copy__), METH_NOARGS},
    {nullptr, nullptr} // Sentinel
};

static PyObject *Sbk_QScxmlExecutableContent_EvaluatorInfo_get_expr(PyObject *self, void *)
{
    if (!Shiboken::Object::isValid(self))
        return nullptr;
    auto cppSelf = reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    int cppOut_local = cppSelf->expr;
    PyObject *pyOut = {};
    pyOut = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &cppOut_local);
    return pyOut;
}
static int Sbk_QScxmlExecutableContent_EvaluatorInfo_set_expr(PyObject *self, PyObject *pyIn, void *)
{
    if (!Shiboken::Object::isValid(self))
        return 0;
    auto cppSelf = reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    if (pyIn == nullptr) {
        PyErr_SetString(PyExc_TypeError, "'expr' may not be deleted");
        return -1;
    }
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    if (!(pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyIn)))) {
        PyErr_SetString(PyExc_TypeError, "wrong type attributed to 'expr', 'int' or convertible type expected");
        return -1;
    }

    auto cppOut_local = cppSelf->expr;
    pythonToCpp(pyIn, &cppOut_local);
    cppSelf->expr = cppOut_local;

    return 0;
}

static PyObject *Sbk_QScxmlExecutableContent_EvaluatorInfo_get_context(PyObject *self, void *)
{
    if (!Shiboken::Object::isValid(self))
        return nullptr;
    auto cppSelf = reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    int cppOut_local = cppSelf->context;
    PyObject *pyOut = {};
    pyOut = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &cppOut_local);
    return pyOut;
}
static int Sbk_QScxmlExecutableContent_EvaluatorInfo_set_context(PyObject *self, PyObject *pyIn, void *)
{
    if (!Shiboken::Object::isValid(self))
        return 0;
    auto cppSelf = reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    if (pyIn == nullptr) {
        PyErr_SetString(PyExc_TypeError, "'context' may not be deleted");
        return -1;
    }
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    if (!(pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyIn)))) {
        PyErr_SetString(PyExc_TypeError, "wrong type attributed to 'context', 'int' or convertible type expected");
        return -1;
    }

    auto cppOut_local = cppSelf->context;
    pythonToCpp(pyIn, &cppOut_local);
    cppSelf->context = cppOut_local;

    return 0;
}

// Getters and Setters for EvaluatorInfo
static PyGetSetDef Sbk_QScxmlExecutableContent_EvaluatorInfo_getsetlist[] = {
    {const_cast<char *>("expr"), Sbk_QScxmlExecutableContent_EvaluatorInfo_get_expr, Sbk_QScxmlExecutableContent_EvaluatorInfo_set_expr},
    {const_cast<char *>("context"), Sbk_QScxmlExecutableContent_EvaluatorInfo_get_context, Sbk_QScxmlExecutableContent_EvaluatorInfo_set_context},
    {nullptr} // Sentinel
};

} // extern "C"

static int Sbk_QScxmlExecutableContent_EvaluatorInfo_traverse(PyObject *self, visitproc visit, void *arg)
{
    return SbkObject_TypeF()->tp_traverse(self, visit, arg);
}
static int Sbk_QScxmlExecutableContent_EvaluatorInfo_clear(PyObject *self)
{
    return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);
}
// Class Definition -----------------------------------------------
extern "C" {
static PyTypeObject *_Sbk_QScxmlExecutableContent_EvaluatorInfo_Type = nullptr;
static PyTypeObject *Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(void)
{
    return _Sbk_QScxmlExecutableContent_EvaluatorInfo_Type;
}

static PyType_Slot Sbk_QScxmlExecutableContent_EvaluatorInfo_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_repr,        nullptr},
    {Py_tp_hash,        nullptr},
    {Py_tp_call,        nullptr},
    {Py_tp_str,         nullptr},
    {Py_tp_getattro,    nullptr},
    {Py_tp_setattro,    nullptr},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_methods)},
    {Py_tp_getset,      reinterpret_cast<void *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_getsetlist)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QScxmlExecutableContent_EvaluatorInfo_spec = {
    "2:PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QScxmlExecutableContent_EvaluatorInfo_slots
};

} //extern "C"


// Type conversion functions.

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void EvaluatorInfo_PythonToCpp_EvaluatorInfo_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_EvaluatorInfo_PythonToCpp_EvaluatorInfo_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF())))
        return EvaluatorInfo_PythonToCpp_EvaluatorInfo_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *EvaluatorInfo_PTR_CppToPython_EvaluatorInfo(const void *cppIn)
{
    auto pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    bool changedTypeName = false;
    auto tCppIn = reinterpret_cast<const ::QScxmlExecutableContent::EvaluatorInfo *>(cppIn);
    const char *typeName = typeid(*tCppIn).name();
    auto sbkType = Shiboken::ObjectType::typeForTypeName(typeName);
    if (sbkType && Shiboken::ObjectType::hasSpecialCastFunction(sbkType)) {
        typeName = typeNameOf(tCppIn);
        changedTypeName = true;
    }
    PyObject *result = Shiboken::Object::newObject(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(), const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);
    if (changedTypeName)
        delete [] typeName;
    return result;
}

// C++ to Python copy conversion.
static PyObject *EvaluatorInfo_COPY_CppToPython_EvaluatorInfo(const void *cppIn)
{
    return Shiboken::Object::newObject(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(), new ::QScxmlExecutableContent::EvaluatorInfo(*reinterpret_cast<const ::QScxmlExecutableContent::EvaluatorInfo *>(cppIn)), true, true);
}

// Python to C++ copy conversion.
static void EvaluatorInfo_PythonToCpp_EvaluatorInfo_COPY(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QScxmlExecutableContent::EvaluatorInfo *>(cppOut) = *reinterpret_cast< ::QScxmlExecutableContent::EvaluatorInfo *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX], reinterpret_cast<SbkObject *>(pyIn)));
}
static PythonToCppFunc is_EvaluatorInfo_PythonToCpp_EvaluatorInfo_COPY_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF())))
        return EvaluatorInfo_PythonToCpp_EvaluatorInfo_COPY;
    return {};
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QScxmlExecutableContent_EvaluatorInfo_SignatureStrings[] = {
    "1:PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo(self)",
    "0:PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo(self,EvaluatorInfo:PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo)",
    "PySide6.QtScxml.QScxmlExecutableContent.EvaluatorInfo.__copy__()",
    nullptr}; // Sentinel

void init_QScxmlExecutableContent_EvaluatorInfo(PyObject *enclosingClass)
{
    _Sbk_QScxmlExecutableContent_EvaluatorInfo_Type = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "EvaluatorInfo",
        "QScxmlExecutableContent::EvaluatorInfo",
        &Sbk_QScxmlExecutableContent_EvaluatorInfo_spec,
        &Shiboken::callCppDestructor< ::QScxmlExecutableContent::EvaluatorInfo >,
        0,
        0,
        Shiboken::ObjectType::WrapperFlags::InnerClass);
    auto *pyType = Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(); // references _Sbk_QScxmlExecutableContent_EvaluatorInfo_Type
    InitSignatureStrings(pyType, QScxmlExecutableContent_EvaluatorInfo_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QScxmlExecutableContent_EvaluatorInfo_Type), Sbk_QScxmlExecutableContent_EvaluatorInfo_PropertyStrings);
    SbkPySide6_QtScxmlTypes[SBK_QSCXMLEXECUTABLECONTENT_EVALUATORINFO_IDX]
        = Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QScxmlExecutableContent_EvaluatorInfo_TypeF(),
        EvaluatorInfo_PythonToCpp_EvaluatorInfo_PTR,
        is_EvaluatorInfo_PythonToCpp_EvaluatorInfo_PTR_Convertible,
        EvaluatorInfo_PTR_CppToPython_EvaluatorInfo,
        EvaluatorInfo_COPY_CppToPython_EvaluatorInfo);

    Shiboken::Conversions::registerConverterName(converter, "QScxmlExecutableContent::EvaluatorInfo");
    Shiboken::Conversions::registerConverterName(converter, "QScxmlExecutableContent::EvaluatorInfo*");
    Shiboken::Conversions::registerConverterName(converter, "QScxmlExecutableContent::EvaluatorInfo&");
    Shiboken::Conversions::registerConverterName(converter, "EvaluatorInfo");
    Shiboken::Conversions::registerConverterName(converter, "EvaluatorInfo*");
    Shiboken::Conversions::registerConverterName(converter, "EvaluatorInfo&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::QScxmlExecutableContent::EvaluatorInfo).name());

    // Add Python to C++ copy (value, not pointer neither reference) conversion to type converter.
    Shiboken::Conversions::addPythonToCppValueConversion(converter,
        EvaluatorInfo_PythonToCpp_EvaluatorInfo_COPY,
        is_EvaluatorInfo_PythonToCpp_EvaluatorInfo_COPY_Convertible);

    qRegisterMetaType< ::QScxmlExecutableContent::EvaluatorInfo >("EvaluatorInfo");
    qRegisterMetaType< ::QScxmlExecutableContent::EvaluatorInfo >("QScxmlExecutableContent::EvaluatorInfo");
}
