mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Set an attribute as private instead of protected
This commit is contained in:
parent
74b3823278
commit
86c63a15b6
@ -67,6 +67,14 @@ class QgsArchive
|
||||
\param filename A file to add when zipping this archive
|
||||
%End
|
||||
|
||||
bool removeFile( const QString &filename );
|
||||
%Docstring
|
||||
Remove a file from this archive and from the filesystem.
|
||||
\param filename The path of the file to remove
|
||||
:return: true if the file has been removed from the filesystem, false otherwise
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
QStringList files() const;
|
||||
%Docstring
|
||||
Returns the list of files within this archive
|
||||
@ -79,8 +87,6 @@ class QgsArchive
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
class QgsProjectArchive : QgsArchive
|
||||
|
@ -95,6 +95,18 @@ void QgsArchive::addFile( const QString &file )
|
||||
mFiles.append( file );
|
||||
}
|
||||
|
||||
bool QgsArchive::removeFile( const QString &file )
|
||||
{
|
||||
bool rc = false;
|
||||
|
||||
if ( !file.isEmpty() && mFiles.contains( file ) && QFile::exists( file ) )
|
||||
rc = QFile::remove( file );
|
||||
|
||||
mFiles.removeOne( file );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
QStringList QgsArchive::files() const
|
||||
{
|
||||
return mFiles;
|
||||
@ -102,7 +114,7 @@ QStringList QgsArchive::files() const
|
||||
|
||||
QString QgsProjectArchive::projectFile() const
|
||||
{
|
||||
Q_FOREACH ( const QString &file, mFiles )
|
||||
Q_FOREACH ( const QString &file, files() )
|
||||
{
|
||||
QFileInfo fileInfo( file );
|
||||
if ( fileInfo.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 )
|
||||
@ -122,14 +134,5 @@ bool QgsProjectArchive::unzip( const QString &filename )
|
||||
|
||||
bool QgsProjectArchive::clearProjectFile()
|
||||
{
|
||||
bool rc = false;
|
||||
QString file = projectFile();
|
||||
|
||||
if ( !file.isEmpty() && QFile::exists( file ) )
|
||||
rc = QFile::remove( file );
|
||||
|
||||
if ( rc )
|
||||
mFiles.removeOne( file );
|
||||
|
||||
return rc;
|
||||
return removeFile( projectFile() );
|
||||
}
|
||||
|
@ -80,6 +80,13 @@ class CORE_EXPORT QgsArchive
|
||||
*/
|
||||
void addFile( const QString &filename );
|
||||
|
||||
/**
|
||||
* Remove a file from this archive and from the filesystem.
|
||||
* \param filename The path of the file to remove
|
||||
* \returns true if the file has been removed from the filesystem, false otherwise
|
||||
*/
|
||||
bool removeFile( const QString &filename );
|
||||
|
||||
/**
|
||||
* Returns the list of files within this archive
|
||||
*/
|
||||
@ -90,11 +97,10 @@ class CORE_EXPORT QgsArchive
|
||||
*/
|
||||
QString dir() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
// content of the archive
|
||||
QStringList mFiles;
|
||||
|
||||
private:
|
||||
// used when unzip is performed
|
||||
std::unique_ptr<QTemporaryDir> mDir;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user