QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsArchive Class Reference

Class allowing to manage the zip/unzip actions. More...

#include <qgsarchive.h>

Inheritance diagram for QgsArchive:
Inheritance graph
[legend]

Public Member Functions

 QgsArchive ()
 
 QgsArchive (const QgsArchive &other)
 
virtual ~QgsArchive ()=default
 
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.
 
QString dir () const
 Returns the current temporary directory.
 
bool exists () const
 Returns true if the archive exists on the filesystem, false otherwise.
 
QStringList files () const
 Returns the list of files within this archive.
 
QgsArchiveoperator= (const QgsArchive &other)
 
bool removeFile (const QString &filename)
 Remove a file from this archive and from the filesystem.
 
virtual bool unzip (const QString &zipFilename)
 Clear the current content of this archive and unzip.
 
bool zip (const QString &zipFilename)
 Zip the content of this archive.
 

Detailed Description

Class allowing to manage the zip/unzip actions.

Definition at line 34 of file qgsarchive.h.

Constructor & Destructor Documentation

◆ QgsArchive() [1/2]

QgsArchive::QgsArchive ( )

Definition at line 32 of file qgsarchive.cpp.

◆ QgsArchive() [2/2]

QgsArchive::QgsArchive ( const QgsArchive other)

Definition at line 37 of file qgsarchive.cpp.

◆ ~QgsArchive()

virtual QgsArchive::~QgsArchive ( )
virtualdefault

Member Function Documentation

◆ addFile()

void QgsArchive::addFile ( const QString &  filename)

Add a new file to this archive.

During a zip action, this file will be part of the resulting zipped file.

Parameters
filenameA file to add when zipping this archive

Definition at line 113 of file qgsarchive.cpp.

◆ clear()

void QgsArchive::clear ( )

Clear the current content of this archive and create a new temporary directory.

Definition at line 59 of file qgsarchive.cpp.

◆ dir()

QString QgsArchive::dir ( ) const

Returns the current temporary directory.

Definition at line 54 of file qgsarchive.cpp.

◆ exists()

bool QgsArchive::exists ( ) const

Returns true if the archive exists on the filesystem, false otherwise.

Since
QGIS 3.20

Definition at line 135 of file qgsarchive.cpp.

◆ files()

QStringList QgsArchive::files ( ) const

Returns the list of files within this archive.

Definition at line 130 of file qgsarchive.cpp.

◆ operator=()

QgsArchive & QgsArchive::operator= ( const QgsArchive other)

Definition at line 43 of file qgsarchive.cpp.

◆ removeFile()

bool QgsArchive::removeFile ( const QString &  filename)

Remove a file from this archive and from the filesystem.

Parameters
filenameThe path of the file to remove
Returns
true if the file has been removed from the filesystem, false otherwise

Definition at line 118 of file qgsarchive.cpp.

◆ unzip()

bool QgsArchive::unzip ( const QString &  zipFilename)
virtual

Clear the current content of this archive and unzip.

Files are unzipped in the temporary directory.

Parameters
zipFilenameThe zip file to unzip
Returns
true if unzip action is a success, false otherwise

Reimplemented in QgsProjectArchive.

Definition at line 107 of file qgsarchive.cpp.

◆ zip()

bool QgsArchive::zip ( const QString &  zipFilename)

Zip the content of this archive.

Parameters
zipFilenameThe name of the zip to generate
Returns
false if something goes wrong, true otherwise

Definition at line 65 of file qgsarchive.cpp.


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