23 if (id == arg.metaType().id()) {
26 *
reinterpret_cast<
bool *>(to) = arg.toBool();
29 case QMetaType::UChar:
30 *
reinterpret_cast<uchar *>(to) = qvariant_cast<uchar>(arg);
33 case QMetaType::Short:
34 *
reinterpret_cast<
short *>(to) = qvariant_cast<
short>(arg);
37 case QMetaType::UShort:
38 *
reinterpret_cast<ushort *>(to) = qvariant_cast<ushort>(arg);
42 *
reinterpret_cast<
int *>(to) = arg.toInt();
46 *
reinterpret_cast<uint *>(to) = arg.toUInt();
49 case QMetaType::LongLong:
50 *
reinterpret_cast<qlonglong *>(to) = arg.toLongLong();
53 case QMetaType::ULongLong:
54 *
reinterpret_cast<qulonglong *>(to) = arg.toULongLong();
57 case QMetaType::Double:
58 *
reinterpret_cast<
double *>(to) = arg.toDouble();
61 case QMetaType::QString:
62 *
reinterpret_cast<QString *>(to) = arg.toString();
65 case QMetaType::QByteArray:
66 *
reinterpret_cast<QByteArray *>(to) = arg.toByteArray();
69 case QMetaType::QStringList:
70 *
reinterpret_cast<QStringList *>(to) = arg.toStringList();
74 if (id == QDBusMetaTypeId::variant().id()) {
75 *
reinterpret_cast<
QDBusVariant *>(to) = qvariant_cast<QDBusVariant>(arg);
77 }
else if (id == QDBusMetaTypeId::objectpath().id()) {
78 *
reinterpret_cast<QDBusObjectPath *>(to) = qvariant_cast<
QDBusObjectPath>(arg);
80 }
else if (id == QDBusMetaTypeId::signature().id()) {
81 *
reinterpret_cast<QDBusSignature *>(to) = qvariant_cast<
QDBusSignature>(arg);
87 qFatal(
"Found a decoded basic type in a D-Bus reply that shouldn't be there");
91 if (arg.metaType() != QDBusMetaTypeId::argument()) {
98 const char *userSignature = QDBusMetaType::typeToSignature(QMetaType(id));
99 if (!userSignature || !*userSignature) {
107 if (dbarg.currentSignature() != QLatin1StringView(userSignature)) {
114 QDBusMetaType::demarshall(dbarg, QMetaType(id), to);
185QDBusInterface::QDBusInterface(
const QString &service,
const QString &path,
const QString &interface,
186 const QDBusConnection &connection, QObject *parent)
187 : QDBusAbstractInterface(*
new QDBusInterfacePrivate(service, path, interface, connection),
227int QDBusInterface::qt_metacall(QMetaObject::Call _c,
int _id,
void **_a)
229 _id = QDBusAbstractInterface::qt_metacall(_c, _id, _a);
230 if (_id < 0 || !d_func()->isValid || !d_func()->metaObject)
232 return d_func()->metacall(_c, _id, _a);
239 if (c == QMetaObject::InvokeMetaMethod) {
240 int offset = metaObject->methodOffset();
241 QMetaMethod mm = metaObject->method(id + offset);
243 if (mm.methodType() == QMetaMethod::Signal) {
245 QMetaObject::activate(q, metaObject, id, argv);
247 }
else if (mm.methodType() == QMetaMethod::Slot || mm.methodType() == QMetaMethod::Method) {
250 QString methodName = QString::fromLatin1(mm.name());
251 const int *inputTypes = metaObject->inputTypesForMethod(id);
252 int inputTypesCount = *inputTypes;
256 args.reserve(inputTypesCount);
258 for ( ; i <= inputTypesCount; ++i)
259 args << QVariant(QMetaType(inputTypes[i]), argv[i]);
262 QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args);
264 if (reply.type() == QDBusMessage::ReplyMessage) {
266 args = reply.arguments();
267 QVariantList::ConstIterator it = args.constBegin();
268 const int *outputTypes = metaObject->outputTypesForMethod(id);
269 int outputTypesCount = *outputTypes++;
271 if (mm.returnType() != QMetaType::UnknownType && mm.returnType() != QMetaType::Void) {
273 if (argv[0] && it != args.constEnd())
274 copyArgument(argv[0], *outputTypes++, *it);
281 for (
int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) {
282 copyArgument(argv[i], outputTypes[j], *it);
287 lastError = QDBusError(reply);