#include <Archiver.h>
|
| | Archiver ()=default |
| |
| void | compressDirectory (const QString &sourceDirectory, const QString &compressedFilePath, bool recursive=true, std::int32_t compressionLevel=0, const QString &password="", QDir::Filters filters=QDir::Filter::Files) |
| |
| void | decompress (const QString &compressedFile, const QString &destinationDirectory, const QString &password="") |
| |
| QStringList | getTaskNamesForDirectoryCompression (const QString &directory, bool recursive=true, std::int32_t level=0) |
| |
| QStringList | getTaskNamesForDecompression (const QString &compressedFilePath) |
| |
| void | extractSingleFile (const QString &compressedFilePath, const QString &sourceFileName, const QString &targetFilePath, const QString &password="") |
| |
|
| void | compressSubDirectory (QuaZip *parentZip, const QString &directory, const QString &parentDirectory, bool recursive=true, std::int32_t compressionLevel=0, const QString &password="", QDir::Filters filters=QDir::Filter::Files) |
| |
| void | compressFile (QuaZip *zip, const QString &sourceFilePath, const QString &compressedFilePath, std::int32_t compressionLevel=0, const QString &password="") |
| |
| void | extractFile (QuaZip *zip, const QString &compressedFilePath, const QString &targetFilePath, const QString &password="") |
| |
| void | removeFiles (const QStringList &filesToRemove) |
| |
Archiver class
Class for archiving files and directories (wraps QuaZip)
- Author
- Thomas Kroes
◆ Archiver()
| hdps::util::Archiver::Archiver |
( |
| ) |
|
|
default |
Constructor
- Parameters
-
| parent | Pointer to parent object |
◆ compressDirectory()
| void hdps::util::Archiver::compressDirectory |
( |
const QString & |
sourceDirectory, |
|
|
const QString & |
compressedFilePath, |
|
|
bool |
recursive = true, |
|
|
std::int32_t |
compressionLevel = 0, |
|
|
const QString & |
password = "", |
|
|
QDir::Filters |
filters = QDir::Filter::Files |
|
) |
| |
Compresses an entire directory and possibly password-protects it
- Parameters
-
| sourceDirectory | Path of the source directory |
| compressedFilePath | File path of the compressed destination file |
| recursive | Whether to pack sub-directories as well or only files |
| compressionLevel | Compression level (zero means no compression) |
| password | Password string if files need to be secured |
| fileDoneFn | Callback which is called when a file compression is complete |
| filters | File include filter |
◆ compressFile()
| void hdps::util::Archiver::compressFile |
( |
QuaZip * |
zip, |
|
|
const QString & |
sourceFilePath, |
|
|
const QString & |
compressedFilePath, |
|
|
std::int32_t |
compressionLevel = 0, |
|
|
const QString & |
password = "" |
|
) |
| |
|
protected |
Compresses a file
- Parameters
-
| zip | Pointer to quazip instance |
| sourceFilePath | Path of the source file |
| compressedFilePath | Path of the compressed file |
| compressionLevel | Compression level (zero means no compression) |
| password | Password string if files need to be secured |
◆ compressSubDirectory()
| void hdps::util::Archiver::compressSubDirectory |
( |
QuaZip * |
parentZip, |
|
|
const QString & |
directory, |
|
|
const QString & |
parentDirectory, |
|
|
bool |
recursive = true, |
|
|
std::int32_t |
compressionLevel = 0, |
|
|
const QString & |
password = "", |
|
|
QDir::Filters |
filters = QDir::Filter::Files |
|
) |
| |
|
protected |
Compresses a sub directory
- Parameters
-
| parentZip | Opened zip containing the parent directory |
| directory | The full path to the directory to pack |
| parentDirectory | The full path to the directory corresponding to the root of the ZIP |
| recursive | Whether to pack sub-directories as well or only files |
| compressionLevel | Compression level (zero means no compression) |
| password | Password string if files need to be secured |
| filters | File include filter |
◆ decompress()
| void hdps::util::Archiver::decompress |
( |
const QString & |
compressedFile, |
|
|
const QString & |
destinationDirectory, |
|
|
const QString & |
password = "" |
|
) |
| |
Decompresses a compressed file to a destination directory
- Parameters
-
| compressedFile | Path of the compressed source file |
| destinationDirectory | Path of the destination directory where files will be extracted |
| password | Password string if files need to be secured |
- Returns
- Boolean indicating whether decompression was successful
◆ extractFile()
| void hdps::util::Archiver::extractFile |
( |
QuaZip * |
zip, |
|
|
const QString & |
compressedFilePath, |
|
|
const QString & |
targetFilePath, |
|
|
const QString & |
password = "" |
|
) |
| |
|
protected |
Extracts a file
- Parameters
-
| zip | Pointer to quazip instance |
| compressedFilePath | File path of the compressed input file |
| targetFilePath | Path of the extracted target file |
| password | Password string if the compressed file is encrypted with a password |
◆ extractSingleFile()
| void hdps::util::Archiver::extractSingleFile |
( |
const QString & |
compressedFilePath, |
|
|
const QString & |
sourceFileName, |
|
|
const QString & |
targetFilePath, |
|
|
const QString & |
password = "" |
|
) |
| |
Extracts a file Might throw a std::runtime_error exception if an error occurs during extraction
- Parameters
-
| compressedFilePath | File path of the compressed input file |
| sourceFileName | File name of the compressed source file |
| targetFilePath | Path of the extracted target file |
| password | Password string if the compressed file is encrypted with a password |
◆ getTaskNamesForDecompression()
| QStringList hdps::util::Archiver::getTaskNamesForDecompression |
( |
const QString & |
compressedFilePath | ) |
|
Get task names for archive decompression
- Parameters
-
| compressedFilePath | File path of the compressed file |
- Returns
- String list consisting of the task names for the files that will be compressed
◆ getTaskNamesForDirectoryCompression()
| QStringList hdps::util::Archiver::getTaskNamesForDirectoryCompression |
( |
const QString & |
directory, |
|
|
bool |
recursive = true, |
|
|
std::int32_t |
level = 0 |
|
) |
| |
Get task names for directory compression
- Parameters
-
| directory | Path of the directory |
| recursive | Whether to recursively scan for sub-directories |
| level | Directory level |
- Returns
- String list consisting of the task names for the files that will be compressed
◆ removeFiles()
| void hdps::util::Archiver::removeFiles |
( |
const QStringList & |
filesToRemove | ) |
|
|
protected |
Removes a file
- Parameters
-
| filesToRemove | Files to remove |
◆ taskFinished
| void hdps::util::Archiver::taskFinished |
( |
const QString & |
taskName | ) |
|
|
signal |
Signals that a task has finished
- Parameters
-
| taskName | Name of the task that finished |
◆ taskStarted
| void hdps::util::Archiver::taskStarted |
( |
const QString & |
taskName | ) |
|
|
signal |
Signals that a task has started
- Parameters
-
| taskName | Name of the task that started |
The documentation for this class was generated from the following files:
- D:/Work/ManiVault/DevBundle/allmain/source/core/HDPS/src/private/Archiver.h
- D:/Work/ManiVault/DevBundle/allmain/source/core/HDPS/src/private/Archiver.cpp