| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qfactoryloader_p.h" | - |
| 43 | | - |
| 44 | #ifndef QT_NO_LIBRARY | - |
| 45 | #include "qfactoryinterface.h" | - |
| 46 | #include "qmap.h" | - |
| 47 | #include <qdir.h> | - |
| 48 | #include <qdebug.h> | - |
| 49 | #include "qmutex.h" | - |
| 50 | #include "qplugin.h" | - |
| 51 | #include "qpluginloader.h" | - |
| 52 | #include "private/qobject_p.h" | - |
| 53 | #include "private/qcoreapplication_p.h" | - |
| 54 | #include "qjsondocument.h" | - |
| 55 | #include "qjsonvalue.h" | - |
| 56 | #include "qjsonobject.h" | - |
| 57 | #include "qjsonarray.h" | - |
| 58 | | - |
| 59 | QT_BEGIN_NAMESPACE | - |
| 60 | | - |
| 61 | Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders) never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:1089 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:23 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:23 | yes Evaluation Count:1066 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-1089 |
| 62 | | - |
| 63 | Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_factoryloader_mutex, (QMutex::Recursive)) never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:1089 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:23 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:23 | yes Evaluation Count:1066 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-1089 |
| 64 | | - |
| 65 | class QFactoryLoaderPrivate : public QObjectPrivate | - |
| 66 | { | - |
| 67 | Q_DECLARE_PUBLIC(QFactoryLoader) | - |
| 68 | public: | - |
| 69 | QFactoryLoaderPrivate(){} | - |
| 70 | ~QFactoryLoaderPrivate(); | - |
| 71 | mutable QMutex mutex; | - |
| 72 | QByteArray iid; | - |
| 73 | QList<QLibraryPrivate*> libraryList; | - |
| 74 | QMap<QString,QLibraryPrivate*> keyMap; | - |
| 75 | QStringList keyList; | - |
| 76 | QString suffix; | - |
| 77 | Qt::CaseSensitivity cs; | - |
| 78 | QStringList loadedPaths; | - |
| 79 | | - |
| 80 | void unloadPath(const QString &path); | - |
| 81 | }; | - |
| 82 | | - |
| 83 | QFactoryLoaderPrivate::~QFactoryLoaderPrivate() | - |
| 84 | { | - |
| 85 | for (int i = 0; i < libraryList.count(); ++i) { evaluated: i < libraryList.count()| yes Evaluation Count:1918 | yes Evaluation Count:979 |
| 979-1918 |
| 86 | QLibraryPrivate *library = libraryList.at(i); executed (the execution status of this line is deduced): QLibraryPrivate *library = libraryList.at(i); | - |
| 87 | library->unload(); executed (the execution status of this line is deduced): library->unload(); | - |
| 88 | library->release(); executed (the execution status of this line is deduced): library->release(); | - |
| 89 | } executed: }Execution Count:1918 | 1918 |
| 90 | } executed: }Execution Count:979 | 979 |
| 91 | | - |
| 92 | QFactoryLoader::QFactoryLoader(const char *iid, | - |
| 93 | const QString &suffix, | - |
| 94 | Qt::CaseSensitivity cs) | - |
| 95 | : QObject(*new QFactoryLoaderPrivate) | - |
| 96 | { | - |
| 97 | moveToThread(QCoreApplicationPrivate::mainThread()); executed (the execution status of this line is deduced): moveToThread(QCoreApplicationPrivate::mainThread()); | - |
| 98 | Q_D(QFactoryLoader); executed (the execution status of this line is deduced): QFactoryLoaderPrivate * const d = d_func(); | - |
| 99 | d->iid = iid; executed (the execution status of this line is deduced): d->iid = iid; | - |
| 100 | d->cs = cs; executed (the execution status of this line is deduced): d->cs = cs; | - |
| 101 | d->suffix = suffix; executed (the execution status of this line is deduced): d->suffix = suffix; | - |
| 102 | | - |
| 103 | | - |
| 104 | QMutexLocker locker(qt_factoryloader_mutex()); executed (the execution status of this line is deduced): QMutexLocker locker(qt_factoryloader_mutex()); | - |
| 105 | update(); executed (the execution status of this line is deduced): update(); | - |
| 106 | qt_factory_loaders()->append(this); executed (the execution status of this line is deduced): qt_factory_loaders()->append(this); | - |
| 107 | } executed: }Execution Count:104 | 104 |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | void QFactoryLoader::update() | - |
| 112 | { | - |
| 113 | #ifdef QT_SHARED | - |
| 114 | Q_D(QFactoryLoader); executed (the execution status of this line is deduced): QFactoryLoaderPrivate * const d = d_func(); | - |
| 115 | QStringList paths = QCoreApplication::libraryPaths(); executed (the execution status of this line is deduced): QStringList paths = QCoreApplication::libraryPaths(); | - |
| 116 | for (int i = 0; i < paths.count(); ++i) { evaluated: i < paths.count()| yes Evaluation Count:248 | yes Evaluation Count:128 |
| 128-248 |
| 117 | const QString &pluginDir = paths.at(i); executed (the execution status of this line is deduced): const QString &pluginDir = paths.at(i); | - |
| 118 | // Already loaded, skip it... | - |
| 119 | if (d->loadedPaths.contains(pluginDir)) evaluated: d->loadedPaths.contains(pluginDir)| yes Evaluation Count:30 | yes Evaluation Count:218 |
| 30-218 |
| 120 | continue; executed: continue;Execution Count:30 | 30 |
| 121 | d->loadedPaths << pluginDir; executed (the execution status of this line is deduced): d->loadedPaths << pluginDir; | - |
| 122 | | - |
| 123 | QString path = pluginDir + d->suffix; executed (the execution status of this line is deduced): QString path = pluginDir + d->suffix; | - |
| 124 | if (!QDir(path).exists(QLatin1String("."))) evaluated: !QDir(path).exists(QLatin1String("."))| yes Evaluation Count:139 | yes Evaluation Count:79 |
| 79-139 |
| 125 | continue; executed: continue;Execution Count:139 | 139 |
| 126 | | - |
| 127 | QStringList plugins = QDir(path).entryList(QDir::Files); executed (the execution status of this line is deduced): QStringList plugins = QDir(path).entryList(QDir::Files); | - |
| 128 | QLibraryPrivate *library = 0; executed (the execution status of this line is deduced): QLibraryPrivate *library = 0; | - |
| 129 | | - |
| 130 | #ifdef Q_OS_MAC | - |
| 131 | // Loading both the debug and release version of the cocoa plugins causes the objective-c runtime | - |
| 132 | // to print "duplicate class definitions" warnings. Detect if QFactoryLoader is about to load both, | - |
| 133 | // skip one of them (below). | - |
| 134 | // | - |
| 135 | // ### FIXME find a proper solution | - |
| 136 | // | - |
| 137 | const bool isLoadingDebugAndReleaseCocoa = plugins.contains("libqcocoa_debug.dylib") && plugins.contains("libqcocoa.dylib"); | - |
| 138 | #endif | - |
| 139 | for (int j = 0; j < plugins.count(); ++j) { evaluated: j < plugins.count()| yes Evaluation Count:498 | yes Evaluation Count:79 |
| 79-498 |
| 140 | QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); executed (the execution status of this line is deduced): QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); | - |
| 141 | | - |
| 142 | #ifdef Q_OS_MAC | - |
| 143 | if (isLoadingDebugAndReleaseCocoa) { | - |
| 144 | #ifdef QT_DEBUG | - |
| 145 | if (fileName.contains(QStringLiteral("libqcocoa.dylib"))) | - |
| 146 | continue; // Skip release plugin in debug mode | - |
| 147 | #else | - |
| 148 | if (fileName.contains(QStringLiteral("libqcocoa_debug.dylib"))) | - |
| 149 | continue; // Skip debug plugin in release mode | - |
| 150 | #endif | - |
| 151 | } | - |
| 152 | #endif | - |
| 153 | if (qt_debug_component()) { partially evaluated: qt_debug_component()| no Evaluation Count:0 | yes Evaluation Count:498 |
| 0-498 |
| 154 | qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; never executed (the execution status of this line is deduced): QMessageLogger("plugin/qfactoryloader.cpp", 154, __PRETTY_FUNCTION__).debug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; | - |
| 155 | } | 0 |
| 156 | library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); executed (the execution status of this line is deduced): library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); | - |
| 157 | if (!library->isPlugin()) { evaluated: !library->isPlugin()| yes Evaluation Count:249 | yes Evaluation Count:249 |
| 249 |
| 158 | if (qt_debug_component()) { partially evaluated: qt_debug_component()| no Evaluation Count:0 | yes Evaluation Count:249 |
| 0-249 |
| 159 | qDebug() << library->errorString; never executed (the execution status of this line is deduced): QMessageLogger("plugin/qfactoryloader.cpp", 159, __PRETTY_FUNCTION__).debug() << library->errorString; | - |
| 160 | qDebug() << " not a plugin"; never executed (the execution status of this line is deduced): QMessageLogger("plugin/qfactoryloader.cpp", 160, __PRETTY_FUNCTION__).debug() << " not a plugin"; | - |
| 161 | } | 0 |
| 162 | library->release(); executed (the execution status of this line is deduced): library->release(); | - |
| 163 | continue; executed: continue;Execution Count:249 | 249 |
| 164 | } | - |
| 165 | | - |
| 166 | QStringList keys; executed (the execution status of this line is deduced): QStringList keys; | - |
| 167 | bool metaDataOk = false; executed (the execution status of this line is deduced): bool metaDataOk = false; | - |
| 168 | | - |
| 169 | QString iid = library->metaData.value(QLatin1String("IID")).toString(); executed (the execution status of this line is deduced): QString iid = library->metaData.value(QLatin1String("IID")).toString(); | - |
| 170 | if (iid == QLatin1String(d->iid.constData(), d->iid.size())) { evaluated: iid == QLatin1String(d->iid.constData(), d->iid.size())| yes Evaluation Count:247 | yes Evaluation Count:2 |
| 2-247 |
| 171 | QJsonObject object = library->metaData.value(QLatin1String("MetaData")).toObject(); executed (the execution status of this line is deduced): QJsonObject object = library->metaData.value(QLatin1String("MetaData")).toObject(); | - |
| 172 | metaDataOk = true; executed (the execution status of this line is deduced): metaDataOk = true; | - |
| 173 | | - |
| 174 | QJsonArray k = object.value(QLatin1String("Keys")).toArray(); executed (the execution status of this line is deduced): QJsonArray k = object.value(QLatin1String("Keys")).toArray(); | - |
| 175 | for (int i = 0; i < k.size(); ++i) { evaluated: i < k.size()| yes Evaluation Count:366 | yes Evaluation Count:247 |
| 247-366 |
| 176 | QString s = k.at(i).toString(); executed (the execution status of this line is deduced): QString s = k.at(i).toString(); | - |
| 177 | keys += s; executed (the execution status of this line is deduced): keys += s; | - |
| 178 | } executed: }Execution Count:366 | 366 |
| 179 | } executed: }Execution Count:247 | 247 |
| 180 | if (qt_debug_component()) partially evaluated: qt_debug_component()| no Evaluation Count:0 | yes Evaluation Count:249 |
| 0-249 |
| 181 | qDebug() << "Got keys from plugin meta data" << keys; never executed: QMessageLogger("plugin/qfactoryloader.cpp", 181, __PRETTY_FUNCTION__).debug() << "Got keys from plugin meta data" << keys; | 0 |
| 182 | | - |
| 183 | | - |
| 184 | if (!metaDataOk) { evaluated: !metaDataOk| yes Evaluation Count:2 | yes Evaluation Count:247 |
| 2-247 |
| 185 | library->release(); executed (the execution status of this line is deduced): library->release(); | - |
| 186 | continue; executed: continue;Execution Count:2 | 2 |
| 187 | } | - |
| 188 | | - |
| 189 | d->libraryList += library; executed (the execution status of this line is deduced): d->libraryList += library; | - |
| 190 | for (int k = 0; k < keys.count(); ++k) { evaluated: k < keys.count()| yes Evaluation Count:366 | yes Evaluation Count:247 |
| 247-366 |
| 191 | // first come first serve, unless the first | - |
| 192 | // library was built with a future Qt version, | - |
| 193 | // whereas the new one has a Qt version that fits | - |
| 194 | // better | - |
| 195 | QString key = keys.at(k); executed (the execution status of this line is deduced): QString key = keys.at(k); | - |
| 196 | if (!d->cs) evaluated: !d->cs| yes Evaluation Count:31 | yes Evaluation Count:335 |
| 31-335 |
| 197 | key = key.toLower(); executed: key = key.toLower();Execution Count:31 | 31 |
| 198 | QLibraryPrivate *previous = d->keyMap.value(key); executed (the execution status of this line is deduced): QLibraryPrivate *previous = d->keyMap.value(key); | - |
| 199 | int prev_qt_version = 0; executed (the execution status of this line is deduced): int prev_qt_version = 0; | - |
| 200 | if (previous) { partially evaluated: previous| no Evaluation Count:0 | yes Evaluation Count:366 |
| 0-366 |
| 201 | prev_qt_version = (int)previous->metaData.value(QLatin1String("version")).toDouble(); never executed (the execution status of this line is deduced): prev_qt_version = (int)previous->metaData.value(QLatin1String("version")).toDouble(); | - |
| 202 | } | 0 |
| 203 | int qt_version = (int)library->metaData.value(QLatin1String("version")).toDouble(); executed (the execution status of this line is deduced): int qt_version = (int)library->metaData.value(QLatin1String("version")).toDouble(); | - |
| 204 | if (!previous || (prev_qt_version > QT_VERSION && qt_version <= QT_VERSION)) { partially evaluated: !previous| yes Evaluation Count:366 | no Evaluation Count:0 |
never evaluated: prev_qt_version > 0x050002 never evaluated: qt_version <= 0x050002 | 0-366 |
| 205 | d->keyMap[key] = library; executed (the execution status of this line is deduced): d->keyMap[key] = library; | - |
| 206 | d->keyList += keys.at(k); executed (the execution status of this line is deduced): d->keyList += keys.at(k); | - |
| 207 | } executed: }Execution Count:366 | 366 |
| 208 | } executed: }Execution Count:366 | 366 |
| 209 | } executed: }Execution Count:247 | 247 |
| 210 | } executed: }Execution Count:79 | 79 |
| 211 | #else | - |
| 212 | Q_D(QFactoryLoader); | - |
| 213 | if (qt_debug_component()) { | - |
| 214 | qDebug() << "QFactoryLoader::QFactoryLoader() ignoring" << d->iid | - |
| 215 | << "since plugins are disabled in static builds"; | - |
| 216 | } | - |
| 217 | #endif | - |
| 218 | } executed: }Execution Count:128 | 128 |
| 219 | | - |
| 220 | QFactoryLoader::~QFactoryLoader() | - |
| 221 | { | - |
| 222 | QMutexLocker locker(qt_factoryloader_mutex()); executed (the execution status of this line is deduced): QMutexLocker locker(qt_factoryloader_mutex()); | - |
| 223 | qt_factory_loaders()->removeAll(this); executed (the execution status of this line is deduced): qt_factory_loaders()->removeAll(this); | - |
| 224 | } executed: }Execution Count:979 | 979 |
| 225 | | - |
| 226 | QList<QJsonObject> QFactoryLoader::metaData() const | - |
| 227 | { | - |
| 228 | Q_D(const QFactoryLoader); executed (the execution status of this line is deduced): const QFactoryLoaderPrivate * const d = d_func(); | - |
| 229 | QMutexLocker locker(&d->mutex); executed (the execution status of this line is deduced): QMutexLocker locker(&d->mutex); | - |
| 230 | QList<QJsonObject> metaData; executed (the execution status of this line is deduced): QList<QJsonObject> metaData; | - |
| 231 | for (int i = 0; i < d->libraryList.size(); ++i) evaluated: i < d->libraryList.size()| yes Evaluation Count:11129 | yes Evaluation Count:6231 |
| 6231-11129 |
| 232 | metaData.append(d->libraryList.at(i)->metaData); executed: metaData.append(d->libraryList.at(i)->metaData);Execution Count:11129 | 11129 |
| 233 | | - |
| 234 | QVector<QStaticPlugin> staticPlugins = QLibraryPrivate::staticPlugins(); executed (the execution status of this line is deduced): QVector<QStaticPlugin> staticPlugins = QLibraryPrivate::staticPlugins(); | - |
| 235 | for (int i = 0; i < staticPlugins.count(); ++i) { evaluated: i < staticPlugins.count()| yes Evaluation Count:8 | yes Evaluation Count:6231 |
| 8-6231 |
| 236 | const char *rawMetaData = staticPlugins.at(i).metaData(); executed (the execution status of this line is deduced): const char *rawMetaData = staticPlugins.at(i).metaData(); | - |
| 237 | QJsonObject object = QLibraryPrivate::fromRawMetaData(rawMetaData).object(); executed (the execution status of this line is deduced): QJsonObject object = QLibraryPrivate::fromRawMetaData(rawMetaData).object(); | - |
| 238 | if (object.value(QLatin1String("IID")) != QLatin1String(d->iid.constData(), d->iid.size())) evaluated: object.value(QLatin1String("IID")) != QLatin1String(d->iid.constData(), d->iid.size())| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 239 | continue; executed: continue;Execution Count:6 | 6 |
| 240 | | - |
| 241 | metaData.append(object); executed (the execution status of this line is deduced): metaData.append(object); | - |
| 242 | } executed: }Execution Count:2 | 2 |
| 243 | return metaData; executed: return metaData;Execution Count:6231 | 6231 |
| 244 | } | - |
| 245 | | - |
| 246 | QObject *QFactoryLoader::instance(int index) const | - |
| 247 | { | - |
| 248 | Q_D(const QFactoryLoader); executed (the execution status of this line is deduced): const QFactoryLoaderPrivate * const d = d_func(); | - |
| 249 | if (index < 0) partially evaluated: index < 0| no Evaluation Count:0 | yes Evaluation Count:10534 |
| 0-10534 |
| 250 | return 0; never executed: return 0; | 0 |
| 251 | | - |
| 252 | if (index < d->libraryList.size()) { evaluated: index < d->libraryList.size()| yes Evaluation Count:8745 | yes Evaluation Count:1789 |
| 1789-8745 |
| 253 | QLibraryPrivate *library = d->libraryList.at(index); executed (the execution status of this line is deduced): QLibraryPrivate *library = d->libraryList.at(index); | - |
| 254 | if (library->instance || library->loadPlugin()) { evaluated: library->instance| yes Evaluation Count:8587 | yes Evaluation Count:158 |
partially evaluated: library->loadPlugin()| yes Evaluation Count:158 | no Evaluation Count:0 |
| 0-8587 |
| 255 | if (!library->inst) evaluated: !library->inst| yes Evaluation Count:158 | yes Evaluation Count:8587 |
| 158-8587 |
| 256 | library->inst = library->instance(); executed: library->inst = library->instance();Execution Count:158 | 158 |
| 257 | QObject *obj = library->inst.data(); executed (the execution status of this line is deduced): QObject *obj = library->inst.data(); | - |
| 258 | if (obj) { partially evaluated: obj| yes Evaluation Count:8745 | no Evaluation Count:0 |
| 0-8745 |
| 259 | if (!obj->parent()) partially evaluated: !obj->parent()| yes Evaluation Count:8745 | no Evaluation Count:0 |
| 0-8745 |
| 260 | obj->moveToThread(QCoreApplicationPrivate::mainThread()); executed: obj->moveToThread(QCoreApplicationPrivate::mainThread());Execution Count:8745 | 8745 |
| 261 | return obj; executed: return obj;Execution Count:8745 | 8745 |
| 262 | } | - |
| 263 | } | 0 |
| 264 | return 0; never executed: return 0; | 0 |
| 265 | } | - |
| 266 | | - |
| 267 | index -= d->libraryList.size(); executed (the execution status of this line is deduced): index -= d->libraryList.size(); | - |
| 268 | QVector<QStaticPlugin> staticPlugins = QLibraryPrivate::staticPlugins(); executed (the execution status of this line is deduced): QVector<QStaticPlugin> staticPlugins = QLibraryPrivate::staticPlugins(); | - |
| 269 | for (int i = 0; i < staticPlugins.count(); ++i) { evaluated: i < staticPlugins.count()| yes Evaluation Count:1 | yes Evaluation Count:1788 |
| 1-1788 |
| 270 | const char *rawMetaData = staticPlugins.at(i).metaData(); executed (the execution status of this line is deduced): const char *rawMetaData = staticPlugins.at(i).metaData(); | - |
| 271 | QJsonObject object = QLibraryPrivate::fromRawMetaData(rawMetaData).object(); executed (the execution status of this line is deduced): QJsonObject object = QLibraryPrivate::fromRawMetaData(rawMetaData).object(); | - |
| 272 | if (object.value(QLatin1String("IID")) != QLatin1String(d->iid.constData(), d->iid.size())) partially evaluated: object.value(QLatin1String("IID")) != QLatin1String(d->iid.constData(), d->iid.size())| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 273 | continue; never executed: continue; | 0 |
| 274 | | - |
| 275 | if (index == 0) partially evaluated: index == 0| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 276 | return staticPlugins.at(i).instance(); executed: return staticPlugins.at(i).instance();Execution Count:1 | 1 |
| 277 | --index; never executed (the execution status of this line is deduced): --index; | - |
| 278 | } | 0 |
| 279 | | - |
| 280 | return 0; executed: return 0;Execution Count:1788 | 1788 |
| 281 | } | - |
| 282 | | - |
| 283 | #if defined(Q_OS_UNIX) && !defined (Q_OS_MAC) | - |
| 284 | QLibraryPrivate *QFactoryLoader::library(const QString &key) const | - |
| 285 | { | - |
| 286 | Q_D(const QFactoryLoader); never executed (the execution status of this line is deduced): const QFactoryLoaderPrivate * const d = d_func(); | - |
| 287 | return d->keyMap.value(d->cs ? key : key.toLower()); never executed: return d->keyMap.value(d->cs ? key : key.toLower()); | 0 |
| 288 | } | - |
| 289 | #endif | - |
| 290 | | - |
| 291 | void QFactoryLoader::refreshAll() | - |
| 292 | { | - |
| 293 | QMutexLocker locker(qt_factoryloader_mutex()); executed (the execution status of this line is deduced): QMutexLocker locker(qt_factoryloader_mutex()); | - |
| 294 | QList<QFactoryLoader *> *loaders = qt_factory_loaders(); executed (the execution status of this line is deduced): QList<QFactoryLoader *> *loaders = qt_factory_loaders(); | - |
| 295 | for (QList<QFactoryLoader *>::const_iterator it = loaders->constBegin(); executed (the execution status of this line is deduced): for (QList<QFactoryLoader *>::const_iterator it = loaders->constBegin(); | - |
| 296 | it != loaders->constEnd(); ++it) { evaluated: it != loaders->constEnd()| yes Evaluation Count:24 | yes Evaluation Count:6 |
| 6-24 |
| 297 | (*it)->update(); executed (the execution status of this line is deduced): (*it)->update(); | - |
| 298 | } executed: }Execution Count:24 | 24 |
| 299 | } executed: }Execution Count:6 | 6 |
| 300 | | - |
| 301 | QMultiMap<int, QString> QFactoryLoader::keyMap() const | - |
| 302 | { | - |
| 303 | QMultiMap<int, QString> result; executed (the execution status of this line is deduced): QMultiMap<int, QString> result; | - |
| 304 | const QString metaDataKey = QStringLiteral("MetaData"); executed (the execution status of this line is deduced): const QString metaDataKey = QString::fromUtf8("" "MetaData" "", sizeof("MetaData") - 1); | - |
| 305 | const QString keysKey = QStringLiteral("Keys"); executed (the execution status of this line is deduced): const QString keysKey = QString::fromUtf8("" "Keys" "", sizeof("Keys") - 1); | - |
| 306 | const QList<QJsonObject> metaDataList = metaData(); executed (the execution status of this line is deduced): const QList<QJsonObject> metaDataList = metaData(); | - |
| 307 | for (int i = 0; i < metaDataList.size(); ++i) { evaluated: i < metaDataList.size()| yes Evaluation Count:9157 | yes Evaluation Count:3154 |
| 3154-9157 |
| 308 | const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject(); executed (the execution status of this line is deduced): const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject(); | - |
| 309 | const QJsonArray keys = metaData.value(keysKey).toArray(); executed (the execution status of this line is deduced): const QJsonArray keys = metaData.value(keysKey).toArray(); | - |
| 310 | const int keyCount = keys.size(); executed (the execution status of this line is deduced): const int keyCount = keys.size(); | - |
| 311 | for (int k = 0; k < keyCount; ++k) evaluated: k < keyCount| yes Evaluation Count:12177 | yes Evaluation Count:9157 |
| 9157-12177 |
| 312 | result.insert(i, keys.at(k).toString()); executed: result.insert(i, keys.at(k).toString());Execution Count:12177 | 12177 |
| 313 | } executed: }Execution Count:9157 | 9157 |
| 314 | return result; executed: return result;Execution Count:3154 | 3154 |
| 315 | } | - |
| 316 | | - |
| 317 | int QFactoryLoader::indexOf(const QString &needle) const | - |
| 318 | { | - |
| 319 | const QString metaDataKey = QStringLiteral("MetaData"); executed (the execution status of this line is deduced): const QString metaDataKey = QString::fromUtf8("" "MetaData" "", sizeof("MetaData") - 1); | - |
| 320 | const QString keysKey = QStringLiteral("Keys"); executed (the execution status of this line is deduced): const QString keysKey = QString::fromUtf8("" "Keys" "", sizeof("Keys") - 1); | - |
| 321 | const QList<QJsonObject> metaDataList = metaData(); executed (the execution status of this line is deduced): const QList<QJsonObject> metaDataList = metaData(); | - |
| 322 | for (int i = 0; i < metaDataList.size(); ++i) { evaluated: i < metaDataList.size()| yes Evaluation Count:1685 | yes Evaluation Count:2468 |
| 1685-2468 |
| 323 | const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject(); executed (the execution status of this line is deduced): const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject(); | - |
| 324 | const QJsonArray keys = metaData.value(keysKey).toArray(); executed (the execution status of this line is deduced): const QJsonArray keys = metaData.value(keysKey).toArray(); | - |
| 325 | const int keyCount = keys.size(); executed (the execution status of this line is deduced): const int keyCount = keys.size(); | - |
| 326 | for (int k = 0; k < keyCount; ++k) { evaluated: k < keyCount| yes Evaluation Count:9331 | yes Evaluation Count:1076 |
| 1076-9331 |
| 327 | if (!keys.at(k).toString().compare(needle, Qt::CaseInsensitive)) evaluated: !keys.at(k).toString().compare(needle, Qt::CaseInsensitive)| yes Evaluation Count:609 | yes Evaluation Count:8722 |
| 609-8722 |
| 328 | return i; executed: return i;Execution Count:609 | 609 |
| 329 | } executed: }Execution Count:8722 | 8722 |
| 330 | } executed: }Execution Count:1076 | 1076 |
| 331 | return -1; executed: return -1;Execution Count:2468 | 2468 |
| 332 | } | - |
| 333 | | - |
| 334 | QT_END_NAMESPACE | - |
| 335 | | - |
| 336 | #endif // QT_NO_LIBRARY | - |
| 337 | | - |
| | |