QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsprojectstorage.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprojectstorage.h
3  --------------------------------------
4  Date : March 2018
5  Copyright : (C) 2018 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSPROJECTSTORAGE_H
17 #define QGSPROJECTSTORAGE_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 
22 #include <QDateTime>
23 #include <QString>
24 
25 class QIODevice;
26 
28 
36 class CORE_EXPORT QgsProjectStorage
37 {
38  public:
39 
45  class Metadata
46  {
47  public:
49  QString name;
51  QDateTime lastModified;
52  };
53 
54  virtual ~QgsProjectStorage() = default;
55 
60  virtual QString type() = 0;
61 
71  virtual bool isSupportedUri( const QString &uri ) const;
72 
74  virtual QStringList listProjects( const QString &uri ) = 0;
75 
82  virtual bool readProject( const QString &uri, QIODevice *device, QgsReadWriteContext &context ) = 0;
83 
90  virtual bool writeProject( const QString &uri, QIODevice *device, QgsReadWriteContext &context ) = 0;
91 
96  virtual bool removeProject( const QString &uri ) = 0;
97 
102  virtual bool renameProject( const QString &uri, const QString &uriNew ) { Q_UNUSED( uri ) Q_UNUSED( uriNew ); return false; }
103 
108  virtual bool readProjectStorageMetadata( const QString &uri, QgsProjectStorage::Metadata &metadata SIP_OUT ) { Q_UNUSED( uri ) Q_UNUSED( metadata ); return false; }
109 
116  virtual QString filePath( const QString &uri );
117 
124  Q_DECL_DEPRECATED virtual QString visibleName() SIP_DEPRECATED { return QString(); }
125 
131  Q_DECL_DEPRECATED virtual QString showLoadGui() SIP_DEPRECATED { return QString(); }
132 
138  Q_DECL_DEPRECATED virtual QString showSaveGui() SIP_DEPRECATED { return QString(); }
139 
140 };
141 
142 #endif // QGSPROJECTSTORAGE_H
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
SIP_OUT
#define SIP_OUT
Definition: qgis_sip.h:58
QgsProjectStorage::Metadata::lastModified
QDateTime lastModified
Date and local time when the file was last modified.
Definition: qgsprojectstorage.h:51
QgsProjectStorage::Metadata
Metadata associated with a project.
Definition: qgsprojectstorage.h:45
QgsProjectStorage
Abstract interface for project storage - to be implemented by various backends and registered in QgsP...
Definition: qgsprojectstorage.h:36
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsProjectStorage::showSaveGui
virtual Q_DECL_DEPRECATED QString showSaveGui()
Opens GUI to allow user to select where a project should be saved (GUI specific to this storage type)...
Definition: qgsprojectstorage.h:138
QgsProjectStorage::readProjectStorageMetadata
virtual bool readProjectStorageMetadata(const QString &uri, QgsProjectStorage::Metadata &metadata)
Reads project metadata (e.g.
Definition: qgsprojectstorage.h:108
qgis_sip.h
QgsProjectStorage::renameProject
virtual bool renameProject(const QString &uri, const QString &uriNew)
Rename an existing project at the given URI to a different URI.
Definition: qgsprojectstorage.h:102
QgsProjectStorage::showLoadGui
virtual Q_DECL_DEPRECATED QString showLoadGui()
Opens GUI to allow user to select a project to be loaded (GUI specific to this storage type).
Definition: qgsprojectstorage.h:131
QgsProjectStorage::visibleName
virtual Q_DECL_DEPRECATED QString visibleName()
Returns human-readable name of the storage.
Definition: qgsprojectstorage.h:124
QgsProjectStorage::Metadata::name
QString name
Name of the project - equivalent to a file's base name (i.e. without path and extension).
Definition: qgsprojectstorage.h:49