Lib7z Namespace
The Lib7z namespace contains miscellaneous identifiers used throughout the Lib7z library. More...
Header: | #include <Lib7z> |
Classes
class | ExtractCallback |
class | PercentPrinter |
class | SevenZipException |
Types
typedef | Compression |
typedef | File |
enum class | TmpFile { No, Yes } |
Functions
void | createArchive(QFileDevice *archive, const QStringList &sources, Compression level = Compression::Normal, UpdateCallback *callback = 0) |
void | createArchive(const QString &archive, const QStringList &sources, TmpFile mode, Compression level = Compression::Normal, UpdateCallback *callback = 0) |
void | extractArchive(QFileDevice *archive, const QString &directory, ExtractCallback *callback = 0) |
void | initSevenZ() |
bool | isSupportedArchive(QFileDevice *archive) |
bool | isSupportedArchive(const QString &archive) |
QVector<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
typedef Lib7z::Compression
Synonym for QInstaller::CompressionLevel
typedef Lib7z::File
Synonym for QInstaller::ArchiveEntry
enum class Lib7z::TmpFile
This enum type holds the temp file mode:
Constant | Value | Description |
---|---|---|
Lib7z::TmpFile::No | 0 | File is not a temporary file. |
Lib7z::TmpFile::Yes | 1 | File is a tmp file. |
Function Documentation
void Lib7z::createArchive(QFileDevice *archive, const QStringList &sources, Compression level = Compression::Normal, 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, TmpFile mode, Compression level = Compression::Normal, 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, 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<File> Lib7z::listArchive(QFileDevice *archive)
Returns a list of files belonging to an archive.