QgsArchive class
Class allowing to manage the zip/unzip actions.
Contents
Derived classes
- class QgsProjectArchive
- Class allowing to manage the zip/unzip actions on project file.
Constructors, destructors, conversion operators
- QgsArchive()
- Constructor.
- QgsArchive(const QgsArchive& other)
- Copy constructor.
- ~QgsArchive() defaulted virtual
- Destructor.
Public functions
- void addFile(const QString& filename)
- Add a new file to this archive.
- void clear()
- Clear the current content of this archive and create a new temporary directory.
- auto dir() const -> QString
- Returns the current temporary directory.
- auto files() const -> QStringList
- Returns the list of files within this archive.
- auto removeFile(const QString& filename) -> bool
- Remove a file from this archive and from the filesystem.
- auto unzip(const QString& zipFilename) -> bool virtual
- Clear the current content of this archive and unzip.
- auto zip(const QString& zipFilename) -> bool
- Zip the content of this archive.
Function documentation
void QgsArchive:: addFile(const QString& filename)
Add a new file to this archive.
| Parameters | |
|---|---|
| filename | A file to add when zipping this archive |
During a zip action, this file will be part of the resulting zipped file.
bool QgsArchive:: removeFile(const QString& filename)
Remove a file from this archive and from the filesystem.
| Parameters | |
|---|---|
| filename | The path of the file to remove |
| Returns | true if the file has been removed from the filesystem, false otherwise |
bool QgsArchive:: unzip(const QString& zipFilename) virtual
Clear the current content of this archive and unzip.
| Parameters | |
|---|---|
| zipFilename | The zip file to unzip |
| Returns | true if unzip action is a success, false otherwise |
Files are unzipped in the temporary directory.
bool QgsArchive:: zip(const QString& zipFilename)
Zip the content of this archive.
| Parameters | |
|---|---|
| zipFilename | The name of the zip to generate |
| Returns | false if something goes wrong, true otherwise |