QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsexternalstorage.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsexternalstorage.cpp
3  --------------------------------------
4  Date : March 2021
5  Copyright : (C) 2021 by Julien Cabieces
6  Email : julien dot cabieces at oslandia 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 #include "qgsexternalstorage.h"
17 
18 void QgsExternalStorageContent::reportError( const QString &errorMsg )
19 {
21  mErrorString = errorMsg;
23 }
24 
26 {
27  return mStatus;
28 }
29 
31 {
32  return mErrorString;
33 };
34 
35 QgsExternalStorageStoredContent *QgsExternalStorage::store( const QString &filePath, const QString &url, const QString &authCfg, Qgis::ActionStart storingMode ) const
36 {
37  QgsExternalStorageStoredContent *content = doStore( filePath, url, authCfg );
38  if ( storingMode == Qgis::ActionStart::Immediate )
39  content->store();
40 
41  return content;
42 }
43 
44 QgsExternalStorageFetchedContent *QgsExternalStorage::fetch( const QString &url, const QString &authCfg, Qgis::ActionStart fetchingMode ) const
45 {
46  QgsExternalStorageFetchedContent *content = doFetch( url, authCfg );
47  if ( fetchingMode == Qgis::ActionStart::Immediate )
48  content->fetch();
49 
50  return content;
51 }
Qgis::ContentStatus
ContentStatus
Status for fetched or stored content.
Definition: qgis.h:818
QgsExternalStorage::doFetch
virtual QgsExternalStorageFetchedContent * doFetch(const QString &url, const QString &authCfg=QString()) const =0
Fetches file from url using authCfg for this project external storage.
QgsExternalStorageFetchedContent
Class for QgsExternalStorage fetched content.
Definition: qgsexternalstorage.h:170
Qgis::ContentStatus::Failed
@ Failed
Content fetching/storing has failed.
QgsExternalStorage::store
QgsExternalStorageStoredContent * store(const QString &filePath, const QString &url, const QString &authCfg=QString(), Qgis::ActionStart storingMode=Qgis::ActionStart::Deferred) const
Stores file filePath to the url for this project external storage.
Definition: qgsexternalstorage.cpp:35
Qgis::ActionStart
ActionStart
Enum to determine when an operation would begin.
Definition: qgis.h:521
QgsExternalStorage::doStore
virtual QgsExternalStorageStoredContent * doStore(const QString &filePath, const QString &url, const QString &authCfg=QString()) const =0
Stores file filePath to the url using authCfg authentication for this project external storage.
qgsexternalstorage.h
QgsExternalStorageContent::mStatus
Qgis::ContentStatus mStatus
Definition: qgsexternalstorage.h:160
QgsExternalStorageStoredContent
Class for QgsExternalStorage stored content.
Definition: qgsexternalstorage.h:200
QgsExternalStorageStoredContent::store
virtual void store()=0
Starts storing.
QgsExternalStorageContent::reportError
void reportError(const QString &errorMsg)
Update content according to given errorMsg error message Inherited classes should call this method wh...
Definition: qgsexternalstorage.cpp:18
QgsExternalStorageContent::errorOccurred
void errorOccurred(const QString &errorString)
The signal is emitted when an error occurred.
QgsExternalStorage::fetch
QgsExternalStorageFetchedContent * fetch(const QString &url, const QString &authCfg=QString(), Qgis::ActionStart fetchingMode=Qgis::ActionStart::Deferred) const
Fetches file from url for this project external storage.
Definition: qgsexternalstorage.cpp:44
QgsExternalStorageContent::errorString
const QString & errorString() const
Returns error textual description if an error occurred and status() returns Failed.
Definition: qgsexternalstorage.cpp:30
QgsExternalStorageContent::status
Qgis::ContentStatus status() const
Returns content status.
Definition: qgsexternalstorage.cpp:25
QgsExternalStorageFetchedContent::fetch
virtual void fetch()=0
Starts fetching.
QgsExternalStorageContent::mErrorString
QString mErrorString
Definition: qgsexternalstorage.h:161