| Line | Source Code | Coverage | 
|---|
| 1 |  | - | 
| 2 |  | - | 
| 3 |  | - | 
| 4 |  | - | 
| 5 |  | - | 
| 6 | QPluginLoader::QPluginLoader(QObject *parent) | - | 
| 7 | : QObject(parent), d(0), did_load(false) | - | 
| 8 | { | - | 
| 9 | } executed:  }Execution Count:7 | 7 | 
| 10 | QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) | - | 
| 11 | : QObject(parent), d(0), did_load(false) | - | 
| 12 | { | - | 
| 13 | setFileName(fileName); | - | 
| 14 | } executed:  }Execution Count:16 | 16 | 
| 15 | QPluginLoader::~QPluginLoader() | - | 
| 16 | { | - | 
| 17 | if (d) evaluated:  d| yes Evaluation Count:22 | yes Evaluation Count:1 | 
 | 1-22 | 
| 18 | d->release(); executed:  d->release();Execution Count:22 | 22 | 
| 19 | } executed:  }Execution Count:23 | 23 | 
| 20 | QObject *QPluginLoader::instance() | - | 
| 21 | { | - | 
| 22 | if (!isLoaded() && !load()) evaluated:  !isLoaded()| yes Evaluation Count:5 | yes Evaluation Count:15 | 
evaluated:  !load()| yes Evaluation Count:4 | yes Evaluation Count:1 | 
 | 1-15 | 
| 23 | return 0; executed:  return 0;Execution Count:4 | 4 | 
| 24 | if (!d->inst && d->instance) evaluated:  !d->inst| yes Evaluation Count:8 | yes Evaluation Count:8 | 
partially evaluated:  d->instance| yes Evaluation Count:8 | no Evaluation Count:0 | 
 | 0-8 | 
| 25 | d->inst = d->instance(); executed:  d->inst = d->instance();Execution Count:8 | 8 | 
| 26 | return d->inst.data(); executed:  return d->inst.data();Execution Count:16 | 16 | 
| 27 | } | - | 
| 28 | QJsonObject QPluginLoader::metaData() const | - | 
| 29 | { | - | 
| 30 | if (!d) | 0 | 
| 31 | return QJsonObject(); never executed: return QJsonObject(); | 0 | 
| 32 | return d->metaData; never executed: return d->metaData; | 0 | 
| 33 | } | - | 
| 34 | bool QPluginLoader::load() | - | 
| 35 | { | - | 
| 36 | if (!d || d->fileName.isEmpty()) evaluated:  !d| yes Evaluation Count:2 | yes Evaluation Count:24 | 
evaluated:  d->fileName.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:22 | 
 | 2-24 | 
| 37 | return false; executed:  return false;Execution Count:4 | 4 | 
| 38 | if (did_load) evaluated:  did_load| yes Evaluation Count:1 | yes Evaluation Count:21 | 
 | 1-21 | 
| 39 | return d->pHnd && d->instance; executed:  return d->pHnd && d->instance;Execution Count:1 | 1 | 
| 40 | if (!d->isPlugin()) evaluated:  !d->isPlugin()| yes Evaluation Count:11 | yes Evaluation Count:10 | 
 | 10-11 | 
| 41 | return false; executed:  return false;Execution Count:11 | 11 | 
| 42 | did_load = true; | - | 
| 43 | return d->loadPlugin(); executed:  return d->loadPlugin();Execution Count:10 | 10 | 
| 44 | } | - | 
| 45 | bool QPluginLoader::unload() | - | 
| 46 | { | - | 
| 47 | if (did_load) { evaluated:  did_load| yes Evaluation Count:7 | yes Evaluation Count:3 | 
 | 3-7 | 
| 48 | did_load = false; | - | 
| 49 | return d->unload(); executed:  return d->unload();Execution Count:7 | 7 | 
| 50 | } | - | 
| 51 | if (d) evaluated:  d| yes Evaluation Count:2 | yes Evaluation Count:1 | 
 | 1-2 | 
| 52 | d->errorString = tr("The plugin was not loaded."); executed:  d->errorString = tr("The plugin was not loaded.");Execution Count:2 | 2 | 
| 53 | return false; executed:  return false;Execution Count:3 | 3 | 
| 54 | } | - | 
| 55 |  | - | 
| 56 |  | - | 
| 57 |  | - | 
| 58 |  | - | 
| 59 |  | - | 
| 60 |  | - | 
| 61 | bool QPluginLoader::isLoaded() const | - | 
| 62 | { | - | 
| 63 | return d && d->pHnd && d->instance; executed:  return d && d->pHnd && d->instance;Execution Count:21 | 21 | 
| 64 | } | - | 
| 65 |  | - | 
| 66 | static QString locatePlugin(const QString& fileName) | - | 
| 67 | { | - | 
| 68 | QStringList prefixes = QLibraryPrivate::prefixes_sys(); | - | 
| 69 | prefixes.prepend(QString()); | - | 
| 70 | QStringList suffixes = QLibraryPrivate::suffixes_sys(QString()); | - | 
| 71 | suffixes.prepend(QString()); | - | 
| 72 |  | - | 
| 73 |  | - | 
| 74 | const int slash = fileName.lastIndexOf('/'); | - | 
| 75 | const QString baseName = fileName.mid(slash + 1); | - | 
| 76 | const QString basePath = fileName.left(slash + 1); | - | 
| 77 |  | - | 
| 78 | const bool debug = qt_debug_component(); | - | 
| 79 |  | - | 
| 80 | QStringList paths = QCoreApplication::libraryPaths(); | - | 
| 81 | paths.prepend(QString::fromUtf8("" "./" "", sizeof("./") - 1)); | - | 
| 82 | for (QForeachContainer<__typeof__(paths)> _container_(paths); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &path = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - | 
| 83 | for (QForeachContainer<__typeof__(prefixes)> _container_(prefixes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &prefix = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - | 
| 84 | for (QForeachContainer<__typeof__(suffixes)> _container_(suffixes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &suffix = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - | 
| 85 | const QString fn = path + QLatin1Char('/') + basePath + prefix + baseName + suffix; | - | 
| 86 | if (debug) partially evaluated:  debug| no Evaluation Count:0 | yes Evaluation Count:20 | 
 | 0-20 | 
| 87 | QMessageLogger("plugin/qpluginloader.cpp", 275, __PRETTY_FUNCTION__).debug() << "Trying..." << fn; never executed: QMessageLogger("plugin/qpluginloader.cpp", 275, __PRETTY_FUNCTION__).debug() << "Trying..." << fn; | 0 | 
| 88 | if (QFileInfo(fn).isFile()) evaluated:  QFileInfo(fn).isFile()| yes Evaluation Count:1 | yes Evaluation Count:19 | 
 | 1-19 | 
| 89 | return fn; executed:  return fn;Execution Count:1 | 1 | 
| 90 | } executed:  }Execution Count:19 | 19 | 
| 91 | } executed:  }Execution Count:9 | 9 | 
| 92 | } executed:  }Execution Count:4 | 4 | 
| 93 | if (debug) partially evaluated:  debug| no Evaluation Count:0 | yes Evaluation Count:1 | 
 | 0-1 | 
| 94 | QMessageLogger("plugin/qpluginloader.cpp", 282, __PRETTY_FUNCTION__).debug() << fileName << "not found"; never executed: QMessageLogger("plugin/qpluginloader.cpp", 282, __PRETTY_FUNCTION__).debug() << fileName << "not found"; | 0 | 
| 95 | return QString(); executed:  return QString();Execution Count:1 | 1 | 
| 96 | } | - | 
| 97 | void QPluginLoader::setFileName(const QString &fileName) | - | 
| 98 | { | - | 
| 99 |  | - | 
| 100 | QLibrary::LoadHints lh; | - | 
| 101 | if (d) { evaluated:  d| yes Evaluation Count:1 | yes Evaluation Count:21 | 
 | 1-21 | 
| 102 | lh = d->loadHints; | - | 
| 103 | d->release(); | - | 
| 104 | d = 0; | - | 
| 105 | did_load = false; | - | 
| 106 | } executed:  }Execution Count:1 | 1 | 
| 107 |  | - | 
| 108 | QFileInfo fi(fileName); | - | 
| 109 | QString fn; | - | 
| 110 | if (fi.isAbsolute()) evaluated:  fi.isAbsolute()| yes Evaluation Count:20 | yes Evaluation Count:2 | 
 | 2-20 | 
| 111 | fn = fi.canonicalFilePath(); executed:  fn = fi.canonicalFilePath();Execution Count:20 | 20 | 
| 112 | else | - | 
| 113 | fn = locatePlugin(fileName); executed:  fn = locatePlugin(fileName);Execution Count:2 | 2 | 
| 114 |  | - | 
| 115 | d = QLibraryPrivate::findOrCreate(fn); | - | 
| 116 | d->loadHints = lh; | - | 
| 117 | if (fn.isEmpty()) evaluated:  fn.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:21 | 
 | 1-21 | 
| 118 | d->errorString = QLibrary::tr("The shared library was not found."); executed:  d->errorString = QLibrary::tr("The shared library was not found.");Execution Count:1 | 1 | 
| 119 | else | - | 
| 120 | d->updatePluginState(); executed:  d->updatePluginState();Execution Count:21 | 21 | 
| 121 | } | - | 
| 122 |  | - | 
| 123 | QString QPluginLoader::fileName() const | - | 
| 124 | { | - | 
| 125 | if (d) | 0 | 
| 126 | return d->fileName; never executed: return d->fileName; | 0 | 
| 127 | return QString(); never executed: return QString(); | 0 | 
| 128 | } | - | 
| 129 |  | - | 
| 130 |  | - | 
| 131 |  | - | 
| 132 |  | - | 
| 133 |  | - | 
| 134 |  | - | 
| 135 | QString QPluginLoader::errorString() const | - | 
| 136 | { | - | 
| 137 | return (!d || d->errorString.isEmpty()) ? tr("Unknown error") : d->errorString; executed:  return (!d || d->errorString.isEmpty()) ? tr("Unknown error") : d->errorString;Execution Count:26 | 26 | 
| 138 | } | - | 
| 139 |  | - | 
| 140 | typedef QVector<QStaticPlugin> StaticPluginList; | - | 
| 141 | static StaticPluginList *staticPluginList() { static QGlobalStatic<StaticPluginList > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { StaticPluginList *x = new StaticPluginList; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<StaticPluginList > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x;executed:  return thisGlobalStatic.pointer.load();Execution Count:8021partially evaluated:  !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:21 | 
evaluated:  !thisGlobalStatic.pointer.load()| yes Evaluation Count:21 | yes Evaluation Count:8000 | 
partially evaluated:  !thisGlobalStatic.destroyed| yes Evaluation Count:21 | no Evaluation Count:0 | 
 | 0-8021 | 
| 142 | void QPluginLoader::setLoadHints(QLibrary::LoadHints loadHints) | - | 
| 143 | { | - | 
| 144 | if (!d) { partially evaluated:  !d| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 145 | d = QLibraryPrivate::findOrCreate(QString()); | - | 
| 146 | d->errorString.clear(); | - | 
| 147 | } | 0 | 
| 148 | d->loadHints = loadHints; | - | 
| 149 | } executed:  }Execution Count:2 | 2 | 
| 150 |  | - | 
| 151 | QLibrary::LoadHints QPluginLoader::loadHints() const | - | 
| 152 | { | - | 
| 153 | if (!d) { evaluated:  !d| yes Evaluation Count:1 | yes Evaluation Count:1 | 
 | 1 | 
| 154 | QPluginLoader *that = const_cast<QPluginLoader *>(this); | - | 
| 155 | that->d = QLibraryPrivate::findOrCreate(QString()); | - | 
| 156 | that->d->errorString.clear(); | - | 
| 157 | } executed:  }Execution Count:1 | 1 | 
| 158 | return d->loadHints; executed:  return d->loadHints;Execution Count:2 | 2 | 
| 159 | } | - | 
| 160 |  | - | 
| 161 |  | - | 
| 162 |  | - | 
| 163 |  | - | 
| 164 |  | - | 
| 165 |  | - | 
| 166 |  | - | 
| 167 | void __attribute__((visibility("default"))) qRegisterStaticPluginFunction(QStaticPlugin plugin) | - | 
| 168 | { | - | 
| 169 | staticPluginList()->append(plugin); | - | 
| 170 | } executed:  }Execution Count:1 | 1 | 
| 171 |  | - | 
| 172 |  | - | 
| 173 |  | - | 
| 174 |  | - | 
| 175 |  | - | 
| 176 | QObjectList QPluginLoader::staticInstances() | - | 
| 177 | { | - | 
| 178 | QObjectList instances; | - | 
| 179 | const StaticPluginList *plugins = staticPluginList(); | - | 
| 180 | if (plugins) { | 0 | 
| 181 | for (int i = 0; i < plugins->size(); ++i) never evaluated: i < plugins->size() | 0 | 
| 182 | instances += plugins->at(i).instance(); never executed: instances += plugins->at(i).instance(); | 0 | 
| 183 | } | 0 | 
| 184 | return instances; never executed: return instances; | 0 | 
| 185 | } | - | 
| 186 |  | - | 
| 187 |  | - | 
| 188 | QVector<QStaticPlugin> QLibraryPrivate::staticPlugins() | - | 
| 189 | { | - | 
| 190 | StaticPluginList *plugins = staticPluginList(); | - | 
| 191 | if (plugins) partially evaluated:  plugins| yes Evaluation Count:8020 | no Evaluation Count:0 | 
 | 0-8020 | 
| 192 | return *plugins; executed:  return *plugins;Execution Count:8020 | 8020 | 
| 193 | return QVector<QStaticPlugin>(); never executed: return QVector<QStaticPlugin>(); | 0 | 
| 194 | } | - | 
| 195 |  | - | 
| 196 |  | - | 
| 197 |  | - | 
|  |  |  |