QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgscplhttpfetchoverrider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscplhttpfetchoverrider.h
3 --------------------------
4 begin : September 2020
5 copyright : (C) 2020 by Even Rouault
6 email : even.rouault at spatialys.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 QGSCPLHTTPFETCHOVERRIDER_H
17#define QGSCPLHTTPFETCHOVERRIDER_H
18
19#define SIP_NO_FILE
20
21#include <QNetworkRequest>
22#include <QString>
23#include <QPointer>
24
25#include "qgis_core.h"
26#include "cpl_http.h"
27#include "gdal.h"
28
29class QgsFeedback;
30
41class CORE_EXPORT QgsCPLHTTPFetchOverrider
42{
43 public:
45 explicit QgsCPLHTTPFetchOverrider( const QString &authCfg = QString(), QgsFeedback *feedback = nullptr );
46
49
51 void setAttribute( QNetworkRequest::Attribute code, const QVariant &value );
52
58 void setFeedback( QgsFeedback *feedback );
59
65 QThread *thread() const;
66
67 private:
68
69#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,2,0)
70 static CPLHTTPResult *callback( const char *pszURL,
71 CSLConstList papszOptions,
72 GDALProgressFunc pfnProgress,
73 void *pProgressArg,
74 CPLHTTPFetchWriteFunc pfnWrite,
75 void *pWriteArg,
76 void *pUserData );
77#endif
78
79 QString mAuthCfg;
80
81 QgsFeedback *mFeedback = nullptr;
82
83 QPointer< QThread > mThread;
84
85 std::map<QNetworkRequest::Attribute, QVariant> mAttributes;
86};
87
88#endif // QGSCPLHTTPFETCHOVERRIDER_H
Utility class to redirect GDAL's CPL HTTP calls through QgsBlockingNetworkRequest.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44