LibArchiveWrapper Class

class QInstaller::LibArchiveWrapper

The LibArchiveWrapper class provides an interface for interacting with archives handled using the libarchive archive and compression library. More...

Header: #include <LibArchiveWrapper>
Inherits: QInstaller::AbstractArchive

Public Functions

LibArchiveWrapper(const QString &filename, QObject *parent = nullptr)
LibArchiveWrapper(QObject *parent = nullptr)
virtual ~LibArchiveWrapper()

Reimplemented Public Functions

virtual void close() override
virtual bool create(const QStringList &data) override
virtual QString errorString() const 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 setCompressionLevel(const QInstaller::AbstractArchive::CompressionLevel level) override
virtual void setFilename(const QString &filename) override

Public Slots

virtual void cancel() override

Detailed Description

The invoked archive operations are performed in a normal user mode, or in an on-demand elevated user mode through the remote client-server protocol of the framework.

This class is not thread-safe; extra care should be taken especially when elevated mode is active to not call its functions from any thread other than where the object was created.

Member Function Documentation

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

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

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

Constructs an archive object with the given parent.

[virtual noexcept] LibArchiveWrapper::~LibArchiveWrapper()

Destroys the instance.

[override virtual slot] void LibArchiveWrapper::cancel()

Reimplements: AbstractArchive::cancel().

Cancels the extract operation in progress.

If the remote connection is active, the method is called by the server instead.

[override virtual] void LibArchiveWrapper::close()

Reimplements: AbstractArchive::close().

Closes the file device.

[override virtual] bool LibArchiveWrapper::create(const QStringList &data)

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

Packages the given data into the archive and creates the file on disk. Returns true on success; false otherwise.

If the remote connection is active, the method is called by the server instead.

[override virtual] QString LibArchiveWrapper::errorString() const

Reimplements: AbstractArchive::errorString() const.

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

If the remote connection is active, the method is called by the server instead.

[override virtual] bool LibArchiveWrapper::extract(const QString &dirPath)

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

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

If the remote connection is active, the method is called by the server instead, with the client starting a new event loop waiting for the extraction to finish.

[override virtual] bool LibArchiveWrapper::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.

If the remote connection is active, the method is called by the server instead, with the client starting a new event loop waiting for the extraction to finish.

[override virtual] bool LibArchiveWrapper::isSupported()

Reimplements: AbstractArchive::isSupported().

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

[override virtual] QVector<QInstaller::ArchiveEntry> LibArchiveWrapper::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 LibArchiveWrapper::open(QIODeviceBase::OpenMode mode)

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

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

[override virtual] void LibArchiveWrapper::setCompressionLevel(const QInstaller::AbstractArchive::CompressionLevel level)

Reimplements: AbstractArchive::setCompressionLevel(const QInstaller::AbstractArchive::CompressionLevel level).

Sets the compression level for new archives to level.

[override virtual] void LibArchiveWrapper::setFilename(const QString &filename)

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

Sets the filename for the archive.

If the remote connection is active, the same method is called by the server.