ManiVault 1.0.0
A Flexible and Extensible Visual Analytics Framework for High-Dimensional Data
Loading...
Searching...
No Matches
hdps::util::Archiver Class Reference

#include <Archiver.h>

Inheritance diagram for hdps::util::Archiver:

Signals

void taskStarted (const QString &taskName)
 
void taskFinished (const QString &taskName)
 

Public Member Functions

 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="")
 

Protected Member Functions

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)
 

Detailed Description

Archiver class

Class for archiving files and directories (wraps QuaZip)

Author
Thomas Kroes

Constructor & Destructor Documentation

◆ Archiver()

hdps::util::Archiver::Archiver ( )
default

Constructor

Parameters
parentPointer to parent object

Member Function Documentation

◆ 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
sourceDirectoryPath of the source directory
compressedFilePathFile path of the compressed destination file
recursiveWhether to pack sub-directories as well or only files
compressionLevelCompression level (zero means no compression)
passwordPassword string if files need to be secured
fileDoneFnCallback which is called when a file compression is complete
filtersFile 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
zipPointer to quazip instance
sourceFilePathPath of the source file
compressedFilePathPath of the compressed file
compressionLevelCompression level (zero means no compression)
passwordPassword 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
parentZipOpened zip containing the parent directory
directoryThe full path to the directory to pack
parentDirectoryThe full path to the directory corresponding to the root of the ZIP
recursiveWhether to pack sub-directories as well or only files
compressionLevelCompression level (zero means no compression)
passwordPassword string if files need to be secured
filtersFile 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
compressedFilePath of the compressed source file
destinationDirectoryPath of the destination directory where files will be extracted
passwordPassword 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
zipPointer to quazip instance
compressedFilePathFile path of the compressed input file
targetFilePathPath of the extracted target file
passwordPassword 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
compressedFilePathFile path of the compressed input file
sourceFileNameFile name of the compressed source file
targetFilePathPath of the extracted target file
passwordPassword 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
compressedFilePathFile 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
directoryPath of the directory
recursiveWhether to recursively scan for sub-directories
levelDirectory 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
filesToRemoveFiles to remove

◆ taskFinished

void hdps::util::Archiver::taskFinished ( const QString &  taskName)
signal

Signals that a task has finished

Parameters
taskNameName of the task that finished

◆ taskStarted

void hdps::util::Archiver::taskStarted ( const QString &  taskName)
signal

Signals that a task has started

Parameters
taskNameName of the task that started

The documentation for this class was generated from the following files: