QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
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
20#include <cpl_http.h>
21#include <gdal.h>
22
23#include "qgis_core.h"
24
25#include <QNetworkRequest>
26#include <QPointer>
27#include <QString>
28
29#define SIP_NO_FILE
30
31class QgsFeedback;
32
43class CORE_EXPORT QgsCPLHTTPFetchOverrider
44{
45 public:
47 explicit QgsCPLHTTPFetchOverrider( const QString &authCfg = QString(), QgsFeedback *feedback = nullptr );
48
50
52 void setAttribute( QNetworkRequest::Attribute code, const QVariant &value );
53
59 void setFeedback( QgsFeedback *feedback );
60
66 QThread *thread() const;
67
68 private:
69
70#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,2,0)
71 static CPLHTTPResult *callback( const char *pszURL,
72 CSLConstList papszOptions,
73 GDALProgressFunc pfnProgress,
74 void *pProgressArg,
75 CPLHTTPFetchWriteFunc pfnWrite,
76 void *pWriteArg,
77 void *pUserData );
78#endif
79
80 QString mAuthCfg;
81
82 QgsFeedback *mFeedback = nullptr;
83
84 QPointer< QThread > mThread;
85
86 std::map<QNetworkRequest::Attribute, QVariant> mAttributes;
87};
88
89#endif // QGSCPLHTTPFETCHOVERRIDER_H
QgsCPLHTTPFetchOverrider(const QString &authCfg=QString(), QgsFeedback *feedback=nullptr)
Installs the redirection for the current thread.
void setAttribute(QNetworkRequest::Attribute code, const QVariant &value)
Define attribute that must be forwarded to the actual QNetworkRequest.
QThread * thread() const
Returns the thread associated with the overrider.
void setFeedback(QgsFeedback *feedback)
Sets the feedback cancellation object for the redirection.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44