/*
 * Module code.
 *
 * Generated by SIP 6.6.2
 *
 * Copyright (c) 2022 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQt5.
 * 
 * This file may be used under the terms of the GNU General Public License
 * version 3.0 as published by the Free Software Foundation and appearing in
 * the file LICENSE included in the packaging of this file.  Please review the
 * following information to ensure the GNU General Public License version 3.0
 * requirements will be met: http://www.gnu.org/copyleft/gpl.html.
 * 
 * If you do not wish to use this file under the terms of the GPL version 3.0
 * then you may purchase a commercial license.  For more information contact
 * info@riverbankcomputing.com.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtWebChannel.h"

#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qobject.sip"
#include <qobject.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 26 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qmetaobject.sip"
#include <qmetaobject.h>
#line 32 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 26 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcoreevent.sip"
#include <qcoreevent.h>
#line 35 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 247 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcoreevent.sip"
#include <qcoreevent.h>
#line 38 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 235 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qcoreevent.sip"
#include <qcoreevent.h>
#line 41 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 25 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qjsonobject.sip"
#include <qjsonobject.h>
#line 44 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"
#line 28 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtWebChannel/qwebchannel.sip"
#include <qwebchannel.h>
#line 47 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"

/* Define the strings used by this module. */
const char sipStrings_QtWebChannel[] = {
    'Q', 'W', 'e', 'b', 'C', 'h', 'a', 'n', 'n', 'e', 'l', 'A', 'b', 's', 't', 'r', 'a', 'c', 't', 'T', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', 0,
    'Q', 'H', 'a', 's', 'h', '<', 'Q', 'S', 't', 'r', 'i', 'n', 'g', ',', 'Q', 'O', 'b', 'j', 'e', 'c', 't', '*', '>', 0,
    'b', 'l', 'o', 'c', 'k', 'U', 'p', 'd', 'a', 't', 'e', 's', 'C', 'h', 'a', 'n', 'g', 'e', 'd', 0,
    'P', 'y', 'Q', 't', '5', '.', 'Q', 't', 'W', 'e', 'b', 'C', 'h', 'a', 'n', 'n', 'e', 'l', 0,
    'r', 'e', 'g', 'i', 's', 't', 'e', 'r', 'e', 'd', 'O', 'b', 'j', 'e', 'c', 't', 's', 0,
    'd', 'e', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', 'O', 'b', 'j', 'e', 'c', 't', 0,
    'd', 'i', 's', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'N', 'o', 't', 'i', 'f', 'y', 0,
    'm', 'e', 's', 's', 'a', 'g', 'e', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'd', 0,
    'r', 'e', 'g', 'i', 's', 't', 'e', 'r', 'O', 'b', 'j', 'e', 'c', 't', 's', 0,
    's', 'e', 't', 'B', 'l', 'o', 'c', 'k', 'U', 'p', 'd', 'a', 't', 'e', 's', 0,
    'd', 'i', 's', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'F', 'r', 'o', 'm', 0,
    'b', 'l', 'o', 'c', 'k', 'U', 'p', 'd', 'a', 't', 'e', 's', 0,
    'Q', 'W', 'e', 'b', 'C', 'h', 'a', 'n', 'n', 'e', 'l', 0,
    'c', 'u', 's', 't', 'o', 'm', 'E', 'v', 'e', 'n', 't', 0,
    'e', 'v', 'e', 'n', 't', 'F', 'i', 'l', 't', 'e', 'r', 0,
    's', 'e', 'n', 'd', 'M', 'e', 's', 's', 'a', 'g', 'e', 0,
    'c', 'h', 'i', 'l', 'd', 'E', 'v', 'e', 'n', 't', 0,
    't', 'i', 'm', 'e', 'r', 'E', 'v', 'e', 'n', 't', 0,
    'c', 'o', 'n', 'n', 'e', 'c', 't', 'T', 'o', 0,
    'p', 'a', 'r', 'e', 'n', 't', 0,
    'e', 'v', 'e', 'n', 't', 0,
};

void sipVH_QtWebChannel_6(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod, const  ::QJsonObject& a0)
{
    sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, "N", new  ::QJsonObject(a0), sipType_QJsonObject, SIP_NULLPTR);
}

bool sipVH_QtWebChannel_5(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,  ::QEvent*a0)
{
    bool sipRes = 0;
    PyObject *sipResObj = sipCallMethod(SIP_NULLPTR, sipMethod, "D", a0, sipType_QEvent, SIP_NULLPTR);

    sipParseResultEx(sipGILState, sipErrorHandler, sipPySelf, sipMethod, sipResObj, "b", &sipRes);

    return sipRes;
}

bool sipVH_QtWebChannel_4(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,  ::QObject*a0, ::QEvent*a1)
{
    bool sipRes = 0;
    PyObject *sipResObj = sipCallMethod(SIP_NULLPTR, sipMethod, "DD", a0, sipType_QObject, SIP_NULLPTR, a1, sipType_QEvent, SIP_NULLPTR);

    sipParseResultEx(sipGILState, sipErrorHandler, sipPySelf, sipMethod, sipResObj, "b", &sipRes);

    return sipRes;
}

void sipVH_QtWebChannel_3(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,  ::QTimerEvent*a0)
{
    sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, "D", a0, sipType_QTimerEvent, SIP_NULLPTR);
}

void sipVH_QtWebChannel_2(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,  ::QChildEvent*a0)
{
    sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, "D", a0, sipType_QChildEvent, SIP_NULLPTR);
}

void sipVH_QtWebChannel_1(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,  ::QEvent*a0)
{
    sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, "D", a0, sipType_QEvent, SIP_NULLPTR);
}

void sipVH_QtWebChannel_0(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod, const  ::QMetaMethod& a0)
{
    sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, "N", new  ::QMetaMethod(a0), sipType_QMetaMethod, SIP_NULLPTR);
}


/* Convert to a sub-class if possible. */
extern "C" {static const sipTypeDef *sipSubClass_QWebChannel(void **);}
static const sipTypeDef *sipSubClass_QWebChannel(void **sipCppRet)
{
     ::QObject *sipCpp = reinterpret_cast< ::QObject *>(*sipCppRet);
    const sipTypeDef *sipType;

#line 32 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtWebChannel/qwebchannel.sip"
    static struct class_graph {
        const char *name;
        sipTypeDef **type;
        int yes, no;
    } graph[] = {
        {sipName_QWebChannelAbstractTransport, &sipType_QWebChannelAbstractTransport, -1, 1},
        {sipName_QWebChannel, &sipType_QWebChannel, -1, -1},
    };
    
    int i = 0;
    
    sipType = NULL;
    
    do
    {
        struct class_graph *cg = &graph[i];
    
        if (cg->name != NULL && sipCpp->inherits(cg->name))
        {
            sipType = *cg->type;
            i = cg->yes;
        }
        else
            i = cg->no;
    }
    while (i >= 0);
#line 154 "/build/pyqt5/src/PyQt5-5.15.7/build/QtWebChannel/sipQtWebChannelcmodule.cpp"

    return sipType;
}


/*
 * This defines each type in this module.
 */
sipTypeDef *sipExportedTypes_QtWebChannel[] = {
    &sipTypeDef_QtWebChannel_QHash_0100QString_0101QObject.mtd_base,
    &sipTypeDef_QtWebChannel_QWebChannel.ctd_base,
    &sipTypeDef_QtWebChannel_QWebChannelAbstractTransport.ctd_base,
};


/* This defines the types that this module needs to import from QtCore. */
sipImportedTypeDef sipImportedTypes_QtWebChannel_QtCore[] = {
    {"QChildEvent"},
    {"QEvent"},
    {"QJsonObject"},
    {"QMetaMethod"},
    {"QObject"},
    {"QString"},
    {"QTimerEvent"},
    {SIP_NULLPTR}
};


/*
 * This defines the virtual error handlers that this module needs to import
 * from QtCore.
 */
sipImportedVirtErrorHandlerDef sipImportedVirtErrorHandlers_QtWebChannel_QtCore[] = {
    {"PyQt5"},
    {SIP_NULLPTR}
};


/* This defines the modules that this module needs to import. */
static sipImportedModuleDef importsTable[] = {
    {"PyQt5.QtCore", sipImportedTypes_QtWebChannel_QtCore, sipImportedVirtErrorHandlers_QtWebChannel_QtCore, SIP_NULLPTR},
    {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR}
};


/* This defines the class sub-convertors that this module defines. */
static sipSubClassConvertorDef convertorsTable[] = {
    {sipSubClass_QWebChannel, {4, 0, 0}, SIP_NULLPTR},
    {SIP_NULLPTR, {0, 0, 0}, SIP_NULLPTR}
};


/* This defines this module. */
sipExportedModuleDef sipModuleAPI_QtWebChannel = {
    SIP_NULLPTR,
    11,
    sipNameNr_PyQt5_QtWebChannel,
    0,
    sipStrings_QtWebChannel,
    importsTable,
    SIP_NULLPTR,
    3,
    sipExportedTypes_QtWebChannel,
    SIP_NULLPTR,
    0,
    SIP_NULLPTR,
    0,
    SIP_NULLPTR,
    SIP_NULLPTR,
    convertorsTable,
    {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};


/* The SIP API and the APIs of any imported modules. */
const sipAPIDef *sipAPI_QtWebChannel;

sip_qt_metaobject_func sip_QtWebChannel_qt_metaobject;
sip_qt_metacall_func sip_QtWebChannel_qt_metacall;
sip_qt_metacast_func sip_QtWebChannel_qt_metacast;


/* The Python module initialisation function. */
#if defined(SIP_STATIC_MODULE)
extern "C" PyObject *PyInit_QtWebChannel()
#else
PyMODINIT_FUNC PyInit_QtWebChannel()
#endif
{
    static PyMethodDef sip_methods[] = {
        {SIP_NULLPTR, SIP_NULLPTR, 0, SIP_NULLPTR}
    };

    static PyModuleDef sip_module_def = {
        PyModuleDef_HEAD_INIT,
        "PyQt5.QtWebChannel",
        SIP_NULLPTR,
        -1,
        sip_methods,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_NULLPTR
    };

    PyObject *sipModule, *sipModuleDict;
    PyObject *sip_sipmod, *sip_capiobj;

    /* Initialise the module and get it's dictionary. */
    if ((sipModule = PyModule_Create(&sip_module_def)) == SIP_NULLPTR)
        return SIP_NULLPTR;

    sipModuleDict = PyModule_GetDict(sipModule);

    /* Get the SIP module's API. */
    if ((sip_sipmod = PyImport_ImportModule("PyQt5.sip")) == SIP_NULLPTR)
    {
        Py_DECREF(sipModule);
        return SIP_NULLPTR;
    }

    sip_capiobj = PyDict_GetItemString(PyModule_GetDict(sip_sipmod), "_C_API");
    Py_DECREF(sip_sipmod);

    if (sip_capiobj == SIP_NULLPTR || !PyCapsule_CheckExact(sip_capiobj))
    {
        PyErr_SetString(PyExc_AttributeError, "PyQt5.sip._C_API is missing or has the wrong type");
        Py_DECREF(sipModule);
        return SIP_NULLPTR;
    }

    sipAPI_QtWebChannel = reinterpret_cast<const sipAPIDef *>(PyCapsule_GetPointer(sip_capiobj, "PyQt5.sip._C_API"));

    if (sipAPI_QtWebChannel == SIP_NULLPTR)
    {
        Py_DECREF(sipModule);
        return SIP_NULLPTR;
    }

    /* Export the module and publish it's API. */
    if (sipExportModule(&sipModuleAPI_QtWebChannel, 12, 11, 0) < 0)
    {
        Py_DECREF(sipModule);
        return SIP_NULLPTR;
    }

    sip_QtWebChannel_qt_metaobject = (sip_qt_metaobject_func)sipImportSymbol("qtcore_qt_metaobject");
    sip_QtWebChannel_qt_metacall = (sip_qt_metacall_func)sipImportSymbol("qtcore_qt_metacall");
    sip_QtWebChannel_qt_metacast = (sip_qt_metacast_func)sipImportSymbol("qtcore_qt_metacast");

    if (!sip_QtWebChannel_qt_metacast)
        Py_FatalError("Unable to import qtcore_qt_metacast");

    /* Initialise the module now all its dependencies have been set up. */
    if (sipInitModule(&sipModuleAPI_QtWebChannel,sipModuleDict) < 0)
    {
        Py_DECREF(sipModule);
        return SIP_NULLPTR;
    }

    return sipModule;
}
