/****************************************************************************
**
** 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 <signalmanager.h>
#include <pysidemetafunction.h>
#include <iterator>

// module include
#include "pyside6_qtcore_python.h"

// main header
#include "qlibrary_wrapper.h"

// inner classes

#include <cctype>
#include <cstring>



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;
}

// Native ---------------------------------------------------------

void QLibraryWrapper::resetPyMethodCache()
{
    std::fill_n(m_PyMethodCache, sizeof(m_PyMethodCache) / sizeof(m_PyMethodCache[0]), false);
}

QLibraryWrapper::QLibraryWrapper(QObject * parent) : QLibrary(parent)
{
    resetPyMethodCache();
    // ... middle
}

QLibraryWrapper::QLibraryWrapper(const QString & fileName, QObject * parent) : QLibrary(fileName, parent)
{
    resetPyMethodCache();
    // ... middle
}

QLibraryWrapper::QLibraryWrapper(const QString & fileName, const QString & version, QObject * parent) : QLibrary(fileName, version, parent)
{
    resetPyMethodCache();
    // ... middle
}

QLibraryWrapper::QLibraryWrapper(const QString & fileName, int verNum, QObject * parent) : QLibrary(fileName, verNum, parent)
{
    resetPyMethodCache();
    // ... middle
}

void QLibraryWrapper::childEvent(QChildEvent * event)
{
    if (m_PyMethodCache[0]) {
        return this->::QObject::childEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "childEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[0] = true;
        return this->::QObject::childEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QCHILDEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QLibraryWrapper::connectNotify(const QMetaMethod & signal)
{
    if (m_PyMethodCache[1]) {
        return this->::QObject::connectNotify(signal);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "connectNotify";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[1] = true;
        return this->::QObject::connectNotify(signal);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypes[SBK_QMETAMETHOD_IDX], &signal)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QLibraryWrapper::customEvent(QEvent * event)
{
    if (m_PyMethodCache[2]) {
        return this->::QObject::customEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "customEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[2] = true;
        return this->::QObject::customEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QLibraryWrapper::disconnectNotify(const QMetaMethod & signal)
{
    if (m_PyMethodCache[3]) {
        return this->::QObject::disconnectNotify(signal);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "disconnectNotify";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[3] = true;
        return this->::QObject::disconnectNotify(signal);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypes[SBK_QMETAMETHOD_IDX], &signal)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

bool QLibraryWrapper::event(QEvent * event)
{
    if (m_PyMethodCache[4])
        return this->::QObject::event(event);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "event";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[4] = true;
        return this->::QObject::event(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QLibrary.event",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QLibraryWrapper::eventFilter(QObject * watched, QEvent * event)
{
    if (m_PyMethodCache[5])
        return this->::QObject::eventFilter(watched, event);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "eventFilter";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[5] = true;
        return this->::QObject::eventFilter(watched, event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(NN)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], watched),
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg2 = PyTuple_GET_ITEM(pyArgs, 1)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg2)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 1));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QLibrary.eventFilter",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

void QLibraryWrapper::timerEvent(QTimerEvent * event)
{
    if (m_PyMethodCache[7]) {
        return this->::QObject::timerEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "timerEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[7] = true;
        return this->::QObject::timerEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QTIMEREVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

const QMetaObject *QLibraryWrapper::metaObject() const
{
    if (QObject::d_ptr->metaObject)
        return QObject::d_ptr->dynamicMetaObject();
    SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);
    if (pySelf == nullptr)
        return QLibrary::metaObject();
    return PySide::SignalManager::retrieveMetaObject(reinterpret_cast<PyObject *>(pySelf));
}

int QLibraryWrapper::qt_metacall(QMetaObject::Call call, int id, void **args)
{
    int result = QLibrary::qt_metacall(call, id, args);
    return result < 0 ? result : PySide::SignalManager::qt_metacall(this, call, id, args);
}

void *QLibraryWrapper::qt_metacast(const char *_clname)
{
    if (!_clname)
        return {};
    SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);
    if (pySelf && PySide::inherits(Py_TYPE(pySelf), _clname))
        return static_cast<void *>(const_cast< QLibraryWrapper *>(this));
    return QLibrary::qt_metacast(_clname);
}

QLibraryWrapper::~QLibraryWrapper()
{
    SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);
    Shiboken::Object::destroy(wrapper, this);
}

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

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

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

    // invalid argument lengths


    if (!PyArg_ParseTuple(args, "|OOO:QLibrary", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2])))
        return -1;


    // Overloaded function decisor
    // 0: QLibrary::QLibrary(QObject*)
    // 1: QLibrary::QLibrary(QString,QObject*)
    // 2: QLibrary::QLibrary(QString,QString,QObject*)
    // 3: QLibrary::QLibrary(QString,int,QObject*)
    if (numArgs == 0) {
        overloadId = 0; // QLibrary(QObject*)
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[0])))) {
        overloadId = 0; // QLibrary(QObject*)
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[0])))) {
        if (numArgs == 1) {
            overloadId = 1; // QLibrary(QString,QObject*)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyArgs[1])))) {
            if (numArgs == 2) {
                overloadId = 3; // QLibrary(QString,int,QObject*)
            } else if (numArgs >= 3
                && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[2])))) {
                overloadId = 3; // QLibrary(QString,int,QObject*)
            }
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[1])))) {
            overloadId = 1; // QLibrary(QString,QObject*)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[1])))) {
            if (numArgs == 2) {
                overloadId = 2; // QLibrary(QString,QString,QObject*)
            } else if (numArgs >= 3
                && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[2])))) {
                overloadId = 2; // QLibrary(QString,QString,QObject*)
            }
        }
    }

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

    // Call function/method
    switch (overloadId) {
        case 0: // QLibrary(QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[0]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QLibrary_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[0] = value;
                        if (!(pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[0]))))
                            goto Sbk_QLibrary_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QObject *cppArg0 = nullptr;
            if (pythonToCpp[0])
                pythonToCpp[0](pyArgs[0], &cppArg0);

            if (!PyErr_Occurred()) {
                // QLibrary(QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QLibraryWrapper(cppArg0);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QLibraryWrapper(cppArg0);
                }

                Shiboken::Object::setParent(pyArgs[0], self);
            }
            break;
        }
        case 1: // QLibrary(const QString & fileName, QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[1]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QLibrary_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[1] = value;
                        if (!(pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[1]))))
                            goto Sbk_QLibrary_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            ::QString cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            if (!Shiboken::Object::isValid(pyArgs[1]))
                return -1;
            ::QObject *cppArg1 = nullptr;
            if (pythonToCpp[1])
                pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // QLibrary(QString,QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QLibraryWrapper(cppArg0, cppArg1);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QLibraryWrapper(cppArg0, cppArg1);
                }

                Shiboken::Object::setParent(pyArgs[1], self);
            }
            break;
        }
        case 2: // QLibrary(const QString & fileName, const QString & version, QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[2]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QLibrary_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[2] = value;
                        if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[2]))))
                            goto Sbk_QLibrary_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            ::QString cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            ::QString cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);
            if (!Shiboken::Object::isValid(pyArgs[2]))
                return -1;
            ::QObject *cppArg2 = nullptr;
            if (pythonToCpp[2])
                pythonToCpp[2](pyArgs[2], &cppArg2);

            if (!PyErr_Occurred()) {
                // QLibrary(QString,QString,QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QLibraryWrapper(cppArg0, cppArg1, cppArg2);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QLibraryWrapper(cppArg0, cppArg1, cppArg2);
                }

                Shiboken::Object::setParent(pyArgs[2], self);
            }
            break;
        }
        case 3: // QLibrary(const QString & fileName, int verNum, QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[2]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QLibrary_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[2] = value;
                        if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[2]))))
                            goto Sbk_QLibrary_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            ::QString cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            int cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);
            if (!Shiboken::Object::isValid(pyArgs[2]))
                return -1;
            ::QObject *cppArg2 = nullptr;
            if (pythonToCpp[2])
                pythonToCpp[2](pyArgs[2], &cppArg2);

            if (!PyErr_Occurred()) {
                // QLibrary(QString,int,QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QLibraryWrapper(cppArg0, cppArg1, cppArg2);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QLibraryWrapper(cppArg0, cppArg1, cppArg2);
                }

                Shiboken::Object::setParent(pyArgs[2], self);
            }
            break;
        }
    }

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

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

    // QObject setup
    PySide::Signal::updateSourceObject(self);
    metaObject = cptr->metaObject(); // <- init python qt properties
    if (!errInfo.isNull() && PyDict_Check(errInfo.object())) {
        if (!PySide::fillQtProperties(self, metaObject, errInfo))
            goto Sbk_QLibrary_Init_TypeError;
    };


    return 1;

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

static PyObject *Sbk_QLibraryFunc_errorString(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.errorString";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // errorString()const
            QString cppResult = const_cast<const ::QLibrary *>(cppSelf)->errorString();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QLibraryFunc_fileName(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.fileName";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // fileName()const
            QString cppResult = const_cast<const ::QLibrary *>(cppSelf)->fileName();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QLibraryFunc_isLibrary(PyObject *self, PyObject *pyArg)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.isLibrary";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: static QLibrary::isLibrary(QString)->bool
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArg)))) {
        overloadId = 0; // isLibrary(QString)
    }

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

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // isLibrary(QString)
            bool cppResult = ::QLibrary::isLibrary(cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QLibraryFunc_isLibrary_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QLibraryFunc_isLoaded(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.isLoaded";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // isLoaded()const
            bool cppResult = const_cast<const ::QLibrary *>(cppSelf)->isLoaded();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QLibraryFunc_load(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.load";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // load()
            bool cppResult = cppSelf->load();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QLibraryFunc_loadHints(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.loadHints";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // loadHints()const
            QFlags<QLibrary::LoadHint> cppResult = const_cast<const ::QLibrary *>(cppSelf)->loadHints();
            pyResult = Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QLibraryFunc_setFileName(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.setFileName";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QLibrary::setFileName(QString)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArg)))) {
        overloadId = 0; // setFileName(QString)
    }

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

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setFileName(QString)
            cppSelf->setFileName(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QLibraryFunc_setFileName_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QLibraryFunc_setFileNameAndVersion(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.setFileNameAndVersion";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "setFileNameAndVersion", 2, 2, &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: QLibrary::setFileNameAndVersion(QString,QString)
    // 1: QLibrary::setFileNameAndVersion(QString,int)
    if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[0])))) {
        if (numArgs == 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyArgs[1])))) {
            overloadId = 1; // setFileNameAndVersion(QString,int)
        } else if (numArgs == 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[1])))) {
            overloadId = 0; // setFileNameAndVersion(QString,QString)
        }
    }

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

    // Call function/method
    switch (overloadId) {
        case 0: // setFileNameAndVersion(const QString & fileName, const QString & version)
        {
            ::QString cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            ::QString cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // setFileNameAndVersion(QString,QString)
                cppSelf->setFileNameAndVersion(cppArg0, cppArg1);
            }
            break;
        }
        case 1: // setFileNameAndVersion(const QString & fileName, int verNum)
        {
            ::QString cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            int cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // setFileNameAndVersion(QString,int)
                cppSelf->setFileNameAndVersion(cppArg0, cppArg1);
            }
            break;
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QLibraryFunc_setFileNameAndVersion_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QLibraryFunc_setLoadHints(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.setLoadHints";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QLibrary::setLoadHints(QFlags<QLibrary::LoadHint>)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // setLoadHints(QFlags<QLibrary::LoadHint>)
    }

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

    // Call function/method
    {
        ::QFlags<QLibrary::LoadHint> cppArg0 = QFlags<QLibrary::LoadHint>(0);
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setLoadHints(QFlags<QLibrary::LoadHint>)
            cppSelf->setLoadHints(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QLibraryFunc_setLoadHints_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QLibraryFunc_unload(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtCore.QLibrary.unload";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // unload()
            bool cppResult = cppSelf->unload();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


static const char *Sbk_QLibrary_PropertyStrings[] = {
    "fileName::",
    "loadHints::",
    nullptr // Sentinel
};

static PyMethodDef Sbk_QLibrary_methods[] = {
    {"errorString", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_errorString), METH_NOARGS},
    {"fileName", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_fileName), METH_NOARGS},
    {"isLibrary", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_isLibrary), METH_O|METH_STATIC},
    {"isLoaded", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_isLoaded), METH_NOARGS},
    {"load", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_load), METH_NOARGS},
    {"loadHints", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_loadHints), METH_NOARGS},
    {"setFileName", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_setFileName), METH_O},
    {"setFileNameAndVersion", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_setFileNameAndVersion), METH_VARARGS},
    {"setLoadHints", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_setLoadHints), METH_O},
    {"unload", reinterpret_cast<PyCFunction>(Sbk_QLibraryFunc_unload), METH_NOARGS},

    {nullptr, nullptr} // Sentinel
};

static int Sbk_QLibrary_setattro(PyObject *self, PyObject *name, PyObject *value)
{
    PySide::Feature::Select(self);
    if (value && PyCallable_Check(value)) {
        auto plain_inst = reinterpret_cast< ::QLibrary *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX], reinterpret_cast<SbkObject *>(self)));
        auto inst = dynamic_cast<QLibraryWrapper *>(plain_inst);
        if (inst)
            inst->resetPyMethodCache();
    }
    Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));
    if (!pp.isNull())
        return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);
    return PyObject_GenericSetAttr(self, name, value);
}

} // extern "C"

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

static PyType_Slot Sbk_QLibrary_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,    reinterpret_cast<void *>(Sbk_QLibrary_setattro)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QLibrary_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QLibrary_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QLibrary_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QLibrary_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QLibrary_spec = {
    "2:PySide6.QtCore.QLibrary",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QLibrary_slots
};

} //extern "C"

static void *Sbk_QLibrary_typeDiscovery(void *cptr, PyTypeObject *instanceType)
{
    if (instanceType == Shiboken::SbkType< ::QObject >())
        return dynamic_cast< ::QLibrary *>(reinterpret_cast< ::QObject *>(cptr));
    return {};
}

PyObject *SbkPySide6_QtCore_QLibrary_LoadHint___and__(PyObject *self, PyObject *pyArg)
{
    ::QLibrary::LoadHints cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QLibrary::LoadHints>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QLibrary::LoadHints>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf & cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtCore_QLibrary_LoadHint___or__(PyObject *self, PyObject *pyArg)
{
    ::QLibrary::LoadHints cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QLibrary::LoadHints>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QLibrary::LoadHints>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf | cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtCore_QLibrary_LoadHint___xor__(PyObject *self, PyObject *pyArg)
{
    ::QLibrary::LoadHints cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QLibrary::LoadHints>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QLibrary::LoadHints>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf ^ cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtCore_QLibrary_LoadHint___invert__(PyObject *self, PyObject *pyArg)
{
    ::QLibrary::LoadHints cppSelf;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, self, &cppSelf);
    ::QLibrary::LoadHints cppResult = ~cppSelf;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, &cppResult);
}

static PyObject *SbkPySide6_QtCore_QLibrary_LoadHint_long(PyObject *self)
{
    int val;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, self, &val);
    return Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &val);
}
static int SbkPySide6_QtCore_QLibrary_LoadHint__nonzero(PyObject *self)
{
    int val;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))->converter, self, &val);
    return val != 0;
}

static PyType_Slot SbkPySide6_QtCore_QLibrary_LoadHint_number_slots[] = {
    {Py_nb_bool,    reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint__nonzero)},
    {Py_nb_invert,  reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint___invert__)},
    {Py_nb_and,     reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint___and__)},
    {Py_nb_xor,     reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint___xor__)},
    {Py_nb_or,      reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint___or__)},
    {Py_nb_int,     reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint_long)},
    {Py_nb_index,   reinterpret_cast<void *>(SbkPySide6_QtCore_QLibrary_LoadHint_long)},
    {0, nullptr} // sentinel
};



// Type conversion functions.

// Python to C++ enum conversion.
static void QLibrary_LoadHint_PythonToCpp_QLibrary_LoadHint(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QLibrary::LoadHint *>(cppOut) =
        static_cast<::QLibrary::LoadHint>(Shiboken::Enum::getValue(pyIn));

}
static PythonToCppFunc is_QLibrary_LoadHint_PythonToCpp_QLibrary_LoadHint_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX]))
        return QLibrary_LoadHint_PythonToCpp_QLibrary_LoadHint;
    return {};
}
static PyObject *QLibrary_LoadHint_CppToPython_QLibrary_LoadHint(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QLibrary::LoadHint *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX], castCppIn);

}

static void QFlags_QLibrary_LoadHint__PythonToCpp_QFlags_QLibrary_LoadHint_(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QFlags<QLibrary::LoadHint> *>(cppOut) =
        ::QFlags<QLibrary::LoadHint>(QFlag(int(PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject *>(pyIn)))));

}
static PythonToCppFunc is_QFlags_QLibrary_LoadHint__PythonToCpp_QFlags_QLibrary_LoadHint__Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]))
        return QFlags_QLibrary_LoadHint__PythonToCpp_QFlags_QLibrary_LoadHint_;
    return {};
}
static PyObject *QFlags_QLibrary_LoadHint__CppToPython_QFlags_QLibrary_LoadHint_(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QFlags<QLibrary::LoadHint> *>(cppIn));
    return reinterpret_cast<PyObject *>(PySide::QFlags::newObject(castCppIn, SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]));

}

static void QLibrary_LoadHint_PythonToCpp_QFlags_QLibrary_LoadHint_(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QFlags<QLibrary::LoadHint> *>(cppOut) =
        ::QFlags<QLibrary::LoadHint>(QFlag(int(Shiboken::Enum::getValue(pyIn))));

}
static PythonToCppFunc is_QLibrary_LoadHint_PythonToCpp_QFlags_QLibrary_LoadHint__Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX]))
        return QLibrary_LoadHint_PythonToCpp_QFlags_QLibrary_LoadHint_;
    return {};
}
static void number_PythonToCpp_QFlags_QLibrary_LoadHint_(PyObject *pyIn, void *cppOut)
{
    Shiboken::AutoDecRef pyLong(PyNumber_Long(pyIn));
    *reinterpret_cast<::QFlags<QLibrary::LoadHint> *>(cppOut) =
        ::QFlags<QLibrary::LoadHint>(QFlag(int(PyLong_AsLong(pyLong.object()))));

}
static PythonToCppFunc is_number_PythonToCpp_QFlags_QLibrary_LoadHint__Convertible(PyObject *pyIn)
{
    if (PyNumber_Check(pyIn) && PyObject_TypeCheck(pyIn, SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX]))
        return number_PythonToCpp_QFlags_QLibrary_LoadHint_;
    return {};
}
// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void QLibrary_PythonToCpp_QLibrary_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_QLibrary_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_QLibrary_PythonToCpp_QLibrary_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QLibrary_TypeF())))
        return QLibrary_PythonToCpp_QLibrary_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QLibrary_PTR_CppToPython_QLibrary(const void *cppIn)
{
    return PySide::getWrapperForQObject(reinterpret_cast<::QLibrary *>(const_cast<void *>(cppIn)), Sbk_QLibrary_TypeF());

}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QLibrary_SignatureStrings[] = {
    "3:PySide6.QtCore.QLibrary(self,parent:PySide6.QtCore.QObject=nullptr)",
    "2:PySide6.QtCore.QLibrary(self,fileName:QString,parent:PySide6.QtCore.QObject=nullptr)",
    "1:PySide6.QtCore.QLibrary(self,fileName:QString,version:QString,parent:PySide6.QtCore.QObject=nullptr)",
    "0:PySide6.QtCore.QLibrary(self,fileName:QString,verNum:int,parent:PySide6.QtCore.QObject=nullptr)",
    "PySide6.QtCore.QLibrary.errorString(self)->QString",
    "PySide6.QtCore.QLibrary.fileName(self)->QString",
    "PySide6.QtCore.QLibrary.isLibrary(fileName:QString)->bool",
    "PySide6.QtCore.QLibrary.isLoaded(self)->bool",
    "PySide6.QtCore.QLibrary.load(self)->bool",
    "PySide6.QtCore.QLibrary.loadHints(self)->PySide6.QtCore.QLibrary.LoadHints",
    "PySide6.QtCore.QLibrary.setFileName(self,fileName:QString)",
    "1:PySide6.QtCore.QLibrary.setFileNameAndVersion(self,fileName:QString,version:QString)",
    "0:PySide6.QtCore.QLibrary.setFileNameAndVersion(self,fileName:QString,verNum:int)",
    "PySide6.QtCore.QLibrary.setLoadHints(self,hints:PySide6.QtCore.QLibrary.LoadHints)",
    "PySide6.QtCore.QLibrary.unload(self)->bool",
    nullptr}; // Sentinel

void init_QLibrary(PyObject *module)
{
    _Sbk_QLibrary_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QLibrary",
        "QLibrary*",
        &Sbk_QLibrary_spec,
        &Shiboken::callCppDestructor< ::QLibrary >,
        SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX],
        0,
        0);
    auto *pyType = Sbk_QLibrary_TypeF(); // references _Sbk_QLibrary_Type
    InitSignatureStrings(pyType, QLibrary_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QLibrary_Type), Sbk_QLibrary_PropertyStrings);
    SbkPySide6_QtCoreTypes[SBK_QLIBRARY_IDX]
        = Sbk_QLibrary_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QLibrary_TypeF(),
        QLibrary_PythonToCpp_QLibrary_PTR,
        is_QLibrary_PythonToCpp_QLibrary_PTR_Convertible,
        QLibrary_PTR_CppToPython_QLibrary);

    Shiboken::Conversions::registerConverterName(converter, "QLibrary");
    Shiboken::Conversions::registerConverterName(converter, "QLibrary*");
    Shiboken::Conversions::registerConverterName(converter, "QLibrary&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::QLibrary).name());
    Shiboken::Conversions::registerConverterName(converter, typeid(::QLibraryWrapper).name());


    Shiboken::ObjectType::setTypeDiscoveryFunctionV2(Sbk_QLibrary_TypeF(), &Sbk_QLibrary_typeDiscovery);

    // Initialization of enums.

    // Initialization of enum 'LoadHint'.
    SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX] = PySide::QFlags::create("2:PySide6.QtCore.QLibrary.LoadHints", SbkPySide6_QtCore_QLibrary_LoadHint_number_slots);
    SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QLibrary_TypeF(),
        "LoadHint",
        "2:PySide6.QtCore.QLibrary.LoadHint",
        "QLibrary::LoadHint",
        SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX]);
    if (!SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
        Sbk_QLibrary_TypeF(), "ResolveAllSymbolsHint", (long) QLibrary::LoadHint::ResolveAllSymbolsHint))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
        Sbk_QLibrary_TypeF(), "ExportExternalSymbolsHint", (long) QLibrary::LoadHint::ExportExternalSymbolsHint))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
        Sbk_QLibrary_TypeF(), "LoadArchiveMemberHint", (long) QLibrary::LoadHint::LoadArchiveMemberHint))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
        Sbk_QLibrary_TypeF(), "PreventUnloadHint", (long) QLibrary::LoadHint::PreventUnloadHint))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
        Sbk_QLibrary_TypeF(), "DeepBindHint", (long) QLibrary::LoadHint::DeepBindHint))
        return;
    // Register converter for enum 'QLibrary::LoadHint'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX],
            QLibrary_LoadHint_CppToPython_QLibrary_LoadHint);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QLibrary_LoadHint_PythonToCpp_QLibrary_LoadHint,
            is_QLibrary_LoadHint_PythonToCpp_QLibrary_LoadHint_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtCoreTypes[SBK_QLIBRARY_LOADHINT_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QLibrary::LoadHint");
        Shiboken::Conversions::registerConverterName(converter, "LoadHint");
    }
    // Register converter for flag 'QFlags<QLibrary::LoadHint>'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX],
            QFlags_QLibrary_LoadHint__CppToPython_QFlags_QLibrary_LoadHint_);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QLibrary_LoadHint_PythonToCpp_QFlags_QLibrary_LoadHint_,
            is_QLibrary_LoadHint_PythonToCpp_QFlags_QLibrary_LoadHint__Convertible);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QFlags_QLibrary_LoadHint__PythonToCpp_QFlags_QLibrary_LoadHint_,
            is_QFlags_QLibrary_LoadHint__PythonToCpp_QFlags_QLibrary_LoadHint__Convertible);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            number_PythonToCpp_QFlags_QLibrary_LoadHint_,
            is_number_PythonToCpp_QFlags_QLibrary_LoadHint__Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QLIBRARY_LOADHINT_IDX], converter, true);
        Shiboken::Conversions::registerConverterName(converter, "QLibrary::LoadHints");
        Shiboken::Conversions::registerConverterName(converter, "LoadHints");
        Shiboken::Conversions::registerConverterName(converter, "QFlags<QLibrary::LoadHint>");
    }
    // End of 'LoadHint' enum/flags.

    PySide::Signal::registerSignals(Sbk_QLibrary_TypeF(), &::QLibrary::staticMetaObject);
    qRegisterMetaType< ::QLibrary::LoadHint >("QLibrary::LoadHint");
    qRegisterMetaType< ::QLibrary::LoadHints >("QLibrary::LoadHints");
    Shiboken::ObjectType::setSubTypeInitHook(Sbk_QLibrary_TypeF(), &PySide::initQObjectSubType);
    PySide::initDynamicMetaObject(Sbk_QLibrary_TypeF(), &::QLibrary::staticMetaObject, sizeof(QLibraryWrapper));
}
