AbstractArchive Class | Qt Installer Framework Manual

- Qt Installer Framework Manual
- AbstractArchive

# AbstractArchive Class

class QInstaller::AbstractArchive

The AbstractArchive class is the base class for classes representing different archive files. It cannot be instantiated on its own but defines the API and provides common functionality when subclassed. More...

Header: | #include <AbstractArchive>
Inherited By: | QInstaller::Lib7zArchive, QInstaller::LibArchiveArchive, and QInstaller::LibArchiveWrapper

- List of all members, including inherited members

## Public Types

enum | CompressionLevel { Non, Fastest, Fast, Normal, Maximum, Ultra }

## Public Functions

| AbstractArchive(QObject *parent = nullptr)
virtual | ~AbstractArchive() = 0
virtual void | close() = 0
virtual bool | create(const QStringList &data) = 0
virtual QString | errorString() const
virtual bool | extract(const QString &dirPath) = 0
virtual bool | extract(const QString &dirPath, const quint64 totalFiles) = 0
virtual bool | isSupported() = 0
virtual QVector<QInstaller::ArchiveEntry> | list() = 0
virtual bool | open(QIODevice::OpenMode mode) = 0
virtual void | setCompressionLevel(const QInstaller::AbstractArchive::CompressionLevel level)
virtual void | setFilename(const QString &filename) = 0

## Public Slots

virtual void | cancel() = 0

## Signals

void | completedChanged(const quint64 completed, const quint64 total)
void | currentEntryChanged(const QString &filename)

## Protected Functions

QInstaller::AbstractArchive::CompressionLevel | compressionLevel() const
void | setErrorString(const QString &error)

## Detailed Description

## Member Type Documentation

### enum AbstractArchive::CompressionLevel

This enum holds the possible values for archive compression level.

Constant | Value
--- | ---
`QInstaller::AbstractArchive::Non` | `0`
`QInstaller::AbstractArchive::Fastest` | `1`
`QInstaller::AbstractArchive::Fast` | `3`
`QInstaller::AbstractArchive::Normal` | `5`
`QInstaller::AbstractArchive::Maximum` | `7`
`QInstaller::AbstractArchive::Ultra` | `9`

## Member Function Documentation

### `[explicit]` AbstractArchive::AbstractArchive(QObject *parent = nullptr)

Constructs a new archive object with parent as parent. Cannot be called directly but instead from subclass constructors.

### `[pure virtual noexcept]` AbstractArchive::~AbstractArchive()

Virtual destructor for `AbstractArchive`.

### `[pure virtual slot]` void AbstractArchive::cancel()

Cancels current operation. A subclass should implement this slot.

### `[pure virtual]` void AbstractArchive::close()

Closes the archive. A subclass should implement this method.

### `[signal]` void AbstractArchive::completedChanged(const quint64 completed, const quint64 total)

The ratio of completed entries from total changed. Subclasses should emit this whenever the progress changes.

### `[protected]` QInstaller::AbstractArchive::CompressionLevel AbstractArchive::compressionLevel() const

Returns the current compression level.

See also setCompressionLevel().

### `[pure virtual]` bool AbstractArchive::create(const QStringList &data)

Creates an archive from data. Returns `true` on success; `false` otherwise. A subclass should implement this method.

### `[signal]` void AbstractArchive::currentEntryChanged(const QString &filename)

Current entry changed to filename. Subclasses should emit this signal whenever the entry to process is changed.

### `[virtual]` QString AbstractArchive::errorString() const

Returns a human-readable description of the last error that occurred.

See also setErrorString().

### `[pure virtual]` bool AbstractArchive::extract(const QString &dirPath)

Extracts the archive to dirPath. Returns `true` on success; `false` otherwise. A subclass should implement this method.

### `[pure virtual]` bool AbstractArchive::extract(const QString &dirPath, const quint64 totalFiles)

Extracts the contents of an archive to dirPath with precalculated count of totalFiles. Returns `true` on success; `false` otherwise. A subclass should implement this method.

### `[pure virtual]` bool AbstractArchive::isSupported()

Returns `true` if the archive is supported; `false` otherwise. A subclass should implement this method.

### `[pure virtual]` QVector<QInstaller::ArchiveEntry> AbstractArchive::list()

Returns a list of entries in this archive. A subclass should implement this method.

### `[pure virtual]` bool AbstractArchive::open(QIODevice::OpenMode mode)

Opens the file device for an archive in mode. Returns `true` on success; `false` otherwise. A subclass should implement this method.

### `[virtual]` void AbstractArchive::setCompressionLevel(const QInstaller::AbstractArchive::CompressionLevel level)

Sets the compression level for new archives to level.

See also compressionLevel().

### `[protected]` void AbstractArchive::setErrorString(const QString &error)

Sets a human-readable description of the current error.

See also errorString().

### `[pure virtual]` void AbstractArchive::setFilename(const QString &filename)

Sets the filename for the archive. A subclass should implement this method.