Spaces:
Running
Running
| // This is the SIP specification of the QPyDBusReply class. | |
| // | |
| // Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com> | |
| // | |
| // This file is part of PyQt6. | |
| // | |
| // 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. | |
| class QPyDBusReply /PyName=QDBusReply/ | |
| { | |
| %TypeHeaderCode | |
| #include <qpydbusreply.h> | |
| %End | |
| public: | |
| QPyDBusReply(const QDBusMessage &reply) /HoldGIL/; | |
| QPyDBusReply(const QDBusPendingCall &call) /HoldGIL/; | |
| QPyDBusReply(const QDBusError &error); | |
| QPyDBusReply(const QPyDBusReply &other) /HoldGIL/; | |
| ~QPyDBusReply() /HoldGIL/; | |
| const QDBusError &error() const /HoldGIL/; | |
| bool isValid() const /HoldGIL/; | |
| SIP_PYOBJECT value(SIP_PYOBJECT type /TypeHintValue="None"/ = 0) const /HoldGIL/; | |
| }; | |
| template<TYPE> | |
| %MappedType QDBusReply<TYPE> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| PyObject *value_obj; | |
| if (sipCpp->isValid()) | |
| { | |
| // Convert the value to a Python object. | |
| TYPE *value = new TYPE(sipCpp->value()); | |
| if ((value_obj = sipConvertFromNewType(value, sipType_TYPE, NULL)) == NULL) | |
| { | |
| delete value; | |
| return 0; | |
| } | |
| } | |
| else | |
| { | |
| value_obj = 0; | |
| } | |
| QPyDBusReply *reply = new QPyDBusReply(value_obj, sipCpp->isValid(), | |
| sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return 0; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %MappedType QDBusReply<void> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| Py_INCREF(Py_None); | |
| QPyDBusReply *reply = new QPyDBusReply(Py_None, | |
| sipCpp->isValid(), sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return 0; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %MappedType QDBusReply<bool> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| PyObject *value_obj; | |
| if (sipCpp->isValid()) | |
| { | |
| if ((value_obj = PyBool_FromLong(sipCpp->value())) == NULL) | |
| return 0; | |
| } | |
| else | |
| { | |
| value_obj = 0; | |
| } | |
| QPyDBusReply *reply = new QPyDBusReply(value_obj, sipCpp->isValid(), | |
| sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return 0; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %MappedType QDBusReply<unsigned> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| PyObject *value_obj; | |
| if (sipCpp->isValid()) | |
| { | |
| if ((value_obj = PyLong_FromUnsignedLong(sipCpp->value())) == NULL) | |
| return NULL; | |
| } | |
| else | |
| { | |
| value_obj = 0; | |
| } | |
| QPyDBusReply *reply = new QPyDBusReply(value_obj, sipCpp->isValid(), | |
| sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return 0; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %MappedType QDBusReply<QDBusConnectionInterface::RegisterServiceReply> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| PyObject *value_obj; | |
| if (sipCpp->isValid()) | |
| { | |
| if ((value_obj = sipConvertFromEnum(sipCpp->value(), sipType_QDBusConnectionInterface_RegisterServiceReply)) == NULL) | |
| return NULL; | |
| } | |
| else | |
| { | |
| value_obj = 0; | |
| } | |
| QPyDBusReply *reply = new QPyDBusReply(value_obj, sipCpp->isValid(), | |
| sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return NULL; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %If (Qt_6_10_0 -) | |
| %MappedType QDBusReply<QMap<QString, QVariant>> /TypeHint="QDBusReply"/ | |
| { | |
| %TypeHeaderCode | |
| #include <qdbusreply.h> | |
| #include <qpydbusreply.h> | |
| %End | |
| %ConvertFromTypeCode | |
| PyObject *value_obj; | |
| if (sipCpp->isValid()) | |
| { | |
| if ((value_obj = PyDict_New()) == NULL) | |
| return 0; | |
| QMap<QString, QVariant> value = sipCpp->value(); | |
| QMap<QString, QVariant>::const_iterator it = value.constBegin(); | |
| QMap<QString, QVariant>::const_iterator end = value.constEnd(); | |
| while (it != end) | |
| { | |
| QString *k = new QString(it.key()); | |
| PyObject *kobj = sipConvertFromNewType(k, sipType_QString, | |
| sipTransferObj); | |
| if (!kobj) | |
| { | |
| delete k; | |
| Py_DECREF(value_obj); | |
| return 0; | |
| } | |
| QVariant *v = new QVariant(it.value()); | |
| PyObject *vobj = sipConvertFromNewType(v, sipType_QVariant, | |
| sipTransferObj); | |
| if (!vobj) | |
| { | |
| delete v; | |
| Py_DECREF(kobj); | |
| Py_DECREF(value_obj); | |
| return 0; | |
| } | |
| int rc = PyDict_SetItem(value_obj, kobj, vobj); | |
| Py_DECREF(vobj); | |
| Py_DECREF(kobj); | |
| if (rc < 0) | |
| { | |
| Py_DECREF(value_obj); | |
| return 0; | |
| } | |
| ++it; | |
| } | |
| } | |
| else | |
| { | |
| value_obj = 0; | |
| } | |
| QPyDBusReply *reply = new QPyDBusReply(value_obj, sipCpp->isValid(), | |
| sipCpp->error()); | |
| PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, | |
| sipTransferObj); | |
| if (!reply_obj) | |
| { | |
| delete reply; | |
| return 0; | |
| } | |
| return reply_obj; | |
| %End | |
| }; | |
| %End | |