/****************************************************************************
**
** 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_qtpositioning_python.h"

// main header
#include "qgeoshape_wrapper.h"

// inner classes

// Extra includes
#include <QtPositioning/qgeocoordinate.h>
#include <QtPositioning/qgeorectangle.h>
#include <QtPositioning/qgeoshape.h>
#include <qdatastream.h>
#include <qobject.h>


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


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

extern "C" {
static int
Sbk_QGeoShape_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< ::QGeoShape >()))
        return -1;

    ::QGeoShape *cptr{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.__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, "QGeoShape", 0, 1, &(pyArgs[0])))
        return -1;


    // Overloaded function decisor
    // 0: QGeoShape::QGeoShape()
    // 1: QGeoShape::QGeoShape(QGeoShape)
    if (numArgs == 0) {
        overloadId = 0; // QGeoShape()
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], (pyArgs[0])))) {
        overloadId = 1; // QGeoShape(QGeoShape)
    }

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

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

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


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

    if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::QGeoShape >(), cptr)) {
        delete cptr;
        return -1;
    }
    if (!cptr) goto Sbk_QGeoShape_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_QGeoShape_Init_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return -1;
}

static PyObject *Sbk_QGeoShapeFunc_boundingGeoRectangle(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.boundingGeoRectangle";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // boundingGeoRectangle()const
            QGeoRectangle cppResult = const_cast<const ::QGeoShape *>(cppSelf)->boundingGeoRectangle();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtPositioningTypes[SBK_QGEORECTANGLE_IDX], &cppResult);
        }
    }

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

static PyObject *Sbk_QGeoShapeFunc_center(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.center";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // center()const
            QGeoCoordinate cppResult = const_cast<const ::QGeoShape *>(cppSelf)->center();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtPositioningTypes[SBK_QGEOCOORDINATE_IDX], &cppResult);
        }
    }

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

static PyObject *Sbk_QGeoShapeFunc_contains(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.contains";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QGeoShape::contains(QGeoCoordinate)const->bool
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtPositioningTypes[SBK_QGEOCOORDINATE_IDX], (pyArg)))) {
        overloadId = 0; // contains(QGeoCoordinate)const
    }

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

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArg))
            return {};
        ::QGeoCoordinate cppArg0_local;
        ::QGeoCoordinate *cppArg0 = &cppArg0_local;
        if (pythonToCpp.isValue())
            pythonToCpp(pyArg, &cppArg0_local);
        else
            pythonToCpp(pyArg, &cppArg0);


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

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

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

static PyObject *Sbk_QGeoShapeFunc_isEmpty(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.isEmpty";
    SBK_UNUSED(fullName)

    // Call function/method
    {

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

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

static PyObject *Sbk_QGeoShapeFunc_isValid(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.isValid";
    SBK_UNUSED(fullName)

    // Call function/method
    {

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

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

static PyObject *Sbk_QGeoShapeFunc_toString(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.toString";
    SBK_UNUSED(fullName)

    // Call function/method
    {

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

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

static PyObject *Sbk_QGeoShapeFunc_type(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.type";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // type()const
            QGeoShape::ShapeType cppResult = const_cast<const ::QGeoShape *>(cppSelf)->type();
            pyResult = Shiboken::Conversions::copyToPython(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX]))->converter, &cppResult);
        }
    }

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

static PyObject *Sbk_QGeoShape___copy__(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto &cppSelf = *reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], &cppSelf);
    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


static const char *Sbk_QGeoShape_PropertyStrings[] = {
    "center:",
    "isEmpty:",
    "isValid:",
    "type:",
    nullptr // Sentinel
};

static PyMethodDef Sbk_QGeoShape_methods[] = {
    {"boundingGeoRectangle", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_boundingGeoRectangle), METH_NOARGS},
    {"center", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_center), METH_NOARGS},
    {"contains", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_contains), METH_O},
    {"isEmpty", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_isEmpty), METH_NOARGS},
    {"isValid", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_isValid), METH_NOARGS},
    {"toString", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_toString), METH_NOARGS},
    {"type", reinterpret_cast<PyCFunction>(Sbk_QGeoShapeFunc_type), METH_NOARGS},

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

static PyObject *Sbk_QGeoShapeFunc___lshift__(PyObject *self, PyObject *pyArg)
{
    bool isReverse = SbkObject_TypeCheck(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], pyArg)
                    && !SbkObject_TypeCheck(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], self);
    if (isReverse)
        std::swap(self, pyArg);
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.__lshift__";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    Shiboken::AutoDecRef attrName(Py_BuildValue("s", "__rlshift__"));
    if (!isReverse
        && Shiboken::Object::checkType(pyArg)
        && !PyObject_TypeCheck(pyArg, self->ob_type)
        && PyObject_HasAttr(pyArg, attrName)) {
        PyObject *revOpMethod = PyObject_GetAttr(pyArg, attrName);
        if (revOpMethod && PyCallable_Check(revOpMethod)) {
            pyResult = PyObject_CallFunction(revOpMethod, "O", self);
            if (PyErr_Occurred() && (PyErr_ExceptionMatches(PyExc_NotImplementedError) || PyErr_ExceptionMatches(PyExc_AttributeError))) {
                PyErr_Clear();
                Py_XDECREF(pyResult);
                pyResult = nullptr;
            }
        }
        Py_XDECREF(revOpMethod);

    }

    // Do not enter here if other object has implemented a reverse operator.
    if (!pyResult) {
        // Overloaded function decisor
        // 0: QGeoShape::operator<<(QDataStream&)->QDataStream&
        if (isReverse
            && (pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtCoreTypes[SBK_QDATASTREAM_IDX], (pyArg)))) {
            overloadId = 0; // operator<<(QDataStream&,QGeoShape)
        }

        if (isReverse && overloadId == -1) {
            PyErr_SetString(PyExc_NotImplementedError, "reverse operator not implemented.");
            return {};
        }

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

        // Call function/method
        {
            if (!Shiboken::Object::isValid(pyArg))
                return {};
            ::QDataStream *cppArg0;
            pythonToCpp(pyArg, &cppArg0);

            if (!PyErr_Occurred()) {
                // operator<<(QDataStream&,QGeoShape) [reverse operator]
                QDataStream & cppResult = (*cppArg0) << (*cppSelf);
                pyResult = Shiboken::Conversions::referenceToPython(SbkPySide6_QtCoreTypes[SBK_QDATASTREAM_IDX], &cppResult);
            }
        }

    } // End of "if (!pyResult)"

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

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

static PyObject *Sbk_QGeoShapeFunc___rshift__(PyObject *self, PyObject *pyArg)
{
    bool isReverse = SbkObject_TypeCheck(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], pyArg)
                    && !SbkObject_TypeCheck(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], self);
    if (isReverse)
        std::swap(self, pyArg);
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtPositioning.QGeoShape.__rshift__";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    Shiboken::AutoDecRef attrName(Py_BuildValue("s", "__rrshift__"));
    if (!isReverse
        && Shiboken::Object::checkType(pyArg)
        && !PyObject_TypeCheck(pyArg, self->ob_type)
        && PyObject_HasAttr(pyArg, attrName)) {
        PyObject *revOpMethod = PyObject_GetAttr(pyArg, attrName);
        if (revOpMethod && PyCallable_Check(revOpMethod)) {
            pyResult = PyObject_CallFunction(revOpMethod, "O", self);
            if (PyErr_Occurred() && (PyErr_ExceptionMatches(PyExc_NotImplementedError) || PyErr_ExceptionMatches(PyExc_AttributeError))) {
                PyErr_Clear();
                Py_XDECREF(pyResult);
                pyResult = nullptr;
            }
        }
        Py_XDECREF(revOpMethod);

    }

    // Do not enter here if other object has implemented a reverse operator.
    if (!pyResult) {
        // Overloaded function decisor
        // 0: QGeoShape::operator>>(QDataStream&)->QDataStream&
        if (isReverse
            && (pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtCoreTypes[SBK_QDATASTREAM_IDX], (pyArg)))) {
            overloadId = 0; // operator>>(QDataStream&,QGeoShape&)
        }

        if (isReverse && overloadId == -1) {
            PyErr_SetString(PyExc_NotImplementedError, "reverse operator not implemented.");
            return {};
        }

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

        // Call function/method
        {
            if (!Shiboken::Object::isValid(pyArg))
                return {};
            ::QDataStream *cppArg0;
            pythonToCpp(pyArg, &cppArg0);

            if (!PyErr_Occurred()) {
                // operator>>(QDataStream&,QGeoShape&) [reverse operator]
                QDataStream & cppResult = (*cppArg0) >> (*cppSelf);
                pyResult = Shiboken::Conversions::referenceToPython(SbkPySide6_QtCoreTypes[SBK_QDATASTREAM_IDX], &cppResult);
            }
        }

    } // End of "if (!pyResult)"

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

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

// Rich comparison
static PyObject * Sbk_QGeoShape_richcompare(PyObject *self, PyObject *pyArg, int op)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto &cppSelf = *reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    switch (op) {
        case Py_NE:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], (pyArg)))) {
                // operator!=(const QGeoShape & rhs)
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::QGeoShape cppArg0_local;
                ::QGeoShape *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf !=(*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                pyResult = Py_True;
                Py_INCREF(pyResult);
            }

            break;
        case Py_EQ:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], (pyArg)))) {
                // operator==(const QGeoShape & rhs)
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::QGeoShape cppArg0_local;
                ::QGeoShape *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf ==(*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                pyResult = Py_False;
                Py_INCREF(pyResult);
            }

            break;
        default:
            // PYSIDE-74: By default, we redirect to object's tp_richcompare (which is `==`, `!=`).
            return FallbackRichCompare(self, pyArg, op);
            goto Sbk_QGeoShape_RichComparison_TypeError;
    }

    if (pyResult && !PyErr_Occurred())
        return pyResult;
    Sbk_QGeoShape_RichComparison_TypeError:
    PyErr_SetString(PyExc_NotImplementedError, "operator not implemented.");
    return {};

}

} // extern "C"

static int Sbk_QGeoShape_traverse(PyObject *self, visitproc visit, void *arg)
{
    return SbkObject_TypeF()->tp_traverse(self, visit, arg);
}
static int Sbk_QGeoShape_clear(PyObject *self)
{
    return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);
}
extern "C"
{
static PyObject *Sbk_QGeoShape__repr__(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    QBuffer buffer;
    buffer.open(QBuffer::ReadWrite);
    QDebug dbg(&buffer);
    dbg << *cppSelf;
    buffer.close();
    QByteArray str = buffer.data();
    int idx = str.indexOf('(');
    if (idx >= 0)
        str.replace(0, idx, Py_TYPE(self)->tp_name);
    str = str.trimmed();
    PyObject *mod = PyDict_GetItem(Py_TYPE(self)->tp_dict, Shiboken::PyMagicName::module());
    if (mod && !strchr(str, '.'))
        return Shiboken::String::fromFormat("<%s.%s at %p>", Shiboken::String::toCString(mod), str.constData(), self);
    else
        return Shiboken::String::fromFormat("<%s at %p>", str.constData(), self);
}
} // extern C

// Class Definition -----------------------------------------------
extern "C" {
static PyTypeObject *_Sbk_QGeoShape_Type = nullptr;
static PyTypeObject *Sbk_QGeoShape_TypeF(void)
{
    return _Sbk_QGeoShape_Type;
}

static PyType_Slot Sbk_QGeoShape_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_repr,        reinterpret_cast<void *>(Sbk_QGeoShape__repr__)},
    {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_QGeoShape_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QGeoShape_clear)},
    {Py_tp_richcompare, reinterpret_cast<void *>(Sbk_QGeoShape_richcompare)},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QGeoShape_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QGeoShape_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    // type supports number protocol
    {Py_nb_lshift, reinterpret_cast<void *>(Sbk_QGeoShapeFunc___lshift__)},
    {Py_nb_rshift, reinterpret_cast<void *>(Sbk_QGeoShapeFunc___rshift__)},
    {0, nullptr}
};
static PyType_Spec Sbk_QGeoShape_spec = {
    "2:PySide6.QtPositioning.QGeoShape",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QGeoShape_slots
};

} //extern "C"


// Type conversion functions.

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

}
static PythonToCppFunc is_QGeoShape_ShapeType_PythonToCpp_QGeoShape_ShapeType_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX]))
        return QGeoShape_ShapeType_PythonToCpp_QGeoShape_ShapeType;
    return {};
}
static PyObject *QGeoShape_ShapeType_CppToPython_QGeoShape_ShapeType(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QGeoShape::ShapeType *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX], castCppIn);

}

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

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QGeoShape_PTR_CppToPython_QGeoShape(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 ::QGeoShape *>(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_QGeoShape_TypeF(), const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);
    if (changedTypeName)
        delete [] typeName;
    return result;
}

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

// Python to C++ copy conversion.
static void QGeoShape_PythonToCpp_QGeoShape_COPY(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QGeoShape *>(cppOut) = *reinterpret_cast< ::QGeoShape *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX], reinterpret_cast<SbkObject *>(pyIn)));
}
static PythonToCppFunc is_QGeoShape_PythonToCpp_QGeoShape_COPY_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QGeoShape_TypeF())))
        return QGeoShape_PythonToCpp_QGeoShape_COPY;
    return {};
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QGeoShape_SignatureStrings[] = {
    "1:PySide6.QtPositioning.QGeoShape(self)",
    "0:PySide6.QtPositioning.QGeoShape(self,other:PySide6.QtPositioning.QGeoShape)",
    "PySide6.QtPositioning.QGeoShape.boundingGeoRectangle(self)->PySide6.QtPositioning.QGeoRectangle",
    "PySide6.QtPositioning.QGeoShape.center(self)->PySide6.QtPositioning.QGeoCoordinate",
    "PySide6.QtPositioning.QGeoShape.contains(self,coordinate:PySide6.QtPositioning.QGeoCoordinate)->bool",
    "PySide6.QtPositioning.QGeoShape.isEmpty(self)->bool",
    "PySide6.QtPositioning.QGeoShape.isValid(self)->bool",
    "PySide6.QtPositioning.QGeoShape.toString(self)->QString",
    "PySide6.QtPositioning.QGeoShape.type(self)->PySide6.QtPositioning.QGeoShape.ShapeType",
    "PySide6.QtPositioning.QGeoShape.__copy__()",
    "PySide6.QtPositioning.QGeoShape.__lshift__(self,stream:PySide6.QtCore.QDataStream)->PySide6.QtCore.QDataStream",
    "PySide6.QtPositioning.QGeoShape.__rshift__(self,stream:PySide6.QtCore.QDataStream)->PySide6.QtCore.QDataStream",
    nullptr}; // Sentinel

void init_QGeoShape(PyObject *module)
{
    _Sbk_QGeoShape_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QGeoShape",
        "QGeoShape",
        &Sbk_QGeoShape_spec,
        &Shiboken::callCppDestructor< ::QGeoShape >,
        0,
        0,
        0);
    auto *pyType = Sbk_QGeoShape_TypeF(); // references _Sbk_QGeoShape_Type
    InitSignatureStrings(pyType, QGeoShape_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QGeoShape_Type), Sbk_QGeoShape_PropertyStrings);
    SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_IDX]
        = Sbk_QGeoShape_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QGeoShape_TypeF(),
        QGeoShape_PythonToCpp_QGeoShape_PTR,
        is_QGeoShape_PythonToCpp_QGeoShape_PTR_Convertible,
        QGeoShape_PTR_CppToPython_QGeoShape,
        QGeoShape_COPY_CppToPython_QGeoShape);

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

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

    // Initialization of enums.

    // Initialization of enum 'ShapeType'.
    SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QGeoShape_TypeF(),
        "ShapeType",
        "2:PySide6.QtPositioning.QGeoShape.ShapeType",
        "QGeoShape::ShapeType");
    if (!SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
        Sbk_QGeoShape_TypeF(), "UnknownType", (long) QGeoShape::ShapeType::UnknownType))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
        Sbk_QGeoShape_TypeF(), "RectangleType", (long) QGeoShape::ShapeType::RectangleType))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
        Sbk_QGeoShape_TypeF(), "CircleType", (long) QGeoShape::ShapeType::CircleType))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
        Sbk_QGeoShape_TypeF(), "PathType", (long) QGeoShape::ShapeType::PathType))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
        Sbk_QGeoShape_TypeF(), "PolygonType", (long) QGeoShape::ShapeType::PolygonType))
        return;
    // Register converter for enum 'QGeoShape::ShapeType'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX],
            QGeoShape_ShapeType_CppToPython_QGeoShape_ShapeType);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QGeoShape_ShapeType_PythonToCpp_QGeoShape_ShapeType,
            is_QGeoShape_ShapeType_PythonToCpp_QGeoShape_ShapeType_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtPositioningTypes[SBK_QGEOSHAPE_SHAPETYPE_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QGeoShape::ShapeType");
        Shiboken::Conversions::registerConverterName(converter, "ShapeType");
    }
    // End of 'ShapeType' enum.

    qRegisterMetaType< ::QGeoShape >("QGeoShape");
    qRegisterMetaType< ::QGeoShape::ShapeType >("QGeoShape::ShapeType");
}
