qdbusabstractinterface.sip 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. // qdbusabstractinterface.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtDBus Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QDBusAbstractInterface : QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qdbusabstractinterface.h>
  25. %End
  26. %TypeCode
  27. // Convert a Python tuple to a list of QVarients.
  28. static QList<QVariant> QtDBus_marshal(PyObject *py_args, int *is_err)
  29. {
  30. QList<QVariant> cpp_args;
  31. Py_ssize_t nr_args = PyTuple_Size(py_args);
  32. for (Py_ssize_t i = 0; i < nr_args; ++i)
  33. {
  34. int state;
  35. void *var;
  36. var = sipForceConvertToType(PyTuple_GetItem(py_args, i), sipType_QVariant, NULL,
  37. 0, &state, is_err);
  38. if (*is_err)
  39. break;
  40. cpp_args.append(*reinterpret_cast<QVariant *>(var));
  41. sipReleaseType(var, sipType_QVariant, state);
  42. }
  43. return cpp_args;
  44. }
  45. %End
  46. %ConvertToSubClassCode
  47. static struct class_graph {
  48. const char *name;
  49. sipTypeDef **type;
  50. int yes, no;
  51. } graph[] = {
  52. {sipName_QDBusPendingCallWatcher, &sipType_QDBusPendingCallWatcher, -1, 1},
  53. {sipName_QDBusAbstractAdaptor, &sipType_QDBusAbstractAdaptor, -1, 2},
  54. {sipName_QDBusAbstractInterface, &sipType_QDBusAbstractInterface, 4, 3},
  55. {sipName_QDBusServiceWatcher, &sipType_QDBusServiceWatcher, -1, -1},
  56. {sipName_QDBusConnectionInterface, &sipType_QDBusConnectionInterface, -1, 5},
  57. {sipName_QDBusInterface, &sipType_QDBusInterface, -1, -1},
  58. };
  59. int i = 0;
  60. sipType = NULL;
  61. do
  62. {
  63. struct class_graph *cg = &graph[i];
  64. if (cg->name != NULL && sipCpp->inherits(cg->name))
  65. {
  66. sipType = *cg->type;
  67. i = cg->yes;
  68. }
  69. else
  70. i = cg->no;
  71. }
  72. while (i >= 0);
  73. %End
  74. public:
  75. virtual ~QDBusAbstractInterface();
  76. bool isValid() const;
  77. QDBusConnection connection() const;
  78. QString service() const;
  79. QString path() const;
  80. QString interface() const;
  81. QDBusError lastError() const;
  82. void setTimeout(int timeout);
  83. int timeout() const;
  84. QDBusMessage call(const QString &method, ...);
  85. %MethodCode
  86. QList<QVariant> args;
  87. args = QtDBus_marshal(a1, &sipIsErr);
  88. if (!sipIsErr)
  89. {
  90. Py_BEGIN_ALLOW_THREADS
  91. sipRes = new QDBusMessage(sipCpp->callWithArgumentList(QDBus::AutoDetect, *a0, args));
  92. Py_END_ALLOW_THREADS
  93. }
  94. %End
  95. QDBusMessage call(QDBus::CallMode mode, const QString &method, ...);
  96. %MethodCode
  97. QList<QVariant> args;
  98. args = QtDBus_marshal(a2, &sipIsErr);
  99. if (!sipIsErr)
  100. {
  101. Py_BEGIN_ALLOW_THREADS
  102. sipRes = new QDBusMessage(sipCpp->callWithArgumentList(a0, *a1, args));
  103. Py_END_ALLOW_THREADS
  104. }
  105. %End
  106. QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList<QVariant> &args) /ReleaseGIL/;
  107. bool callWithCallback(const QString &method, const QList<QVariant> &args, SIP_PYOBJECT returnMethod /TypeHint="PYQT_SLOT"/, SIP_PYOBJECT errorMethod /TypeHint="PYQT_SLOT"/);
  108. %MethodCode
  109. QObject *receiver;
  110. QByteArray return_slot;
  111. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &receiver, return_slot)) == sipErrorNone)
  112. {
  113. QObject *error_receiver;
  114. QByteArray error_slot;
  115. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a3, &error_receiver, error_slot)) == sipErrorNone)
  116. {
  117. if (receiver == error_receiver)
  118. {
  119. sipRes = sipCpp->callWithCallback(*a0, *a1, receiver, return_slot.constData(), error_slot.constData());
  120. }
  121. else
  122. {
  123. PyErr_SetString(PyExc_ValueError,
  124. "the return and error methods must be bound to the same QObject instance");
  125. sipError = sipErrorFail;
  126. }
  127. }
  128. else if (sipError == sipErrorContinue)
  129. {
  130. sipError = sipBadCallableArg(3, a3);
  131. }
  132. }
  133. else if (sipError == sipErrorContinue)
  134. {
  135. sipError = sipBadCallableArg(2, a2);
  136. }
  137. %End
  138. bool callWithCallback(const QString &method, QList<QVariant> &args, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
  139. %MethodCode
  140. QObject *receiver;
  141. QByteArray slot;
  142. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &receiver, slot)) == sipErrorNone)
  143. {
  144. sipRes = sipCpp->callWithCallback(*a0, *a1, receiver, slot.constData());
  145. }
  146. else if (sipError == sipErrorContinue)
  147. {
  148. sipError = sipBadCallableArg(2, a2);
  149. }
  150. %End
  151. QDBusPendingCall asyncCall(const QString &method, ...);
  152. %MethodCode
  153. QList<QVariant> args;
  154. args = QtDBus_marshal(a1, &sipIsErr);
  155. if (!sipIsErr)
  156. {
  157. Py_BEGIN_ALLOW_THREADS
  158. sipRes = new QDBusPendingCall(sipCpp->asyncCallWithArgumentList(*a0, args));
  159. Py_END_ALLOW_THREADS
  160. }
  161. %End
  162. QDBusPendingCall asyncCallWithArgumentList(const QString &method, const QList<QVariant> &args);
  163. protected:
  164. QDBusAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent /TransferThis/);
  165. virtual void connectNotify(const QMetaMethod &signal);
  166. virtual void disconnectNotify(const QMetaMethod &signal);
  167. public:
  168. %If (Qt_6_7_0 -)
  169. void setInteractiveAuthorizationAllowed(bool enable);
  170. %End
  171. %If (Qt_6_7_0 -)
  172. bool isInteractiveAuthorizationAllowed() const;
  173. %End
  174. };
  175. %ModuleHeaderCode
  176. #include "qpydbus_api.h"
  177. // Imports from QtCore.
  178. typedef PyObject *(*pyqt6_qtdbus_from_qvariant_by_type_t)(QVariant &, PyObject *);
  179. extern pyqt6_qtdbus_from_qvariant_by_type_t pyqt6_qtdbus_from_qvariant_by_type;
  180. typedef sipErrorState (*pyqt6_qtdbus_get_pyqtslot_parts_t)(PyObject *, QObject **, QByteArray &);
  181. extern pyqt6_qtdbus_get_pyqtslot_parts_t pyqt6_qtdbus_get_pyqtslot_parts;
  182. %End
  183. %ModuleCode
  184. // Imports from QtCore.
  185. pyqt6_qtdbus_from_qvariant_by_type_t pyqt6_qtdbus_from_qvariant_by_type;
  186. pyqt6_qtdbus_get_pyqtslot_parts_t pyqt6_qtdbus_get_pyqtslot_parts;
  187. %End
  188. %PostInitialisationCode
  189. qpydbus_post_init();
  190. // Imports from QtCore.
  191. pyqt6_qtdbus_from_qvariant_by_type = (pyqt6_qtdbus_from_qvariant_by_type_t)sipImportSymbol("pyqt6_from_qvariant_by_type");
  192. Q_ASSERT(pyqt6_qtdbus_from_qvariant_by_type);
  193. pyqt6_qtdbus_get_pyqtslot_parts = (pyqt6_qtdbus_get_pyqtslot_parts_t)sipImportSymbol("pyqt6_get_pyqtslot_parts");
  194. Q_ASSERT(pyqt6_qtdbus_get_pyqtslot_parts);
  195. %End