22 if (id == arg.metaType().id()) {
25 *
reinterpret_cast<
bool *>(to) = arg.toBool();
28 case QMetaType::UChar:
29 *
reinterpret_cast<uchar *>(to) = qvariant_cast<uchar>(arg);
32 case QMetaType::Short:
33 *
reinterpret_cast<
short *>(to) = qvariant_cast<
short>(arg);
36 case QMetaType::UShort:
37 *
reinterpret_cast<ushort *>(to) = qvariant_cast<ushort>(arg);
41 *
reinterpret_cast<
int *>(to) = arg.toInt();
45 *
reinterpret_cast<uint *>(to) = arg.toUInt();
48 case QMetaType::LongLong:
49 *
reinterpret_cast<qlonglong *>(to) = arg.toLongLong();
52 case QMetaType::ULongLong:
53 *
reinterpret_cast<qulonglong *>(to) = arg.toULongLong();
56 case QMetaType::Double:
57 *
reinterpret_cast<
double *>(to) = arg.toDouble();
60 case QMetaType::QString:
61 *
reinterpret_cast<QString *>(to) = arg.toString();
64 case QMetaType::QByteArray:
65 *
reinterpret_cast<QByteArray *>(to) = arg.toByteArray();
68 case QMetaType::QStringList:
69 *
reinterpret_cast<QStringList *>(to) = arg.toStringList();
73 if (id == QDBusMetaTypeId::variant().id()) {
74 *
reinterpret_cast<
QDBusVariant *>(to) = qvariant_cast<QDBusVariant>(arg);
76 }
else if (id == QDBusMetaTypeId::objectpath().id()) {
77 *
reinterpret_cast<QDBusObjectPath *>(to) = qvariant_cast<
QDBusObjectPath>(arg);
79 }
else if (id == QDBusMetaTypeId::signature().id()) {
80 *
reinterpret_cast<QDBusSignature *>(to) = qvariant_cast<
QDBusSignature>(arg);
86 qFatal(
"Found a decoded basic type in a D-Bus reply that shouldn't be there");
90 if (arg.metaType() != QDBusMetaTypeId::argument()) {
97 const char *userSignature = QDBusMetaType::typeToSignature(QMetaType(id));
98 if (!userSignature || !*userSignature) {
106 if (dbarg.currentSignature() != QLatin1StringView(userSignature)) {
113 QDBusMetaType::demarshall(dbarg, QMetaType(id), to);
184QDBusInterface::QDBusInterface(
const QString &service,
const QString &path,
const QString &interface,
185 const QDBusConnection &connection, QObject *parent)
186 : QDBusAbstractInterface(*
new QDBusInterfacePrivate(service, path, interface, connection),
226int QDBusInterface::qt_metacall(QMetaObject::Call _c,
int _id,
void **_a)
228 _id = QDBusAbstractInterface::qt_metacall(_c, _id, _a);
229 if (_id < 0 || !d_func()->isValid || !d_func()->metaObject)
231 return d_func()->metacall(_c, _id, _a);
238 if (c == QMetaObject::InvokeMetaMethod) {
239 int offset = metaObject->methodOffset();
240 QMetaMethod mm = metaObject->method(id + offset);
242 if (mm.methodType() == QMetaMethod::Signal) {
244 QMetaObject::activate(q, metaObject, id, argv);
246 }
else if (mm.methodType() == QMetaMethod::Slot || mm.methodType() == QMetaMethod::Method) {
249 QString methodName = QString::fromLatin1(mm.name());
250 const int *inputTypes = metaObject->inputTypesForMethod(id);
251 int inputTypesCount = *inputTypes;
255 args.reserve(inputTypesCount);
257 for ( ; i <= inputTypesCount; ++i)
258 args << QVariant(QMetaType(inputTypes[i]), argv[i]);
261 QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args);
263 if (reply.type() == QDBusMessage::ReplyMessage) {
265 args = reply.arguments();
266 QVariantList::ConstIterator it = args.constBegin();
267 const int *outputTypes = metaObject->outputTypesForMethod(id);
268 int outputTypesCount = *outputTypes++;
270 if (mm.returnType() != QMetaType::UnknownType && mm.returnType() != QMetaType::Void) {
272 if (argv[0] && it != args.constEnd())
273 copyArgument(argv[0], *outputTypes++, *it);
280 for (
int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) {
281 copyArgument(argv[i], outputTypes[j], *it);
286 lastError = QDBusError(reply);