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

#include "sipAPI_core.h"
        #include <wx/snglinst.h>



PyDoc_STRVAR(doc_wxSingleInstanceChecker_Create, "Create(name, path=EmptyString) -> bool\n"
"\n"
"Initialize the object if it had been created using the default\n"
"constructor.");

extern "C" {static PyObject *meth_wxSingleInstanceChecker_Create(PyObject *, PyObject *, PyObject *);}
static PyObject *meth_wxSingleInstanceChecker_Create(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxString* name;
        int nameState = 0;
        const  ::wxString& pathdef = wxEmptyString;
        const  ::wxString* path = &pathdef;
        int pathState = 0;
         ::wxSingleInstanceChecker *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1|J1", &sipSelf, sipType_wxSingleInstanceChecker, &sipCpp, sipType_wxString, &name, &nameState, sipType_wxString, &path, &pathState))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create(*name,*path);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(name), sipType_wxString, nameState);
            sipReleaseType(const_cast< ::wxString *>(path), sipType_wxString, pathState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_SingleInstanceChecker, sipName_Create, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxSingleInstanceChecker_CreateDefault, "CreateDefault() -> bool\n"
"\n"
"Calls Create() with default name.");

extern "C" {static PyObject *meth_wxSingleInstanceChecker_CreateDefault(PyObject *, PyObject *);}
static PyObject *meth_wxSingleInstanceChecker_CreateDefault(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
         ::wxSingleInstanceChecker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxSingleInstanceChecker, &sipCpp))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->CreateDefault();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_SingleInstanceChecker, sipName_CreateDefault, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxSingleInstanceChecker_IsAnotherRunning, "IsAnotherRunning() -> bool\n"
"\n"
"Returns true if another copy of this program is already running and\n"
"false otherwise.");

extern "C" {static PyObject *meth_wxSingleInstanceChecker_IsAnotherRunning(PyObject *, PyObject *);}
static PyObject *meth_wxSingleInstanceChecker_IsAnotherRunning(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxSingleInstanceChecker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxSingleInstanceChecker, &sipCpp))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->IsAnotherRunning();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_SingleInstanceChecker, sipName_IsAnotherRunning, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    delete reinterpret_cast< ::wxSingleInstanceChecker *>(sipCppV);

    Py_END_ALLOW_THREADS
}


extern "C" {static void dealloc_wxSingleInstanceChecker(sipSimpleWrapper *);}
static void dealloc_wxSingleInstanceChecker(sipSimpleWrapper *sipSelf)
{
    if (sipIsOwnedByPython(sipSelf))
    {
        release_wxSingleInstanceChecker(sipGetAddress(sipSelf), 0);
    }
}


extern "C" {static void *init_type_wxSingleInstanceChecker(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_wxSingleInstanceChecker(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
     ::wxSingleInstanceChecker *sipCpp = SIP_NULLPTR;

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxSingleInstanceChecker();
            Py_END_ALLOW_THREADS

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

            return sipCpp;
        }
    }

    {
        const  ::wxString* name;
        int nameState = 0;
        const  ::wxString& pathdef = wxEmptyString;
        const  ::wxString* path = &pathdef;
        int pathState = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1|J1", sipType_wxString, &name, &nameState, sipType_wxString, &path, &pathState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxSingleInstanceChecker(*name,*path);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(name), sipType_wxString, nameState);
            sipReleaseType(const_cast< ::wxString *>(path), sipType_wxString, pathState);

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_wxSingleInstanceChecker[] = {
    {sipName_Create, SIP_MLMETH_CAST(meth_wxSingleInstanceChecker_Create), METH_VARARGS|METH_KEYWORDS, doc_wxSingleInstanceChecker_Create},
    {sipName_CreateDefault, meth_wxSingleInstanceChecker_CreateDefault, METH_VARARGS, doc_wxSingleInstanceChecker_CreateDefault},
    {sipName_IsAnotherRunning, meth_wxSingleInstanceChecker_IsAnotherRunning, METH_VARARGS, doc_wxSingleInstanceChecker_IsAnotherRunning}
};

PyDoc_STRVAR(doc_wxSingleInstanceChecker, "SingleInstanceChecker()\n"
"SingleInstanceChecker(name, path=EmptyString)\n"
"\n"
"wxSingleInstanceChecker class allows checking that only a single\n"
"instance of a program is running.");


sipClassTypeDef sipTypeDef__core_wxSingleInstanceChecker = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxSingleInstanceChecker,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        sipNameNr_SingleInstanceChecker,
        {0, 0, 1},
        3, methods_wxSingleInstanceChecker,
        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_wxSingleInstanceChecker,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxSingleInstanceChecker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxSingleInstanceChecker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxSingleInstanceChecker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
