ArchiveFactory Class

class QInstaller::ArchiveFactory

The ArchiveFactory class is used to create archive objects based on the suffix of a given filename. More...

Header: #include <ArchiveFactory>
Inherits: GenericFactory

Public Functions

QInstaller::AbstractArchive *create(const QString &filename, QObject *parent = nullptr) const
void registerArchive(const QString &name, const QStringList &types)

Static Public Members

QInstaller::ArchiveFactory &instance()
bool isSupportedType(const QString &filename)
QStringList supportedTypes()

Detailed Description

This class acts as a factory for QInstaller::AbstractArchive. You can register one or more archive handlers with this factory and create registered objects based on the file suffix.

This class follows the singleton design pattern. Only one instance of this class can be created and its reference can be fetched from the instance() method.

The following archive handlers are registered by default:

  • Lib7z
  • LibArchive

Member Function Documentation

QInstaller::AbstractArchive *ArchiveFactory::create(const QString &filename, QObject *parent = nullptr) const

Constructs and returns a pointer to an archive object with filename and parent. If the archive type referenced by filename is not registered, a null pointer is returned instead.

[static] QInstaller::ArchiveFactory &ArchiveFactory::instance()

Returns the only instance of this class.

[static] bool ArchiveFactory::isSupportedType(const QString &filename)

Returns true if the archive type from filename is registered with an archive handler.

template <typename T> void ArchiveFactory::registerArchive(const QString &name, const QStringList &types)

Registers a new archive handler with the factory based on name and list of supported file suffix types.

[static] QStringList ArchiveFactory::supportedTypes()

Returns a list of supported archive types.

© 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.