QGIS API Documentation  3.25.0-Master (dec16ba68b)
Public Member Functions | Static Public Attributes | List of all members
QgsHttpHeaders Class Reference

This class implements simple http header management. More...

#include <qgshttpheaders.h>

Public Member Functions

 QgsHttpHeaders ()
 default constructor More...
 
 QgsHttpHeaders (const QgsSettings &settings, const QString &key=QString())
 Constructor from QgsSettings settings object. More...
 
 QgsHttpHeaders (const QMap< QString, QVariant > &headers)
 Constructor from map. More...
 
virtual ~QgsHttpHeaders ()
 
QList< QString > keys () const
 
QgsHttpHeadersoperator= (const QMap< QString, QVariant > &headers)
 
QVariant & operator[] (const QString &key)
 
const QVariant operator[] (const QString &key) const
 
void setFromSettings (const QgsSettings &settings, const QString &key=QString())
 Loads headers from the settings. More...
 
bool updateNetworkRequest (QNetworkRequest &request) const
 Updates a request by adding all the HTTP headers. More...
 
void updateSettings (QgsSettings &settings, const QString &key=QString()) const
 Updates the settings by adding all the http headers in the path "key/KEY_PREFIX/". More...
 

Static Public Attributes

static const QString KEY_PREFIX = "http-header/"
 Used in settings. More...
 

Detailed Description

This class implements simple http header management.

Since
QGIS 3.24

Definition at line 35 of file qgshttpheaders.h.

Constructor & Destructor Documentation

◆ QgsHttpHeaders() [1/3]

QgsHttpHeaders::QgsHttpHeaders ( const QMap< QString, QVariant > &  headers)

Constructor from map.

Parameters
headers

Definition at line 31 of file qgshttpheaders.cpp.

◆ QgsHttpHeaders() [2/3]

QgsHttpHeaders::QgsHttpHeaders ( )
default

default constructor

◆ QgsHttpHeaders() [3/3]

QgsHttpHeaders::QgsHttpHeaders ( const QgsSettings settings,
const QString &  key = QString() 
)

Constructor from QgsSettings settings object.

Parameters
settings
key

Definition at line 37 of file qgshttpheaders.cpp.

◆ ~QgsHttpHeaders()

QgsHttpHeaders::~QgsHttpHeaders ( )
virtualdefault

Member Function Documentation

◆ keys()

QList< QString > QgsHttpHeaders::keys ( ) const
Returns
the list of all http header keys

Definition at line 108 of file qgshttpheaders.cpp.

◆ operator=()

QgsHttpHeaders & QgsHttpHeaders::operator= ( const QMap< QString, QVariant > &  headers)

Definition at line 102 of file qgshttpheaders.cpp.

◆ operator[]() [1/2]

QVariant & QgsHttpHeaders::operator[] ( const QString &  key)
Parameters
keyhttp header key name
Returns
http header value

Definition at line 92 of file qgshttpheaders.cpp.

◆ operator[]() [2/2]

const QVariant QgsHttpHeaders::operator[] ( const QString &  key) const
Parameters
keyhttp header key name
Returns
http header value

Definition at line 97 of file qgshttpheaders.cpp.

◆ setFromSettings()

void QgsHttpHeaders::setFromSettings ( const QgsSettings settings,
const QString &  key = QString() 
)

Loads headers from the settings.

Parameters
settings
keysub group path

Definition at line 70 of file qgshttpheaders.cpp.

◆ updateNetworkRequest()

bool QgsHttpHeaders::updateNetworkRequest ( QNetworkRequest &  request) const

Updates a request by adding all the HTTP headers.

Returns
true if the update succeed

Definition at line 44 of file qgshttpheaders.cpp.

◆ updateSettings()

void QgsHttpHeaders::updateSettings ( QgsSettings settings,
const QString &  key = QString() 
) const

Updates the settings by adding all the http headers in the path "key/KEY_PREFIX/".

Parameters
settings
keysub group path

Definition at line 53 of file qgshttpheaders.cpp.

Member Data Documentation

◆ KEY_PREFIX

const QString QgsHttpHeaders::KEY_PREFIX = "http-header/"
static

Used in settings.

Definition at line 44 of file qgshttpheaders.h.


The documentation for this class was generated from the following files: