QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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
28class QgsCopyFileTask;
29
37class 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
56class 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
82class 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
Task to copy a file on disk.
virtual void cancel()
Cancels content fetching/storing.
Class for QgsExternalStorage fetched content.
virtual QString filePath() const =0
Returns fetched resource file path.
virtual void fetch()=0
Starts fetching.
Class for QgsExternalStorage stored content.
virtual QString url() const =0
Returns stored resource URL.
virtual void store()=0
Starts storing.
Abstract interface for external storage - to be implemented by various backends and registered in Qgs...
virtual QString type() const =0
Unique identifier of the external storage type.
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.
virtual QString displayName() const =0
Returns the translated external storage name, which should be used for any user-visible display of th...