QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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
68
75 Q_DECL_DEPRECATED QgsHttpHeaders( const QgsSettings &settings, const QString &key = QString() ) SIP_DEPRECATED;
76
81 QgsHttpHeaders( const QString &key );
82
87 QgsHttpHeaders( const QDomElement &element );
88
90 virtual ~QgsHttpHeaders();
91
96 QVariantMap headers() const {return mHeaders;}
97
108 Q_DECL_DEPRECATED bool updateSettings( QgsSettings &settings, const QString &key = QString() ) const SIP_DEPRECATED;
109
114 bool updateNetworkRequest( QNetworkRequest &request ) const;
115
120 bool updateUrlQuery( QUrlQuery &uri ) const;
121
129 bool updateMap( QVariantMap &map ) const;
130
138 bool updateDomElement( QDomElement &el ) const;
139
148 void setFromSettings( const QgsSettings &settings, const QString &key = QString() );
149
154 void setFromUrlQuery( const QUrlQuery &uri );
155
163 void setFromMap( const QVariantMap &map );
164
172 void setFromDomElement( const QDomElement &element );
173
178 QString sanitizeKey( const QString &key ) const;
179
184 QVariant &operator[]( const QString &key );
185
186 QgsHttpHeaders &operator = ( const QMap<QString, QVariant> &headers ) SIP_SKIP;
187
193 void insert( const QString &key, const QVariant &value );
194
198 QList<QString> keys() const;
199
201 QString toSpacedString() const;
202
203#ifndef SIP_RUN
204
209 const QVariant operator[]( const QString &key ) const;
210#endif
211
212 private:
213 QMap<QString, QVariant> mHeaders;
214};
215
216#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.
QgsHttpHeaders()
default constructor
static const QString PATH_PREFIX
Used in settings as the group name.
This class is a composition of two QSettings instances:
Definition: qgssettings.h:63
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_SKIP
Definition: qgis_sip.h:126