QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgssimplecopyexternalstorage_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssimplecopyexternalstorage_p.h
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 #ifndef QGSSIMPLECOPYEXTERNALSTORAGE_H
17 #define QGSSIMPLECOPYEXTERNALSTORAGE_H
18 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 
23 #include <QPointer>
24 
26 #define SIP_NO_FILE
27 
28 class QgsCopyFileTask;
29 
37 class CORE_EXPORT QgsSimpleCopyExternalStorage : public QgsExternalStorage
38 {
39  public:
40 
41  QString type() const override;
42 
43  QString displayName() const override;
44 
45  QgsExternalStorageStoredContent *doStore( const QString &filePath, const QString &url, const QString &authcfg = QString() ) const override;
46 
47  QgsExternalStorageFetchedContent *doFetch( const QString &url, const QString &authConfig = QString() ) const override;
48 };
49 
56 class QgsSimpleCopyExternalStorageStoredContent : public QgsExternalStorageStoredContent
57 {
58  Q_OBJECT
59 
60  public:
61 
62  QgsSimpleCopyExternalStorageStoredContent( const QString &filePath, const QString &url, const QString &authcfg = QString() );
63 
64  void cancel() override;
65 
66  QString url() const override;
67 
68  void store() override;
69 
70  private:
71 
72  QPointer<QgsCopyFileTask> mCopyTask;
73  QString mUrl;
74 };
75 
82 class QgsSimpleCopyExternalStorageFetchedContent : public QgsExternalStorageFetchedContent
83 {
84  Q_OBJECT
85 
86  public:
87 
88  QgsSimpleCopyExternalStorageFetchedContent( const QString &filePath );
89 
90  QString filePath() const override;
91 
92  void fetch() override;
93 
94  private:
95 
96  QString mFilePath;
97  QString mResultFilePath;
98 };
99 
101 #endif // QGSSIMPLECOPYEXTERNALSTORAGE_H
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
QgsExternalStorage::displayName
virtual QString displayName() const =0
Returns the translated external storage name, which should be used for any user-visible display of th...
QgsCopyFileTask
Task to copy a file on disk.
Definition: qgscopyfiletask.h:27
QgsExternalStorageFetchedContent::filePath
virtual QString filePath() const =0
Returns fetched resource file path.
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
qgis_sip.h
QgsExternalStorageStoredContent
Class for QgsExternalStorage stored content.
Definition: qgsexternalstorage.h:200
QgsExternalStorageStoredContent::store
virtual void store()=0
Starts storing.
QgsExternalStorageStoredContent::url
virtual QString url() const =0
Returns stored resource URL.
QgsExternalStorage
Abstract interface for external storage - to be implemented by various backends and registered in Qgs...
Definition: qgsexternalstorage.h:36
QgsExternalStorageFetchedContent::fetch
virtual void fetch()=0
Starts fetching.
QgsExternalStorage::type
virtual QString type() const =0
Unique identifier of the external storage type.
QgsExternalStorageContent::cancel
virtual void cancel()
Cancels content fetching/storing.
Definition: qgsexternalstorage.h:132