/*
 * Interface wrapper 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 "sipAPIQtCore.h"

#line 26 "/build/pyqt5/src/PyQt5-5.15.7/sip/QtCore/qreadwritelock.sip"
#include <qreadwritelock.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.7/build/QtCore/sipQtCoreQReadWriteLock.cpp"



PyDoc_STRVAR(doc_QReadWriteLock_lockForRead, "lockForRead(self)");

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

    {
         ::QReadWriteLock *sipCpp;

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

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QReadWriteLock, sipName_lockForRead, doc_QReadWriteLock_lockForRead);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QReadWriteLock_tryLockForRead, "tryLockForRead(self) -> bool\n"
"tryLockForRead(self, int) -> bool");

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

    {
         ::QReadWriteLock *sipCpp;

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

            sipRes = sipCpp->tryLockForRead();

            return PyBool_FromLong(sipRes);
        }
    }

    {
        int a0;
         ::QReadWriteLock *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi", &sipSelf, sipType_QReadWriteLock, &sipCpp, &a0))
        {
            bool sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->tryLockForRead(a0);
            Py_END_ALLOW_THREADS

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_QReadWriteLock, sipName_tryLockForRead, doc_QReadWriteLock_tryLockForRead);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QReadWriteLock_lockForWrite, "lockForWrite(self)");

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

    {
         ::QReadWriteLock *sipCpp;

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

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QReadWriteLock, sipName_lockForWrite, doc_QReadWriteLock_lockForWrite);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QReadWriteLock_tryLockForWrite, "tryLockForWrite(self) -> bool\n"
"tryLockForWrite(self, int) -> bool");

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

    {
         ::QReadWriteLock *sipCpp;

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

            sipRes = sipCpp->tryLockForWrite();

            return PyBool_FromLong(sipRes);
        }
    }

    {
        int a0;
         ::QReadWriteLock *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi", &sipSelf, sipType_QReadWriteLock, &sipCpp, &a0))
        {
            bool sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->tryLockForWrite(a0);
            Py_END_ALLOW_THREADS

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_QReadWriteLock, sipName_tryLockForWrite, doc_QReadWriteLock_tryLockForWrite);

    return SIP_NULLPTR;
}


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

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

    {
         ::QReadWriteLock *sipCpp;

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

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QReadWriteLock, sipName_unlock, doc_QReadWriteLock_unlock);

    return SIP_NULLPTR;
}


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


extern "C" {static void *array_QReadWriteLock(Py_ssize_t);}
static void *array_QReadWriteLock(Py_ssize_t sipNrElem)
{
    return new  ::QReadWriteLock[sipNrElem];
}


extern "C" {static void array_delete_QReadWriteLock(void *);}
static void array_delete_QReadWriteLock(void *sipCpp)
{
    delete[] reinterpret_cast< ::QReadWriteLock *>(sipCpp);
}


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


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

    {
         ::QReadWriteLock::RecursionMode a0 = QReadWriteLock::NonRecursive;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "|E", sipType_QReadWriteLock_RecursionMode, &a0))
        {
            sipCpp = new  ::QReadWriteLock(a0);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_QReadWriteLock[] = {
    {sipName_lockForRead, meth_QReadWriteLock_lockForRead, METH_VARARGS, doc_QReadWriteLock_lockForRead},
    {sipName_lockForWrite, meth_QReadWriteLock_lockForWrite, METH_VARARGS, doc_QReadWriteLock_lockForWrite},
    {sipName_tryLockForRead, meth_QReadWriteLock_tryLockForRead, METH_VARARGS, doc_QReadWriteLock_tryLockForRead},
    {sipName_tryLockForWrite, meth_QReadWriteLock_tryLockForWrite, METH_VARARGS, doc_QReadWriteLock_tryLockForWrite},
    {sipName_unlock, meth_QReadWriteLock_unlock, METH_VARARGS, doc_QReadWriteLock_unlock}
};

static sipEnumMemberDef enummembers_QReadWriteLock[] = {
    {sipName_NonRecursive, static_cast<int>( ::QReadWriteLock::NonRecursive), 214},
    {sipName_Recursive, static_cast<int>( ::QReadWriteLock::Recursive), 214},
};

PyDoc_STRVAR(doc_QReadWriteLock, "\1QReadWriteLock(recursionMode: QReadWriteLock.RecursionMode = QReadWriteLock.NonRecursive)");


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


sipClassTypeDef sipTypeDef_QtCore_QReadWriteLock = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QReadWriteLock,
        SIP_NULLPTR,
        &plugin_QReadWriteLock
    },
    {
        sipNameNr_QReadWriteLock,
        {0, 0, 1},
        5, methods_QReadWriteLock,
        2, enummembers_QReadWriteLock,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_QReadWriteLock,
    -1,
    sipNameNr_sip_simplewrapper,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_QReadWriteLock,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QReadWriteLock,
    SIP_NULLPTR,
    array_QReadWriteLock,
    SIP_NULLPTR,
    release_QReadWriteLock,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_QReadWriteLock,
    sizeof ( ::QReadWriteLock),
};
