Lib7z Namespace

The Lib7z namespace contains miscellaneous identifiers used throughout the Lib7z library. More...

Header: #include <Lib7z>

Classes

Types

Compression
File
enum class TmpFile { No, Yes }

Functions

void createArchive(QFileDevice *archive, const QStringList &sources, Lib7z::Compression level = Compression::Normal, Lib7z::UpdateCallback *callback = 0)
void createArchive(const QString &archive, const QStringList &sources, Lib7z::TmpFile mode, Lib7z::Compression level = Compression::Normal, Lib7z::UpdateCallback *callback = 0)
void extractArchive(QFileDevice *archive, const QString &directory, Lib7z::ExtractCallback *callback = 0)
void initSevenZ()
bool isSupportedArchive(QFileDevice *archive)
bool isSupportedArchive(const QString &archive)
QVector<Lib7z::File> listArchive(QFileDevice *archive)

Detailed Description

Classes

class ExtractCallback

Provides a callback for archive extraction. More...

class PercentPrinter

The PercentPrinter class displays the archiving process. More...

class SevenZipException

The SevenZipException provides a class for lib7z exceptions. More...

Type Documentation

Lib7z::Compression

Synonym for QInstaller::CompressionLevel

Lib7z::File

Synonym for QInstaller::ArchiveEntry

enum class Lib7z::TmpFile

This enum type holds the temp file mode:

ConstantValueDescription
Lib7z::TmpFile::No0File is not a temporary file.
Lib7z::TmpFile::Yes1File is a tmp file.

Function Documentation

void Lib7z::createArchive(QFileDevice *archive, const QStringList &sources, Lib7z::Compression level = Compression::Normal, Lib7z::UpdateCallback *callback = 0)

Creates an archive using the given file device archive. sources can contain one or more files, one or more directories or a combination of files and folders. Also, * wildcard is supported. The value of level specifies the compression ratio, the default is set to 5 (Normal compression). The callback can be used to get information about the archive creation process. If no callback is given, an empty implementation is used.

Note: Throws SevenZipException on error.

Note: Filenames are stored case-sensitive with UTF-8 encoding.

Note: The ownership of callback is transferred to the function and gets delete on exit.

void Lib7z::createArchive(const QString &archive, const QStringList &sources, Lib7z::TmpFile mode, Lib7z::Compression level = Compression::Normal, Lib7z::UpdateCallback *callback = 0)

Creates an archive with the given filename archive. sources can contain one or more files, one or more directories or a combination of files and folders. Also, * wildcard is supported. To be able to use the function during an elevated installation, set mode to TmpFile::Yes. The value of level specifies the compression ratio, the default is set to 5 (Normal compression). The callback can be used to get information about the archive creation process. If no callback is given, an empty implementation is used.

Note: Throws SevenZipException on error.

Note: If archive exists, it will be overwritten.

Note: Filenames are stored case-sensitive with UTF-8 encoding.

Note: The ownership of callback is transferred to the function and gets delete on exit.

void Lib7z::extractArchive(QFileDevice *archive, const QString &directory, Lib7z::ExtractCallback *callback = 0)

Extracts the given archive content into target directory directory using the provided extract callback callback. The output filenames are deduced from the archive content.

Note: Throws SevenZipException on error.

Note: The ownership of callback is not transferred to the function.

void Lib7z::initSevenZ()

Initializes 7z and registers codecs and compression methods.

bool Lib7z::isSupportedArchive(QFileDevice *archive)

Returns true if the given archive is supported; otherwise returns false.

Note: Throws SevenZipException on error.

bool Lib7z::isSupportedArchive(const QString &archive)

Returns true if the given archive is supported; otherwise returns false.

Note: Throws SevenZipException on error.

QVector<Lib7z::File> Lib7z::listArchive(QFileDevice *archive)

Returns a list of files belonging to an archive.

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