| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- // qdbusargument.sip generated by MetaSIP
- //
- // This file is part of the QtDBus Python extension module.
- //
- // Copyright (c) 2026 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 QDBusArgument
- {
- %TypeHeaderCode
- #include <qdbusargument.h>
- %End
- %TypeCode
- #include <QStringList>
- static PyObject *qdbusargument_add(QDBusArgument *arg, PyObject *obj, int mtype)
- {
- int iserr = 0;
- if (PyLong_CheckExact(obj))
- {
- if (mtype == QMetaType::UChar || mtype == QMetaType::UShort || mtype == QMetaType::UInt || mtype == QMetaType::ULongLong)
- {
- // Handle the unsigned values.
- unsigned long long v = PyLong_AsUnsignedLongLongMask(obj);
- switch (mtype)
- {
- case QMetaType::UChar:
- *arg << (uchar)v;
- break;
- case QMetaType::UShort:
- *arg << (ushort)v;
- break;
- case QMetaType::UInt:
- *arg << (uint)v;
- break;
- case QMetaType::ULongLong:
- *arg << (qulonglong)v;
- break;
- }
- }
- else if (mtype == QMetaType::Short || mtype == QMetaType::Int || mtype == QMetaType::LongLong)
- {
- // Handle the signed values.
- long long v = PyLong_AsLongLong(obj);
- switch (mtype)
- {
- case QMetaType::Short:
- *arg << (short)v;
- break;
- case QMetaType::Int:
- *arg << (int)v;
- break;
- case QMetaType::LongLong:
- *arg << (qlonglong)v;
- break;
- }
- }
- else
- {
- PyErr_Format(PyExc_ValueError,
- "%d is an invalid QMetaType::Type for an integer object",
- mtype);
- iserr = 1;
- }
- }
- else if (mtype == QMetaType::QStringList)
- {
- // A QStringList has to be handled explicitly to prevent it being seen
- // as a vialiant list.
- int value_state;
- QStringList *qsl = reinterpret_cast<QStringList *>(
- sipForceConvertToType(obj, sipType_QStringList, 0,
- SIP_NOT_NONE, &value_state, &iserr));
- if (!iserr)
- {
- arg->beginArray(QMetaType::QString);
- for (int i = 0; i < qsl->count(); ++i)
- *arg << qsl->at(i);
- arg->endArray();
- sipReleaseType(qsl, sipType_QStringList, value_state);
- }
- }
- else
- {
- int value_state;
- QVariant *qv = reinterpret_cast<QVariant *>(
- sipForceConvertToType(obj, sipType_QVariant, 0, SIP_NOT_NONE,
- &value_state, &iserr));
- if (!iserr)
- {
- // This is an internal method. If it proves to be a problem then we
- // will have to handle each type explicitly.
- arg->appendVariant(*qv);
- sipReleaseType(qv, sipType_QVariant, value_state);
- }
- }
- if (iserr)
- return 0;
- Py_INCREF(Py_None);
- return Py_None;
- }
- %End
- public:
- QDBusArgument();
- QDBusArgument(const QDBusArgument &other);
- QDBusArgument(SIP_PYOBJECT arg, int id = QMetaType::Int);
- %MethodCode
- sipCpp = new QDBusArgument();
- PyObject *res = qdbusargument_add(sipCpp, a0, a1);
-
- if (res)
- {
- Py_DECREF(res);
- }
- else
- {
- delete sipCpp;
- sipCpp = 0;
- }
- %End
- ~QDBusArgument();
- SIP_PYOBJECT add(SIP_PYOBJECT arg, int id = QMetaType::Int) /TypeHint=""/;
- %MethodCode
- sipRes = qdbusargument_add(sipCpp, a0, a1);
- %End
- void beginStructure();
- void endStructure();
- void beginArray(QMetaType elementMetaType);
- void beginArray(int id);
- void endArray();
- void beginMap(QMetaType keyMetaType, QMetaType valueMetaType);
- void beginMap(int kid, int vid);
- void endMap();
- void beginMapEntry();
- void endMapEntry();
- void swap(QDBusArgument &other /Constrained/);
- };
|