QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
19#include "qgsexternalstorage.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23#include <QPointer>
24
26#define SIP_NO_FILE
27
28class QgsCopyFileTask;
29
36class CORE_EXPORT QgsSimpleCopyExternalStorage : public QgsExternalStorage
37{
38 public:
39
40 QString type() const override;
41
42 QString displayName() const override;
43
44 QgsExternalStorageStoredContent *doStore( const QString &filePath, const QString &url, const QString &authcfg = QString() ) const override;
45
46 QgsExternalStorageFetchedContent *doFetch( const QString &url, const QString &authConfig = QString() ) const override;
47};
48
54class QgsSimpleCopyExternalStorageStoredContent : public QgsExternalStorageStoredContent
55{
56 Q_OBJECT
57
58 public:
59
60 QgsSimpleCopyExternalStorageStoredContent( const QString &filePath, const QString &url, const QString &authcfg = QString() );
61
62 void cancel() override;
63
64 QString url() const override;
65
66 void store() override;
67
68 private:
69
70 QPointer<QgsCopyFileTask> mCopyTask;
71 QString mUrl;
72};
73
79class QgsSimpleCopyExternalStorageFetchedContent : public QgsExternalStorageFetchedContent
80{
81 Q_OBJECT
82
83 public:
84
85 QgsSimpleCopyExternalStorageFetchedContent( const QString &filePath );
86
87 QString filePath() const override;
88
89 void fetch() override;
90
91 private:
92
93 QString mFilePath;
94 QString mResultFilePath;
95};
96
98#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...