LibArchiveArchive Class | Qt Installer Framework Manual

- Qt Installer Framework Manual
- LibArchiveArchive

# LibArchiveArchive Class

class QInstaller::LibArchiveArchive

The LibArchiveArchive class represents an archive file handled with libarchive archive and compression library. More...

Header: | #include <LibArchiveArchive>
Inherits: | QInstaller::AbstractArchive

- List of all members, including inherited members

## Public Functions

| LibArchiveArchive(const QString &filename, QObject *parent = nullptr)
| LibArchiveArchive(QObject *parent = nullptr)
virtual | ~LibArchiveArchive()
void | workerAddDataBlock(const QByteArray buffer)
void | workerCancel()
void | workerExtract(const QString &dirPath, const quint64 totalFiles)
void | workerSetDataAtEnd()
void | workerSetFilePosition(qint64 pos)
ExtractWorker::Status | workerStatus() const

## Reimplemented Public Functions

virtual void | close() override
virtual bool | create(const QStringList &data) override
virtual bool | extract(const QString &dirPath) override
virtual bool | extract(const QString &dirPath, const quint64 totalFiles) override
virtual bool | isSupported() override
virtual QVector<QInstaller::ArchiveEntry> | list() override
virtual bool | open(QIODevice::OpenMode mode) override
virtual void | setFilename(const QString &filename) override

## Public Slots

virtual void | cancel() override

## Signals

void | dataBlockRequested()
void | seekRequested(qint64 offset, int whence)
void | workerAboutToAddDataBlock(const QByteArray buffer)
void | workerAboutToCancel()
void | workerAboutToExtract(const QString &dirPath, const quint64 totalFiles)
void | workerAboutToSetDataAtEnd()
void | workerAboutToSetFilePosition(qint64 pos)
void | workerFinished()

## Detailed Description

In addition to extracting data from the underlying file device, the class supports a non-blocking mode of extracting from an external data source. When using this mode, the calling client must pass the data to be read in chunks of arbitrary size, and inform the object when there is no more data to read.

## Member Function Documentation

### LibArchiveArchive::LibArchiveArchive(const QString &filename, QObject *parent = nullptr)

Constructs an archive object representing an archive file specified by filename with parent as the parent object.

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

Constructs an archive object with the given parent.

### `[virtual noexcept]` LibArchiveArchive::~LibArchiveArchive()

Destroys the instance and releases resources.

### `[override virtual slot]` void LibArchiveArchive::cancel()

Reimplements: AbstractArchive::cancel().

Cancels the extract in progress.

### `[override virtual]` void LibArchiveArchive::close()

Reimplements: AbstractArchive::close().

Closes the underlying file device.

### `[override virtual]` bool LibArchiveArchive::create(const QStringList &data)

Reimplements: AbstractArchive::create(const QStringList &data).

Packages the given data into the archive and creates the file on disk.

### `[signal]` void LibArchiveArchive::dataBlockRequested()

Emitted when the worker object requires more data to continue extracting.

### `[override virtual]` bool LibArchiveArchive::extract(const QString &dirPath)

Reimplements: AbstractArchive::extract(const QString &dirPath).

Extracts the contents of this archive to dirPath. Returns `true` on success; `false` otherwise.

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

Reimplements: AbstractArchive::extract(const QString &dirPath, const quint64 totalFiles).

Extracts the contents of this archive to dirPath with precalculated count of totalFiles. Returns `true` on success; `false` otherwise.

### `[override virtual]` bool LibArchiveArchive::isSupported()

Reimplements: AbstractArchive::isSupported().

Returns `true` if the current archive is of a supported format; `false` otherwise.

### `[override virtual]` QVector<QInstaller::ArchiveEntry> LibArchiveArchive::list()

Reimplements: AbstractArchive::list().

Returns the contents of this archive as an array of `ArchiveEntry` objects. On failure, returns an empty array.

### `[override virtual]` bool LibArchiveArchive::open(QIODevice::OpenMode mode)

Reimplements: AbstractArchive::open(QIODevice::OpenMode mode).

Opens the underlying file device using mode. Returns `true` if succesfull; otherwise `false`.

### `[signal]` void LibArchiveArchive::seekRequested(qint64 offset, int whence)

Emitted when the worker object requires a seek to offset to continue extracting. The whence value defines the starting position for offset.

### `[override virtual]` void LibArchiveArchive::setFilename(const QString &filename)

Reimplements: AbstractArchive::setFilename(const QString &filename).

Sets the filename of the underlying file device.

### `[signal]` void LibArchiveArchive::workerAboutToAddDataBlock(const QByteArray buffer)

Emitted when the worker object is about to add and read the data block in buffer.

### `[signal]` void LibArchiveArchive::workerAboutToCancel()

Emitted when the worker object is about to cancel extracting.

### `[signal]` void LibArchiveArchive::workerAboutToExtract(const QString &dirPath, const quint64 totalFiles)

Emitted when the worker object is about to extract totalFiles from an archive to dirPath.

### `[signal]` void LibArchiveArchive::workerAboutToSetDataAtEnd()

Emitted when the worker object is about to set data-at-end, meaning there will be no further read requests for the calling client.

### `[signal]` void LibArchiveArchive::workerAboutToSetFilePosition(qint64 pos)

Emitted when the worker object is about to set new file position pos.

### void LibArchiveArchive::workerAddDataBlock(const QByteArray buffer)

Adds data to be read by the worker object in buffer.

### void LibArchiveArchive::workerCancel()

Cancels the extract in progress for the worker object.

### void LibArchiveArchive::workerExtract(const QString &dirPath, const quint64 totalFiles)

Requests to extract the archive to dirPath with totalFiles in a separate thread with a worker object.

### `[signal]` void LibArchiveArchive::workerFinished()

Emitted when the worker object finished extracting an archive.

### void LibArchiveArchive::workerSetDataAtEnd()

Signals the worker object that the client data is at end.

### void LibArchiveArchive::workerSetFilePosition(qint64 pos)

Signals the worker object that the client file position changed to pos.

### ExtractWorker::Status LibArchiveArchive::workerStatus() const

Returns the status of the worker object.