/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.14.0
 *
 * Copyright (c) 2024 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 "sipAPIQtCore.h"

#line 26 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qmutex.sip"
#include <qmutex.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.11/build/QtCore/sipQtCoreQMutexLocker.cpp"

#line 57 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qmutex.sip"
#include <qmutex.h>
#line 33 "/build/pyqt5/src/PyQt5-5.15.11/build/QtCore/sipQtCoreQMutexLocker.cpp"
#line 89 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qmutex.sip"
#include <qmutex.h>
#line 36 "/build/pyqt5/src/PyQt5-5.15.11/build/QtCore/sipQtCoreQMutexLocker.cpp"


PyDoc_STRVAR(doc_QMutexLocker_unlock, "unlock(self)");

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

    {
        ::QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QMutexLocker, &sipCpp))
        {
            sipCpp->unlock();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName_unlock, doc_QMutexLocker_unlock);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QMutexLocker_relock, "relock(self)");

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

    {
        ::QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QMutexLocker, &sipCpp))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->relock();
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName_relock, doc_QMutexLocker_relock);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QMutexLocker_mutex, "mutex(self) -> Optional[QMutex]");

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

    {
        const ::QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QMutexLocker, &sipCpp))
        {
            ::QMutex*sipRes;

            sipRes = sipCpp->mutex();

            return sipConvertFromType(sipRes, sipType_QMutex, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName_mutex, doc_QMutexLocker_mutex);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QMutexLocker___enter__, "__enter__(self) -> Any");

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

    {
        ::QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QMutexLocker, &sipCpp))
        {
            PyObject * sipRes = SIP_NULLPTR;

#line 40 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qmutex.sip"
        // Just return a reference to self.
        sipRes = sipSelf;
        Py_INCREF(sipRes);
#line 135 "/build/pyqt5/src/PyQt5-5.15.11/build/QtCore/sipQtCoreQMutexLocker.cpp"

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName___enter__, doc_QMutexLocker___enter__);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QMutexLocker___exit__, "__exit__(self, type: Any, value: Any, traceback: Any)");

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

    {
        PyObject * a0;
        PyObject * a1;
        PyObject * a2;
        ::QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BP0P0P0", &sipSelf, sipType_QMutexLocker, &sipCpp, &a0, &a1, &a2))
        {
#line 47 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qmutex.sip"
        sipCpp->unlock();
#line 164 "/build/pyqt5/src/PyQt5-5.15.11/build/QtCore/sipQtCoreQMutexLocker.cpp"

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName___exit__, doc_QMutexLocker___exit__);

    return SIP_NULLPTR;
}


/* Call the instance's destructor. */
extern "C" {static void release_QMutexLocker(void *, int);}
static void release_QMutexLocker(void *sipCppV, int)
{
    delete reinterpret_cast< ::QMutexLocker *>(sipCppV);
}


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


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

    {
        ::QMutex* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J8", sipType_QMutex, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new ::QMutexLocker(a0);
            Py_END_ALLOW_THREADS

            return sipCpp;
        }
    }

    {
        ::QRecursiveMutex* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J8", sipType_QRecursiveMutex, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new ::QMutexLocker(a0);
            Py_END_ALLOW_THREADS

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_QMutexLocker[] = {
    {sipName___enter__, meth_QMutexLocker___enter__, METH_VARARGS, doc_QMutexLocker___enter__},
    {sipName___exit__, meth_QMutexLocker___exit__, METH_VARARGS, doc_QMutexLocker___exit__},
    {sipName_mutex, meth_QMutexLocker_mutex, METH_VARARGS, doc_QMutexLocker_mutex},
    {sipName_relock, meth_QMutexLocker_relock, METH_VARARGS, doc_QMutexLocker_relock},
    {sipName_unlock, meth_QMutexLocker_unlock, METH_VARARGS, doc_QMutexLocker_unlock}
};

PyDoc_STRVAR(doc_QMutexLocker, "\1QMutexLocker(m: Optional[QMutex])\n"
"QMutexLocker(m: Optional[QRecursiveMutex])");


static pyqt5ClassPluginDef plugin_QMutexLocker = {
    SIP_NULLPTR,
    0,
    SIP_NULLPTR,
    SIP_NULLPTR
};


sipClassTypeDef sipTypeDef_QtCore_QMutexLocker = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_NONLAZY|SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QMutexLocker,
        SIP_NULLPTR,
        &plugin_QMutexLocker,
    },
    {
        sipNameNr_QMutexLocker,
        {0, 0, 1},
        5, methods_QMutexLocker,
        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_QMutexLocker,
    -1,
    sipNameNr_sip_simplewrapper,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_QMutexLocker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QMutexLocker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_QMutexLocker,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::QMutexLocker),
};
