/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.15.1
 *
 *     Copyright: (c) 2020 by Total Control Software
 *     License:   wxWindows License
 */

#include "sipAPI_html2.h"
        #include <wx/webviewarchivehandler.h>
        #include <wx/filesys.h>


class sipwxWebViewArchiveHandler : public ::wxWebViewArchiveHandler
{
public:
    sipwxWebViewArchiveHandler(const ::wxString&);
    sipwxWebViewArchiveHandler(const ::wxWebViewArchiveHandler&);
    virtual ~sipwxWebViewArchiveHandler();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    ::wxFSFile* GetFile(const ::wxString&) SIP_OVERRIDE;
    ::wxString GetName() const SIP_OVERRIDE;
    void SetSecurityURL(const ::wxString&) SIP_OVERRIDE;
    ::wxString GetSecurityURL() const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipwxWebViewArchiveHandler(const sipwxWebViewArchiveHandler &);
    sipwxWebViewArchiveHandler &operator = (const sipwxWebViewArchiveHandler &);

    char sipPyMethods[4];
};

sipwxWebViewArchiveHandler::sipwxWebViewArchiveHandler(const ::wxString& scheme): ::wxWebViewArchiveHandler(scheme), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxWebViewArchiveHandler::sipwxWebViewArchiveHandler(const ::wxWebViewArchiveHandler& a0): ::wxWebViewArchiveHandler(a0), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxWebViewArchiveHandler::~sipwxWebViewArchiveHandler()
{
    sipInstanceDestroyedEx(&sipPySelf);
}

::wxFSFile* sipwxWebViewArchiveHandler::GetFile(const ::wxString& uri)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, SIP_NULLPTR, sipName_GetFile);

    if (!sipMeth)
        return ::wxWebViewArchiveHandler::GetFile(uri);

    extern ::wxFSFile* sipVH__html2_0(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxString&);

    return sipVH__html2_0(sipGILState, 0, sipPySelf, sipMeth, uri);
}

::wxString sipwxWebViewArchiveHandler::GetName() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[1]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_GetName);

    if (!sipMeth)
        return ::wxWebViewArchiveHandler::GetName();

    extern ::wxString sipVH__html2_1(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH__html2_1(sipGILState, 0, sipPySelf, sipMeth);
}

void sipwxWebViewArchiveHandler::SetSecurityURL(const ::wxString& url)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[2], &sipPySelf, SIP_NULLPTR, sipName_SetSecurityURL);

    if (!sipMeth)
    {
        ::wxWebViewArchiveHandler::SetSecurityURL(url);
        return;
    }

    extern void sipVH__html2_2(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxString&);

    sipVH__html2_2(sipGILState, 0, sipPySelf, sipMeth, url);
}

::wxString sipwxWebViewArchiveHandler::GetSecurityURL() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[3]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_GetSecurityURL);

    if (!sipMeth)
        return ::wxWebViewArchiveHandler::GetSecurityURL();

    extern ::wxString sipVH__html2_1(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH__html2_1(sipGILState, 0, sipPySelf, sipMeth);
}


PyDoc_STRVAR(doc_wxWebViewArchiveHandler_GetFile, "GetFile(uri) -> wx.FSFile");

extern "C" {static PyObject *meth_wxWebViewArchiveHandler_GetFile(PyObject *, PyObject *, PyObject *);}
static PyObject *meth_wxWebViewArchiveHandler_GetFile(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const ::wxString* uri;
        int uriState = 0;
        ::wxWebViewArchiveHandler *sipCpp;

        static const char *sipKwdList[] = {
            sipName_uri,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxWebViewArchiveHandler, &sipCpp, sipType_wxString, &uri, &uriState))
        {
            ::wxFSFile*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxWebViewArchiveHandler::GetFile(*uri) : sipCpp->GetFile(*uri));
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(uri), sipType_wxString, uriState);

            if (PyErr_Occurred())
                return 0;

            return sipConvertFromNewType(sipRes, sipType_wxFSFile, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_WebViewArchiveHandler, sipName_GetFile, SIP_NULLPTR);

    return SIP_NULLPTR;
}


/* Cast a pointer to a type somewhere in its inheritance hierarchy. */
extern "C" {static void *cast_wxWebViewArchiveHandler(void *, const sipTypeDef *);}
static void *cast_wxWebViewArchiveHandler(void *sipCppV, const sipTypeDef *targetType)
{
    ::wxWebViewArchiveHandler *sipCpp = reinterpret_cast< ::wxWebViewArchiveHandler *>(sipCppV);

    if (targetType == sipType_wxWebViewArchiveHandler)
        return sipCppV;

    if (targetType == sipType_wxWebViewHandler)
        return static_cast< ::wxWebViewHandler *>(sipCpp);

    return SIP_NULLPTR;
}


/* Call the instance's destructor. */
extern "C" {static void release_wxWebViewArchiveHandler(void *, int);}
static void release_wxWebViewArchiveHandler(void *sipCppV, int sipState)
{
    Py_BEGIN_ALLOW_THREADS

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxWebViewArchiveHandler *>(sipCppV);
    else
        delete reinterpret_cast< ::wxWebViewArchiveHandler *>(sipCppV);

    Py_END_ALLOW_THREADS
}


extern "C" {static void assign_wxWebViewArchiveHandler(void *, Py_ssize_t, void *);}
static void assign_wxWebViewArchiveHandler(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxWebViewArchiveHandler *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxWebViewArchiveHandler *>(sipSrc);
}


extern "C" {static void *copy_wxWebViewArchiveHandler(const void *, Py_ssize_t);}
static void *copy_wxWebViewArchiveHandler(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new ::wxWebViewArchiveHandler(reinterpret_cast<const ::wxWebViewArchiveHandler *>(sipSrc)[sipSrcIdx]);
}


extern "C" {static void dealloc_wxWebViewArchiveHandler(sipSimpleWrapper *);}
static void dealloc_wxWebViewArchiveHandler(sipSimpleWrapper *sipSelf)
{
    if (sipIsDerivedClass(sipSelf))
        reinterpret_cast<sipwxWebViewArchiveHandler *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;

    if (sipIsOwnedByPython(sipSelf))
    {
        release_wxWebViewArchiveHandler(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
    }
}


extern "C" {static void *init_type_wxWebViewArchiveHandler(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_wxWebViewArchiveHandler(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    sipwxWebViewArchiveHandler *sipCpp = SIP_NULLPTR;

    {
        const ::wxString* scheme;
        int schemeState = 0;

        static const char *sipKwdList[] = {
            sipName_scheme,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxString, &scheme, &schemeState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxWebViewArchiveHandler(*scheme);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(scheme), sipType_wxString, schemeState);

            if (PyErr_Occurred())
            {
                delete sipCpp;
                return SIP_NULLPTR;
            }

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxWebViewArchiveHandler* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxWebViewArchiveHandler, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxWebViewArchiveHandler(*a0);
            Py_END_ALLOW_THREADS

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's super-types. */
static sipEncodedTypeDef supers_wxWebViewArchiveHandler[] = {{6, 255, 1}};


static PyMethodDef methods_wxWebViewArchiveHandler[] = {
    {sipName_GetFile, SIP_MLMETH_CAST(meth_wxWebViewArchiveHandler_GetFile), METH_VARARGS|METH_KEYWORDS, doc_wxWebViewArchiveHandler_GetFile}
};

PyDoc_STRVAR(doc_wxWebViewArchiveHandler, "WebViewArchiveHandler(scheme) -> None\n"
"\n"
"A custom handler for the file scheme which also supports loading from\n"
"archives.");


sipClassTypeDef sipTypeDef__html2_wxWebViewArchiveHandler = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxWebViewArchiveHandler,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_WebViewArchiveHandler,
        {0, 0, 1},
        1, methods_wxWebViewArchiveHandler,
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxWebViewArchiveHandler,
    -1,
    -1,
    supers_wxWebViewArchiveHandler,
    SIP_NULLPTR,
    init_type_wxWebViewArchiveHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxWebViewArchiveHandler,
    assign_wxWebViewArchiveHandler,
    SIP_NULLPTR,
    copy_wxWebViewArchiveHandler,
    release_wxWebViewArchiveHandler,
    cast_wxWebViewArchiveHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxWebViewArchiveHandler),
};
