QInstaller::GenericDataCache Class

template <typename T> class QInstaller::GenericDataCache

The GenericDataCache is a template class for a checksum based storage of items on disk. More...

Header: #include <GenericDataCache>
Inherited By:

QInstaller::MetadataCache

Public Types

enum RegisterMode { Copy, Move }

Public Functions

GenericDataCache()
GenericDataCache(const QString &path, const QString &type, const QString &version)
virtual ~GenericDataCache()

Detailed Description

GenericDataCache<T> manages a cache storage for a set path(), which contains a subdirectory for each registered item. An item of type T should implement methods declared in the CacheableItem interface. The GenericDataCache<T> class can still be explicitly specialized to use the derived type as a template argument, to allow retrieving items as the derived type without casting.

Each cache has a manifest file in its root directory, which lists the version and wrapped type of the cache, and all its items. The file is updated automatically when the cache object is destructed, or it can be updated periodically by calling sync().

Member Type Documentation

enum GenericDataCache::RegisterMode

This enum holds the possible values for modes of registering items to cache.

ConstantValueDescription
QInstaller::GenericDataCache::Copy0The contents of the item are copied to the cache.
QInstaller::GenericDataCache::Move1The contents of the item are move to the cache.

Member Function Documentation

GenericDataCache::GenericDataCache()

Constructs a new empty cache. The cache is invalid until set with a path and initialized.

[explicit] GenericDataCache::GenericDataCache(const QString &path, const QString &type, const QString &version)

Constructs a cache to path with the given type and version. The cache is initialized automatically.

[virtual] GenericDataCache::~GenericDataCache()

Deletes the cache object. Item contents on disk are kept.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.