| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include <string.h> | - |
| 41 | | - |
| 42 | #ifndef QT_BOOTSTRAPPED | - |
| 43 | #include <QtCore/qcoreapplication.h> | - |
| 44 | #include <QtCore/qvariant.h> | - |
| 45 | #include <QtCore/qmetaobject.h> | - |
| 46 | | - |
| 47 | #include "qdbusutil_p.h" | - |
| 48 | #include "qdbusconnection_p.h" | - |
| 49 | #include "qdbusabstractadaptor_p.h" // for QCLASSINFO_DBUS_* | - |
| 50 | #endif | - |
| 51 | #include <QtCore/qvector.h> | - |
| 52 | #include "qdbusmetatype_p.h" | - |
| 53 | | - |
| 54 | #ifndef QT_NO_DBUS | - |
| 55 | | - |
| 56 | QT_BEGIN_NAMESPACE | - |
| 57 | | - |
| 58 | bool qDBusCheckAsyncTag(const char *tag) | - |
| 59 | { | - |
| 60 | static const char noReplyTag[] = "Q_NOREPLY"; | - |
| 61 | if (!tag || !*tag) | - |
| 62 | return false; | - |
| 63 | | - |
| 64 | const char *p = strstr(tag, noReplyTag); | - |
| 65 | if (p != NULL && | - |
| 66 | (p == tag || *(p-1) == ' ') && | - |
| 67 | (p[sizeof noReplyTag - 1] == '\0' || p[sizeof noReplyTag - 1] == ' ')) | - |
| 68 | return true; | - |
| 69 | | - |
| 70 | return false; | - |
| 71 | } | - |
| 72 | | - |
| 73 | #ifndef QT_BOOTSTRAPPED | - |
| 74 | | - |
| 75 | QString qDBusInterfaceFromMetaObject(const QMetaObject *mo) | - |
| 76 | { | - |
| 77 | QString interface; | - |
| 78 | | - |
| 79 | int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); | - |
| 80 | if (idx >= mo->classInfoOffset()) {| TRUE | evaluated 1977 times by 10 testsEvaluated by:- tst_qdbusabstractadaptor - unknown status
- tst_qdbusabstractinterface - unknown status
- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
- tst_qdbuscontext - unknown status
- tst_qdbuscpp2xml - unknown status
- tst_qdbusinterface - unknown status
- tst_qdbusmarshall - unknown status
- tst_qdbusthreading - unknown status
| | FALSE | evaluated 6 times by 3 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
|
| 6-1977 |
| 81 | interface = QLatin1String(mo->classInfo(idx).value()); | - |
| 82 | } else {executed 1977 times by 10 tests: end of blockExecuted by:- tst_qdbusabstractadaptor - unknown status
- tst_qdbusabstractinterface - unknown status
- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
- tst_qdbuscontext - unknown status
- tst_qdbuscpp2xml - unknown status
- tst_qdbusinterface - unknown status
- tst_qdbusmarshall - unknown status
- tst_qdbusthreading - unknown status
| 1977 |
| 83 | interface = QLatin1String(mo->className()); | - |
| 84 | interface.replace(QLatin1String("::"), QLatin1String(".")); | - |
| 85 | | - |
| 86 | if (interface.startsWith(QLatin1String("QDBus"))) {| TRUE | never evaluated | | FALSE | evaluated 6 times by 3 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
|
| 0-6 |
| 87 | interface.prepend(QLatin1String("org.qtproject.QtDBus.")); | - |
| 88 | } else if (interface.startsWith(QLatin1Char('Q')) && never executed: end of block | TRUE | never evaluated | | FALSE | evaluated 6 times by 3 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
|
| 0-6 |
| 89 | interface.length() >= 2 && interface.at(1).isUpper()) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 90 | | - |
| 91 | interface.prepend(QLatin1String("org.qtproject.Qt.")); | - |
| 92 | } else if (!QCoreApplication::instance()|| never executed: end of block | TRUE | evaluated 2 times by 1 testEvaluated by:- tst_qdbusconnection_no_app - unknown status
| | FALSE | evaluated 4 times by 2 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_spyhook - unknown status
|
| 0-4 |
| 93 | QCoreApplication::instance()->applicationName().isEmpty()) {| TRUE | never evaluated | | FALSE | evaluated 4 times by 2 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_spyhook - unknown status
|
| 0-4 |
| 94 | interface.prepend(QLatin1String("local.")); | - |
| 95 | } else {executed 2 times by 1 test: end of blockExecuted by:- tst_qdbusconnection_no_app - unknown status
| 2 |
| 96 | interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName()); | - |
| 97 | QStringList domainNameconst QString organizationDomain = QCoreApplication::instance()->organizationDomain().split(); | - |
| 98 | const auto domainName = organizationDomain.splitRef(QLatin1Char('.'), QString::SkipEmptyParts); | - |
| 99 | if (domainName.isEmpty()) {| TRUE | evaluated 4 times by 2 testsEvaluated by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_spyhook - unknown status
| | FALSE | never evaluated |
| 0-4 |
| 100 | interface.prepend(QLatin1String("local.")); | - |
| 101 | } else {executed 4 times by 2 tests: end of blockExecuted by:- tst_qdbusconnection - unknown status
- tst_qdbusconnection_spyhook - unknown status
| 4 |
| 102 | QString composedDomain; | - |
| 103 | | - |
| 104 | | - |
| 105 | composedDomain.reserve(organizationDomain.size() + 1); | - |
| 106 | for (int iauto it = 0; i <domainName.countrbegin(), end = domainName.rend(); it != end; ++iit)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 107 | interface.prepend(composedDomain += *it + QLatin1Char('.')).prepend(domainName); never executed: composedDomain += *it + QLatin1Char('.'); | 0 |
| 108 | | - |
| 109 | interface.atprepend(i));composedDomain); | - |
| 110 | } never executed: end of block | 0 |
| 111 | } | - |
| 112 | } | - |
| 113 | | - |
| 114 | return interface;executed 1983 times by 10 tests: return interface;Executed by:- tst_qdbusabstractadaptor - unknown status
- tst_qdbusabstractinterface - unknown status
- tst_qdbusconnection - unknown status
- tst_qdbusconnection_no_app - unknown status
- tst_qdbusconnection_spyhook - unknown status
- tst_qdbuscontext - unknown status
- tst_qdbuscpp2xml - unknown status
- tst_qdbusinterface - unknown status
- tst_qdbusmarshall - unknown status
- tst_qdbusthreading - unknown status
| 1983 |
| 115 | } | - |
| 116 | | - |
| 117 | bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name) | - |
| 118 | { | - |
| 119 | const QMetaObject *mo = obj->metaObject(); | - |
| 120 | for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass()) | - |
| 121 | if (interface_name == qDBusInterfaceFromMetaObject(mo)) | - |
| 122 | return true; | - |
| 123 | return false; | - |
| 124 | } | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | int qDBusParametersForMethod(const QMetaMethod &mm, QVector<int> &metaTypes, QString &errorMsg) | - |
| 139 | { | - |
| 140 | return qDBusParametersForMethod(mm.parameterTypes(), metaTypes, errorMsg); | - |
| 141 | } | - |
| 142 | | - |
| 143 | #endif // QT_BOOTSTRAPPED | - |
| 144 | | - |
| 145 | int qDBusParametersForMethod(const QList<QByteArray> ¶meterTypes, QVector<int>& metaTypes, QString &errorMsg) | - |
| 146 | { | - |
| 147 | QDBusMetaTypeId::init(); | - |
| 148 | metaTypes.clear(); | - |
| 149 | | - |
| 150 | metaTypes.append(0); | - |
| 151 | int inputCount = 0; | - |
| 152 | bool seenMessage = false; | - |
| 153 | QList<QByteArray>::ConstIterator it = parameterTypes.constBegin(); | - |
| 154 | QList<QByteArray>::ConstIterator end = parameterTypes.constEnd(); | - |
| 155 | for ( ; it != end; ++it) { | - |
| 156 | const QByteArray &type = *it; | - |
| 157 | if (type.endsWith('*')) { | - |
| 158 | errorMsg = QLatin1String("Pointers are not supported: ") + QLatin1String(type); | - |
| 159 | return -1; | - |
| 160 | } | - |
| 161 | | - |
| 162 | if (type.endsWith('&')) { | - |
| 163 | QByteArray basictype = type; | - |
| 164 | basictype.truncate(type.length() - 1); | - |
| 165 | | - |
| 166 | int id = QMetaType::type(basictype); | - |
| 167 | if (id == 0) { | - |
| 168 | errorMsg = QLatin1String("Unregistered output type in parameter list: ") + QLatin1String(type); | - |
| 169 | return -1; | - |
| 170 | } else if (QDBusMetaType::typeToSignature(id) == 0) | - |
| 171 | return -1; | - |
| 172 | | - |
| 173 | metaTypes.append( id ); | - |
| 174 | seenMessage = true; | - |
| 175 | continue; | - |
| 176 | } | - |
| 177 | | - |
| 178 | if (seenMessage) { | - |
| 179 | errorMsg = QLatin1String("Invalid method, non-output parameters after message or after output parameters: ") + QLatin1String(type); | - |
| 180 | return -1; | - |
| 181 | } | - |
| 182 | | - |
| 183 | int id = QMetaType::type(type); | - |
| 184 | if (id == QMetaType::UnknownType) { | - |
| 185 | errorMsg = QLatin1String("Unregistered input type in parameter list: ") + QLatin1String(type); | - |
| 186 | return -1; | - |
| 187 | } | - |
| 188 | | - |
| 189 | if (id == QDBusMetaTypeId::message()) | - |
| 190 | seenMessage = true; | - |
| 191 | else if (QDBusMetaType::typeToSignature(id) == 0) { | - |
| 192 | errorMsg = QLatin1String("Type not registered with QtDBus in parameter list: ") + QLatin1String(type); | - |
| 193 | return -1; | - |
| 194 | } | - |
| 195 | | - |
| 196 | metaTypes.append(id); | - |
| 197 | ++inputCount; | - |
| 198 | } | - |
| 199 | | - |
| 200 | return inputCount; | - |
| 201 | } | - |
| 202 | | - |
| 203 | QT_END_NAMESPACE | - |
| 204 | | - |
| 205 | #endif // QT_NO_DBUS | - |
| | |