mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -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
|
\param filename A file to add when zipping this archive
|
||||||
%End
|
%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;
|
QStringList files() const;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns the list of files within this archive
|
Returns the list of files within this archive
|
||||||
@ -79,8 +87,6 @@ class QgsArchive
|
|||||||
:rtype: str
|
:rtype: str
|
||||||
%End
|
%End
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QgsProjectArchive : QgsArchive
|
class QgsProjectArchive : QgsArchive
|
||||||
|
@ -95,6 +95,18 @@ void QgsArchive::addFile( const QString &file )
|
|||||||
mFiles.append( 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
|
QStringList QgsArchive::files() const
|
||||||
{
|
{
|
||||||
return mFiles;
|
return mFiles;
|
||||||
@ -102,7 +114,7 @@ QStringList QgsArchive::files() const
|
|||||||
|
|
||||||
QString QgsProjectArchive::projectFile() const
|
QString QgsProjectArchive::projectFile() const
|
||||||
{
|
{
|
||||||
Q_FOREACH ( const QString &file, mFiles )
|
Q_FOREACH ( const QString &file, files() )
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo( file );
|
QFileInfo fileInfo( file );
|
||||||
if ( fileInfo.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 )
|
if ( fileInfo.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 )
|
||||||
@ -122,14 +134,5 @@ bool QgsProjectArchive::unzip( const QString &filename )
|
|||||||
|
|
||||||
bool QgsProjectArchive::clearProjectFile()
|
bool QgsProjectArchive::clearProjectFile()
|
||||||
{
|
{
|
||||||
bool rc = false;
|
return removeFile( projectFile() );
|
||||||
QString file = projectFile();
|
|
||||||
|
|
||||||
if ( !file.isEmpty() && QFile::exists( file ) )
|
|
||||||
rc = QFile::remove( file );
|
|
||||||
|
|
||||||
if ( rc )
|
|
||||||
mFiles.removeOne( file );
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,13 @@ class CORE_EXPORT QgsArchive
|
|||||||
*/
|
*/
|
||||||
void addFile( const QString &filename );
|
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
|
* Returns the list of files within this archive
|
||||||
*/
|
*/
|
||||||
@ -90,11 +97,10 @@ class CORE_EXPORT QgsArchive
|
|||||||
*/
|
*/
|
||||||
QString dir() const;
|
QString dir() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
// content of the archive
|
// content of the archive
|
||||||
QStringList mFiles;
|
QStringList mFiles;
|
||||||
|
|
||||||
private:
|
|
||||||
// used when unzip is performed
|
// used when unzip is performed
|
||||||
std::unique_ptr<QTemporaryDir> mDir;
|
std::unique_ptr<QTemporaryDir> mDir;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user