Merge remote-tracking branch 'origin/api_changes'
[profile/ivi/qtbase.git] / src / dbus / qdbusmetaobject.cpp
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtDBus module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #include "qdbusmetaobject_p.h"
43
44 #include <QtCore/qbytearray.h>
45 #include <QtCore/qhash.h>
46 #include <QtCore/qstring.h>
47 #include <QtCore/qvarlengtharray.h>
48
49 #include "qdbusutil_p.h"
50 #include "qdbuserror.h"
51 #include "qdbusmetatype.h"
52 #include "qdbusargument.h"
53 #include "qdbusintrospection_p.h"
54 #include "qdbusabstractinterface_p.h"
55
56 #include <private/qmetaobject_p.h>
57 #include <private/qmetaobjectbuilder_p.h>
58
59 #ifndef QT_NO_DBUS
60
61 QT_BEGIN_NAMESPACE
62
63 class QDBusMetaObjectGenerator
64 {
65 public:
66     QDBusMetaObjectGenerator(const QString &interface,
67                              const QDBusIntrospection::Interface *parsedData);
68     void write(QDBusMetaObject *obj);
69     void writeWithoutXml(QDBusMetaObject *obj);
70
71 private:
72     struct Method {
73         QList<QByteArray> parameterNames;
74         QByteArray tag;
75         QByteArray name;
76         QVarLengthArray<int, 4> inputTypes;
77         QVarLengthArray<int, 4> outputTypes;
78         int flags;
79     };
80     
81     struct Property {
82         QByteArray typeName;
83         QByteArray signature;
84         int type;
85         int flags;
86     };
87     struct Type {
88         int id;
89         QByteArray name;
90     };
91
92     QMap<QByteArray, Method> signals_;
93     QMap<QByteArray, Method> methods;
94     QMap<QByteArray, Property> properties;
95     
96     const QDBusIntrospection::Interface *data;
97     QString interface;
98
99     Type findType(const QByteArray &signature,
100                   const QDBusIntrospection::Annotations &annotations,
101                   const char *direction = "Out", int id = -1);
102     
103     void parseMethods();
104     void parseSignals();
105     void parseProperties();
106
107     static int aggregateParameterCount(const QMap<QByteArray, Method> &map);
108 };
109
110 static const int intsPerProperty = 2;
111 static const int intsPerMethod = 2;
112
113 struct QDBusMetaObjectPrivate : public QMetaObjectPrivate
114 {
115     int propertyDBusData;
116     int methodDBusData;
117 };
118
119 QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName,
120                                                    const QDBusIntrospection::Interface *parsedData)
121     : data(parsedData), interface(interfaceName)
122 {
123     if (data) {
124         parseProperties();
125         parseSignals();             // call parseSignals first so that slots override signals
126         parseMethods();
127     }
128 }
129
130 Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false;
131
132 QDBusMetaObjectGenerator::Type
133 QDBusMetaObjectGenerator::findType(const QByteArray &signature,
134                                    const QDBusIntrospection::Annotations &annotations,
135                                    const char *direction, int id)
136 {
137     struct QDBusRawTypeHandler {
138         static void destroy(void *)
139         {
140             qFatal("Cannot destroy placeholder type QDBusRawType");
141         }
142
143         static void *create(const void *)
144         {
145             qFatal("Cannot create placeholder type QDBusRawType");
146             return 0;
147         }
148
149         static void destruct(void *)
150         {
151             qFatal("Cannot destruct placeholder type QDBusRawType");
152         }
153
154         static void *construct(void *, const void *)
155         {
156             qFatal("Cannot construct placeholder type QDBusRawType");
157             return 0;
158         }
159     };
160
161     Type result;
162     result.id = QVariant::Invalid;
163
164     int type = QDBusMetaType::signatureToType(signature);
165     if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) {
166         // it's not a type normally handled by our meta type system
167         // it must contain an annotation
168         QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
169         if (id >= 0)
170             annotationName += QString::fromLatin1(".%1%2")
171                               .arg(QLatin1String(direction))
172                               .arg(id);
173
174         // extract from annotations:
175         QByteArray typeName = annotations.value(annotationName).toLatin1();
176
177         // verify that it's a valid one
178         if (typeName.isEmpty()) {
179             // try the old annotation from Qt 4
180             annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
181             if (id >= 0)
182                 annotationName += QString::fromLatin1(".%1%2")
183                                   .arg(QLatin1String(direction))
184                                   .arg(id);
185             typeName = annotations.value(annotationName).toLatin1();
186         }
187
188         if (!typeName.isEmpty()) {
189             // type name found
190             type = QMetaType::type(typeName);
191         }
192
193         if (type == QVariant::Invalid || signature != QDBusMetaType::typeToSignature(type)) {
194             // type is still unknown or doesn't match back to the signature that it
195             // was expected to, so synthesize a fake type
196             typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
197             type = QMetaType::registerType(typeName, QDBusRawTypeHandler::destroy,
198                                            QDBusRawTypeHandler::create,
199                                            QDBusRawTypeHandler::destruct,
200                                            QDBusRawTypeHandler::construct,
201                                            sizeof(void *),
202                                            QMetaType::MovableType,
203                                            0);
204         }
205
206         result.name = typeName;
207     } else if (type == QVariant::Invalid) {
208         // this case is used only by the qdbus command-line tool
209         // invalid, let's create an impossible type that contains the signature
210
211         if (signature == "av") {
212             result.name = "QVariantList";
213             type = QVariant::List;
214         } else if (signature == "a{sv}") {
215             result.name = "QVariantMap";
216             type = QVariant::Map;
217         } else {
218             result.name = "QDBusRawType::" + signature;
219             type = -1;
220         }
221     } else {
222         result.name = QVariant::typeToName( QVariant::Type(type) );
223     }
224
225     result.id = type;
226     return result;              // success
227 }
228
229 void QDBusMetaObjectGenerator::parseMethods()
230 {
231     //
232     // TODO:
233     //  Add cloned methods when the remote object has return types
234     //
235
236     QDBusIntrospection::Methods::ConstIterator method_it = data->methods.constBegin();
237     QDBusIntrospection::Methods::ConstIterator method_end = data->methods.constEnd();
238     for ( ; method_it != method_end; ++method_it) {
239         const QDBusIntrospection::Method &m = *method_it;
240         Method mm;
241
242         mm.name = m.name.toLatin1();
243         QByteArray prototype = mm.name;
244         prototype += '(';
245
246         bool ok = true;
247
248         // build the input argument list
249         for (int i = 0; i < m.inputArgs.count(); ++i) {
250             const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
251
252             Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
253             if (type.id == QVariant::Invalid) {
254                 ok = false;
255                 break;
256             }
257
258             mm.inputTypes.append(type.id);
259
260             mm.parameterNames.append(arg.name.toLatin1());
261             
262             prototype.append(type.name);
263             prototype.append(',');
264         }
265         if (!ok) continue;
266
267         // build the output argument list:
268         for (int i = 0; i < m.outputArgs.count(); ++i) {
269             const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
270
271             Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
272             if (type.id == QVariant::Invalid) {
273                 ok = false;
274                 break;
275             }
276
277             mm.outputTypes.append(type.id);
278
279             if (i != 0) {
280                 // non-const ref parameter
281                 mm.parameterNames.append(arg.name.toLatin1());
282
283                 prototype.append(type.name);
284                 prototype.append("&,");
285             }
286         }
287         if (!ok) continue;
288
289         // convert the last commas:
290         if (!mm.parameterNames.isEmpty())
291             prototype[prototype.length() - 1] = ')';
292         else
293             prototype.append(')');
294
295         // check the async tag
296         if (m.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == QLatin1String("true"))
297             mm.tag = "Q_NOREPLY";
298
299         // meta method flags
300         mm.flags = AccessPublic | MethodSlot | MethodScriptable;
301
302         // add
303         methods.insert(QMetaObject::normalizedSignature(prototype), mm);
304     }
305 }
306
307 void QDBusMetaObjectGenerator::parseSignals()
308 {
309     QDBusIntrospection::Signals::ConstIterator signal_it = data->signals_.constBegin();
310     QDBusIntrospection::Signals::ConstIterator signal_end = data->signals_.constEnd();
311     for ( ; signal_it != signal_end; ++signal_it) {
312         const QDBusIntrospection::Signal &s = *signal_it;
313         Method mm;
314
315         mm.name = s.name.toLatin1();
316         QByteArray prototype = mm.name;
317         prototype += '(';
318
319         bool ok = true;
320
321         // build the output argument list
322         for (int i = 0; i < s.outputArgs.count(); ++i) {
323             const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
324
325             Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
326             if (type.id == QVariant::Invalid) {
327                 ok = false;
328                 break;
329             }
330
331             mm.inputTypes.append(type.id);
332
333             mm.parameterNames.append(arg.name.toLatin1());
334             
335             prototype.append(type.name);
336             prototype.append(',');
337         }
338         if (!ok) continue;
339
340         // convert the last commas:
341         if (!mm.parameterNames.isEmpty())
342             prototype[prototype.length() - 1] = ')';
343         else
344             prototype.append(')');
345
346         // meta method flags
347         mm.flags = AccessProtected | MethodSignal | MethodScriptable;
348
349         // add
350         signals_.insert(QMetaObject::normalizedSignature(prototype), mm);
351     }
352 }
353
354 void QDBusMetaObjectGenerator::parseProperties()
355 {
356     QDBusIntrospection::Properties::ConstIterator prop_it = data->properties.constBegin();
357     QDBusIntrospection::Properties::ConstIterator prop_end = data->properties.constEnd();
358     for ( ; prop_it != prop_end; ++prop_it) {
359         const QDBusIntrospection::Property &p = *prop_it;
360         Property mp;
361         Type type = findType(p.type.toLatin1(), p.annotations);
362         if (type.id == QVariant::Invalid)
363             continue;
364         
365         QByteArray name = p.name.toLatin1();
366         mp.signature = p.type.toLatin1();
367         mp.type = type.id;
368         mp.typeName = type.name;
369
370         // build the flags:
371         mp.flags = StdCppSet | Scriptable | Stored | Designable;
372         if (p.access != QDBusIntrospection::Property::Write)
373             mp.flags |= Readable;
374         if (p.access != QDBusIntrospection::Property::Read)
375             mp.flags |= Writable;
376
377         // add the property:
378         properties.insert(name, mp);
379     }
380 }
381
382 // Returns the sum of all parameters (including return type) for the given
383 // \a map of methods. This is needed for calculating the size of the methods'
384 // parameter type/name meta-data.
385 int QDBusMetaObjectGenerator::aggregateParameterCount(const QMap<QByteArray, Method> &map)
386 {
387     int sum = 0;
388     QMap<QByteArray, Method>::const_iterator it;
389     for (it = map.constBegin(); it != map.constEnd(); ++it) {
390         const Method &m = it.value();
391         sum += m.inputTypes.size() + qMax(1, m.outputTypes.size());
392     }
393     return sum;
394 }
395
396 void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
397 {
398     // this code here is mostly copied from qaxbase.cpp
399     // with a few modifications to make it cleaner
400
401     QString className = interface;
402     className.replace(QLatin1Char('.'), QLatin1String("::"));
403     if (className.isEmpty())
404         className = QLatin1String("QDBusInterface");
405
406     QVarLengthArray<int> idata;
407     idata.resize(sizeof(QDBusMetaObjectPrivate) / sizeof(int));
408
409     int methodParametersDataSize =
410             ((aggregateParameterCount(signals_)
411              + aggregateParameterCount(methods)) * 2) // types and parameter names
412             - signals_.count() // return "parameters" don't have names
413             - methods.count(); // ditto
414
415     QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data());
416     Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 7, "QtDBus meta-object generator should generate the same version as moc");
417     header->revision = QMetaObjectPrivate::OutputRevision;
418     header->className = 0;
419     header->classInfoCount = 0;
420     header->classInfoData = 0;
421     header->methodCount = signals_.count() + methods.count();
422     header->methodData = idata.size();
423     header->propertyCount = properties.count();
424     header->propertyData = header->methodData + header->methodCount * 5 + methodParametersDataSize;
425     header->enumeratorCount = 0;
426     header->enumeratorData = 0;
427     header->constructorCount = 0;
428     header->constructorData = 0;
429     header->flags = RequiresVariantMetaObject;
430     header->signalCount = signals_.count();
431     // These are specific to QDBusMetaObject:
432     header->propertyDBusData = header->propertyData + header->propertyCount * 3;
433     header->methodDBusData = header->propertyDBusData + header->propertyCount * intsPerProperty;
434
435     int data_size = idata.size() +
436                     (header->methodCount * (5+intsPerMethod)) + methodParametersDataSize +
437                     (header->propertyCount * (3+intsPerProperty));
438     foreach (const Method &mm, signals_)
439         data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
440     foreach (const Method &mm, methods)
441         data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
442     idata.resize(data_size + 1);
443
444     QMetaStringTable strings;
445     strings.enter(className.toLatin1());
446
447     int offset = header->methodData;
448     int parametersOffset = offset + header->methodCount * 5;
449     int signatureOffset = header->methodDBusData;
450     int typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod;
451     idata[typeidOffset++] = 0;                           // eod
452
453     // add each method:
454     for (int x = 0; x < 2; ++x) {
455         // Signals must be added before other methods, to match moc.
456         QMap<QByteArray, Method> &map = (x == 0) ? signals_ : methods;
457         for (QMap<QByteArray, Method>::ConstIterator it = map.constBegin();
458              it != map.constEnd(); ++it) {
459             const Method &mm = it.value();
460
461             int argc = mm.inputTypes.size() + qMax(0, mm.outputTypes.size() - 1);
462
463             idata[offset++] = strings.enter(mm.name);
464             idata[offset++] = argc;
465             idata[offset++] = parametersOffset;
466             idata[offset++] = strings.enter(mm.tag);
467             idata[offset++] = mm.flags;
468
469             // Parameter types
470             for (int i = -1; i < argc; ++i) {
471                 int type;
472                 QByteArray typeName;
473                 if (i < 0) { // Return type
474                     if (!mm.outputTypes.isEmpty())
475                         type = mm.outputTypes.first();
476                     else
477                         type = QMetaType::Void;
478                 } else if (i < mm.inputTypes.size()) {
479                     type = mm.inputTypes.at(i);
480                 } else {
481                     Q_ASSERT(mm.outputTypes.size() > 1);
482                     type = mm.outputTypes.at(i - mm.inputTypes.size() + 1);
483                     // Output parameters are references; type id not available
484                     typeName = QMetaType::typeName(type);
485                     typeName.append('&');
486                 }
487                 Q_ASSERT(type != QMetaType::UnknownType);
488                 int typeInfo;
489                 if (!typeName.isEmpty())
490                     typeInfo = IsUnresolvedType | strings.enter(typeName);
491                 else
492                     typeInfo = type;
493                 idata[parametersOffset++] = typeInfo;
494             }
495             // Parameter names
496             for (int i = 0; i < argc; ++i)
497                 idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
498
499             idata[signatureOffset++] = typeidOffset;
500             idata[typeidOffset++] = mm.inputTypes.count();
501             memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.count() * sizeof(int));
502             typeidOffset += mm.inputTypes.count();
503
504             idata[signatureOffset++] = typeidOffset;
505             idata[typeidOffset++] = mm.outputTypes.count();
506             memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.count() * sizeof(int));
507             typeidOffset += mm.outputTypes.count();
508         }
509     }
510
511     Q_ASSERT(offset == header->methodData + header->methodCount * 5);
512     Q_ASSERT(parametersOffset = header->propertyData);
513     Q_ASSERT(signatureOffset == header->methodDBusData + header->methodCount * intsPerMethod);
514     Q_ASSERT(typeidOffset == idata.size());
515     offset += methodParametersDataSize;
516     Q_ASSERT(offset == header->propertyData);
517
518     // add each property
519     signatureOffset = header->propertyDBusData;
520     for (QMap<QByteArray, Property>::ConstIterator it = properties.constBegin();
521          it != properties.constEnd(); ++it) {
522         const Property &mp = it.value();
523
524         // form is name, typeinfo, flags
525         idata[offset++] = strings.enter(it.key()); // name
526         Q_ASSERT(mp.type != QMetaType::UnknownType);
527         idata[offset++] = mp.type;
528         idata[offset++] = mp.flags;
529
530         idata[signatureOffset++] = strings.enter(mp.signature);
531         idata[signatureOffset++] = mp.type;
532     }
533
534     Q_ASSERT(offset == header->propertyDBusData);
535     Q_ASSERT(signatureOffset == header->methodDBusData);
536
537     char *string_data = new char[strings.blobSize()];
538     strings.writeBlob(string_data);
539
540     uint *uint_data = new uint[idata.size()];
541     memcpy(uint_data, idata.data(), idata.size() * sizeof(int));
542
543     // put the metaobject together
544     obj->d.data = uint_data;
545     obj->d.relatedMetaObjects = 0;
546     obj->d.static_metacall = 0;
547     obj->d.extradata = 0;
548     obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data);
549     obj->d.superdata = &QDBusAbstractInterface::staticMetaObject;
550 }
551
552 #if 0
553 void QDBusMetaObjectGenerator::writeWithoutXml(const QString &interface)
554 {
555     // no XML definition
556     QString tmp(interface);
557     tmp.replace(QLatin1Char('.'), QLatin1String("::"));
558     QByteArray name(tmp.toLatin1());
559
560     QDBusMetaObjectPrivate *header = new QDBusMetaObjectPrivate;
561     memset(header, 0, sizeof *header);
562     header->revision = 1;
563     // leave the rest with 0
564
565     char *stringdata = new char[name.length() + 1];
566     stringdata[name.length()] = '\0';
567     
568     d.data = reinterpret_cast<uint*>(header);
569     d.relatedMetaObjects = 0;
570     d.static_metacall = 0;
571     d.extradata = 0;
572     d.stringdata = stringdata;
573     d.superdata = &QDBusAbstractInterface::staticMetaObject;
574     cached = false;
575 }
576 #endif
577
578 /////////
579 // class QDBusMetaObject
580
581 QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, const QString &xml,
582                                                    QHash<QString, QDBusMetaObject *> &cache,
583                                                    QDBusError &error)
584 {
585     error = QDBusError();
586     QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml);
587
588     QDBusMetaObject *we = 0;
589     QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin();
590     QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd();
591     for ( ; it != end; ++it) {
592         // check if it's in the cache
593         bool us = it.key() == interface;
594
595         QDBusMetaObject *obj = cache.value(it.key(), 0);
596         if ( !obj && ( us || !interface.startsWith( QLatin1String("local.") ) ) ) {
597             // not in cache; create
598             obj = new QDBusMetaObject;
599             QDBusMetaObjectGenerator generator(it.key(), it.value().constData());
600             generator.write(obj);
601
602             if ( (obj->cached = !it.key().startsWith( QLatin1String("local.") )) )
603                 // cache it
604                 cache.insert(it.key(), obj);
605             else if (!us)
606                 delete obj;
607
608         }
609
610         if (us)
611             // it's us
612             we = obj;
613     }
614
615     if (we)
616         return we;
617     // still nothing?
618     
619     if (parsed.isEmpty()) {
620         // object didn't return introspection
621         we = new QDBusMetaObject;
622         QDBusMetaObjectGenerator generator(interface, 0);
623         generator.write(we);
624         we->cached = false;
625         return we;
626     } else if (interface.isEmpty()) {
627         // merge all interfaces
628         it = parsed.constBegin();
629         QDBusIntrospection::Interface merged = *it.value().constData();
630  
631         for (++it; it != end; ++it) {
632             merged.annotations.unite(it.value()->annotations);
633             merged.methods.unite(it.value()->methods);
634             merged.signals_.unite(it.value()->signals_);
635             merged.properties.unite(it.value()->properties);
636         }
637
638         merged.name = QLatin1String("local.Merged");
639         merged.introspection.clear();
640
641         we = new QDBusMetaObject;
642         QDBusMetaObjectGenerator generator(merged.name, &merged);
643         generator.write(we);
644         we->cached = false;
645         return we;
646     }
647
648     // mark as an error
649     error = QDBusError(QDBusError::UnknownInterface,
650         QString::fromLatin1("Interface '%1' was not found")
651                        .arg(interface));
652     return 0;
653 }
654
655 QDBusMetaObject::QDBusMetaObject()
656 {
657 }
658
659 static inline const QDBusMetaObjectPrivate *priv(const uint* data)
660 {
661     return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
662 }
663
664 const int *QDBusMetaObject::inputTypesForMethod(int id) const
665 {
666     //id -= methodOffset();
667     if (id >= 0 && id < priv(d.data)->methodCount) {
668         int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
669         return reinterpret_cast<const int*>(d.data + d.data[handle]);
670     }
671     return 0;
672 }
673
674 const int *QDBusMetaObject::outputTypesForMethod(int id) const
675 {
676     //id -= methodOffset();
677     if (id >= 0 && id < priv(d.data)->methodCount) {
678         int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
679         return reinterpret_cast<const int*>(d.data + d.data[handle + 1]);
680     }
681     return 0;
682 }
683
684 int QDBusMetaObject::propertyMetaType(int id) const
685 {
686     //id -= propertyOffset();
687     if (id >= 0 && id < priv(d.data)->propertyCount) {
688         int handle = priv(d.data)->propertyDBusData + id*intsPerProperty;
689         return d.data[handle + 1];
690     }
691     return 0;
692 }
693
694 QT_END_NAMESPACE
695
696 #endif // QT_NO_DBUS