mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	QTemporaryFile creates an empty file in order to reserve the filename, so we need to allow overwriting of existing files
		
			
				
	
	
		
			82 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/qgsziputils.h                                               *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsZipUtils
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Provides utility functions for working with zip files.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsziputils.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    static bool isZipFile( const QString &filename );
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the file name is a zipped file ( i.e with a '.qgz'
 | 
						|
extension, ``False`` otherwise.
 | 
						|
 | 
						|
:param filename: The name of the file
 | 
						|
 | 
						|
:return: ``True`` if the file is zipped, ``False`` otherwise
 | 
						|
%End
 | 
						|
 | 
						|
    static bool unzip( const QString &zip, const QString &dir, QStringList &files /Out/, bool checkConsistency = true );
 | 
						|
%Docstring
 | 
						|
Unzip a zip file in an output directory.
 | 
						|
 | 
						|
:param zip: The zip filename
 | 
						|
:param dir: The output directory
 | 
						|
:param checkConsistency: Perform additional stricter consistency checks
 | 
						|
                         on the archive, and error if they fail (since
 | 
						|
                         QGIS 3.30)
 | 
						|
 | 
						|
:return: - ``False`` if the zip filename does not exist, the output
 | 
						|
           directory does not exist or is not writable.
 | 
						|
         - files: The absolute path of unzipped files
 | 
						|
%End
 | 
						|
 | 
						|
    static bool zip( const QString &zip, const QStringList &files, bool overwrite = false );
 | 
						|
%Docstring
 | 
						|
Zip the list of files in the zip file.
 | 
						|
 | 
						|
If the zip file already exists (and ``overwrite`` is ``False``) or is
 | 
						|
empty, an error is returned. If an input file does not exist, an error
 | 
						|
is also returned.
 | 
						|
 | 
						|
:param zip: The zip filename
 | 
						|
:param files: The absolute path to files to embed within the zip
 | 
						|
:param overwrite: Set to ``True`` to allow overwriting existing files
 | 
						|
                  (since QGIS 3.44)
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    static const QStringList files( const QString &zip );
 | 
						|
%Docstring
 | 
						|
Returns the list of files within a ``zip`` file
 | 
						|
 | 
						|
.. versionadded:: 3.30
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/qgsziputils.h                                               *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 |