| 297 | } |
| 298 | |
| 299 | void ItemRepositoryRegistry::store() |
| 300 | { |
| 301 | Q_D(ItemRepositoryRegistry); |
| 302 | |
| 303 | QMutexLocker lock(&d->m_mutex); |
| 304 | for (auto* repository : std::as_const(d->m_repositories)) { |
| 305 | std::scoped_lock repoLock(*repository); |
| 306 | repository->store(); |
| 307 | } |
| 308 | |
| 309 | QFile versionFile(d->m_path + QStringLiteral("/version_%1").arg(staticItemRepositoryVersion())); |
| 310 | if (versionFile.open(QIODevice::WriteOnly)) { |
| 311 | versionFile.close(); |
| 312 | } else { |
| 313 | qCWarning(SERIALIZATION) << "Could not open version file for writing"; |
| 314 | } |
| 315 | |
| 316 | //Store all custom counter values |
| 317 | QFile f(d->m_path + QLatin1String("/Counters")); |
| 318 | if (f.open(QIODevice::WriteOnly)) { |
| 319 | f.resize(0); |
| 320 | QDataStream stream(&f); |
| 321 | for (QMap<QString, QAtomicInt*>::const_iterator it = d->m_customCounters.constBegin(); |
| 322 | it != d->m_customCounters.constEnd(); |
| 323 | ++it) { |
| 324 | stream << it.key(); |
| 325 | stream << it.value()->fetchAndAddRelaxed(0); |
| 326 | } |
| 327 | } else { |
| 328 | qCWarning(SERIALIZATION) << "Could not open counter file for writing"; |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | void ItemRepositoryRegistry::printAllStatistics() const |
| 333 | { |
nothing calls this directly
no test coverage detected