QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgshttpheaders.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshttpheaders.h
3 This class implements simple http header management.
4
5 -------------------
6 begin : 2021-09-09
7 copyright : (C) 2021 B. De Mezzo
8 email : benoit dot de dot mezzo at oslandia dot com
9
10***************************************************************************/
11
12/***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
20
21#ifndef QGSHTTPHEADERS_H
22#define QGSHTTPHEADERS_H
23
24#include <QMap>
25#include <QVariant>
26
27#include "qgis_core.h"
28#include "qgis_sip.h"
29
30
31class QNetworkRequest;
32class QUrlQuery;
33class QDomElement;
34class QgsSettings;
35
41class CORE_EXPORT QgsHttpHeaders
42{
43 public:
44
45#ifndef SIP_RUN
46
48 static const QString PATH_PREFIX;
49
51 static const QString KEY_REFERER;
52
54 static const QString PARAM_PREFIX;
55
56#endif
57
62 QgsHttpHeaders( const QVariantMap &headers );
63
65
72 Q_DECL_DEPRECATED QgsHttpHeaders( const QgsSettings &settings, const QString &key = QString() ) SIP_DEPRECATED;
73
78 QgsHttpHeaders( const QString &key );
79
84 QgsHttpHeaders( const QDomElement &element );
85
87 virtual ~QgsHttpHeaders();
88
93 QVariantMap headers() const {return mHeaders;}
94
105 Q_DECL_DEPRECATED bool updateSettings( QgsSettings &settings, const QString &key = QString() ) const SIP_DEPRECATED;
106
111 bool updateNetworkRequest( QNetworkRequest &request ) const;
112
117 bool updateUrlQuery( QUrlQuery &uri ) const;
118
126 bool updateMap( QVariantMap &map ) const;
127
135 bool updateDomElement( QDomElement &el ) const;
136
145 void setFromSettings( const QgsSettings &settings, const QString &key = QString() );
146
151 void setFromUrlQuery( const QUrlQuery &uri );
152
160 void setFromMap( const QVariantMap &map );
161
169 void setFromDomElement( const QDomElement &element );
170
175 QString sanitizeKey( const QString &key ) const;
176
181 QVariant &operator[]( const QString &key );
182
183 QgsHttpHeaders &operator = ( const QMap<QString, QVariant> &headers ) SIP_SKIP;
184
190 void insert( const QString &key, const QVariant &value );
191
195 QList<QString> keys() const;
196
198 QString toSpacedString() const;
199
200#ifndef SIP_RUN
201
206 const QVariant operator[]( const QString &key ) const;
207#endif
208
209 private:
210 QMap<QString, QVariant> mHeaders;
211};
212
213#endif // QGSHTTPHEADERS_H
This class implements simple http header management.
static const QString PARAM_PREFIX
Used in uri to pass headers as params.
static const QString KEY_REFERER
Used in settings as the referer key.
static const QString PATH_PREFIX
Used in settings as the group name.
This class is a composition of two QSettings instances:
Definition qgssettings.h:64
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126