QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
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
18void QgsExternalStorageContent::reportError( const QString &errorMsg )
19{
21 mErrorString = errorMsg;
23}
24
29
31{
32 return mStatus;
33}
34
36{
37 return mErrorString;
38};
39
40QgsExternalStorageStoredContent *QgsExternalStorage::store( const QString &filePath, const QString &url, const QString &authCfg, Qgis::ActionStart storingMode ) const
41{
42 QgsExternalStorageStoredContent *content = doStore( filePath, url, authCfg );
43 if ( storingMode == Qgis::ActionStart::Immediate )
44 content->store();
45
46 return content;
47}
48
49QgsExternalStorageFetchedContent *QgsExternalStorage::fetch( const QString &url, const QString &authCfg, Qgis::ActionStart fetchingMode ) const
50{
51 QgsExternalStorageFetchedContent *content = doFetch( url, authCfg );
52 if ( fetchingMode == Qgis::ActionStart::Immediate )
53 content->fetch();
54
55 return content;
56}
ContentStatus
Status for fetched or stored content.
Definition qgis.h:1692
@ Failed
Content fetching/storing has failed.
ActionStart
Enum to determine when an operation would begin.
Definition qgis.h:1074
@ Immediate
Action will start immediately.
void reportError(const QString &errorMsg)
Update content according to given errorMsg error message Inherited classes should call this method wh...
void setStatus(Qgis::ContentStatus status)
Sets the external storage status.
void errorOccurred(const QString &errorString)
The signal is emitted when an error occurred.
Qgis::ContentStatus status() const
Returns content status.
const QString & errorString() const
Returns error textual description if an error occurred and status() returns Failed.
Class for QgsExternalStorage fetched content.
virtual void fetch()=0
Starts fetching.
Class for QgsExternalStorage stored content.
virtual void store()=0
Starts storing.
virtual QgsExternalStorageFetchedContent * doFetch(const QString &url, const QString &authCfg=QString()) const =0
Fetches file from url using authCfg for this project external storage.
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.
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.
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.