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

Public Functions

LibArchiveArchive(QObject *parent = nullptr)
LibArchiveArchive(const QString &filename, 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)
QInstaller::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(QIODeviceBase::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

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

Constructs an archive object with the given parent.

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.

[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(QIODeviceBase::OpenMode mode)

Reimplements: AbstractArchive::open(QIODeviceBase::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.

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

Returns the status of the worker object.

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