QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
This class implements simple http header management. More...
#include <qgshttpheaders.h>
Public Member Functions | |
QgsHttpHeaders () | |
default constructor More... | |
QgsHttpHeaders (const QDomElement &element) | |
Constructor from a QDomElement element. More... | |
QgsHttpHeaders (const QgsSettings &settings, const QString &key=QString()) | |
Constructor from QgsSettings settings object and root key. More... | |
QgsHttpHeaders (const QMap< QString, QVariant > &headers) | |
Constructor from map. More... | |
QgsHttpHeaders (const QString &key) | |
Constructor from default QgsSettings object and root key. More... | |
virtual | ~QgsHttpHeaders () |
default detructor More... | |
QList< QString > | keys () const |
QgsHttpHeaders & | operator= (const QMap< QString, QVariant > &headers) |
QVariant & | operator[] (const QString &key) |
const QVariant | operator[] (const QString &key) const |
QString | sanitizeKey (const QString &key) const |
Returns a cleansed key. More... | |
void | setFromDomElement (const QDomElement &element) |
Loads headers from the element. More... | |
void | setFromMap (const QVariantMap &map) |
Loads headers from the map. More... | |
void | setFromSettings (const QgsSettings &settings, const QString &key=QString()) |
Loads headers from the settings. More... | |
void | setFromUrlQuery (const QUrlQuery &uri) |
Loads headers from the uri. More... | |
QString | toSpacedString () const |
Returns key/value pairs as strings separated by space. More... | |
bool | updateDomElement (QDomElement &el) const |
Updates a map by adding all the HTTP headers. More... | |
bool | updateMap (QVariantMap &map) const |
Updates a map by adding all the HTTP headers. More... | |
bool | updateNetworkRequest (QNetworkRequest &request) const |
Updates a request by adding all the HTTP headers. More... | |
bool | updateSettings (QgsSettings &settings, const QString &key=QString()) const |
Updates the settings by adding all the http headers in the path "key/PATH_PREFIX/". More... | |
bool | updateUrlQuery (QUrlQuery &uri) const |
Updates an uri by adding all the HTTP headers. More... | |
Static Public Attributes | |
static const QString | KEY_REFERER = "referer" |
Used in settings as the referer key. More... | |
static const QString | PARAM_PREFIX = "http-header:" |
Used in uri to pass headers as params. More... | |
static const QString | PATH_PREFIX = "http-header/" |
Used in settings as the group name. More... | |
This class implements simple http header management.
Definition at line 38 of file qgshttpheaders.h.
QgsHttpHeaders::QgsHttpHeaders | ( | const QMap< QString, QVariant > & | headers | ) |
|
default |
default constructor
QgsHttpHeaders::QgsHttpHeaders | ( | const QgsSettings & | settings, |
const QString & | key = QString() |
||
) |
Constructor from QgsSettings settings object and root key.
settings | |
key |
Definition at line 44 of file qgshttpheaders.cpp.
QgsHttpHeaders::QgsHttpHeaders | ( | const QString & | key | ) |
Constructor from default QgsSettings object and root key.
key |
Definition at line 49 of file qgshttpheaders.cpp.
QgsHttpHeaders::QgsHttpHeaders | ( | const QDomElement & | element | ) |
Constructor from a QDomElement element.
element |
Definition at line 54 of file qgshttpheaders.cpp.
|
virtualdefault |
default detructor
QList< QString > QgsHttpHeaders::keys | ( | ) | const |
Definition at line 271 of file qgshttpheaders.cpp.
QgsHttpHeaders & QgsHttpHeaders::operator= | ( | const QMap< QString, QVariant > & | headers | ) |
Definition at line 265 of file qgshttpheaders.cpp.
QVariant & QgsHttpHeaders::operator[] | ( | const QString & | key | ) |
key | http header key name |
Definition at line 255 of file qgshttpheaders.cpp.
const QVariant QgsHttpHeaders::operator[] | ( | const QString & | key | ) | const |
key | http header key name |
Definition at line 260 of file qgshttpheaders.cpp.
QString QgsHttpHeaders::sanitizeKey | ( | const QString & | key | ) | const |
Returns a cleansed key.
key | a key to be sanitized |
Definition at line 248 of file qgshttpheaders.cpp.
void QgsHttpHeaders::setFromDomElement | ( | const QDomElement & | element | ) |
Loads headers from the element.
key KEY_REFERER will be read from attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility)
element |
Definition at line 209 of file qgshttpheaders.cpp.
void QgsHttpHeaders::setFromMap | ( | const QVariantMap & | map | ) |
Loads headers from the map.
key KEY_REFERER will be read from key "KEY_PREFIX+KEY_REFERER" and key "KEY_REFERER" (for backward compatibility)
map |
Definition at line 190 of file qgshttpheaders.cpp.
void QgsHttpHeaders::setFromSettings | ( | const QgsSettings & | settings, |
const QString & | key = QString() |
||
) |
Loads headers from the settings.
key KEY_REFERER will be read at path "key/PATH_PREFIX/KEY_REFERER" and path "key/KEY_REFERER" (for backward compatibility)
settings | |
key | sub group path |
Definition at line 140 of file qgshttpheaders.cpp.
void QgsHttpHeaders::setFromUrlQuery | ( | const QUrlQuery & | uri | ) |
QString QgsHttpHeaders::toSpacedString | ( | ) | const |
Returns key/value pairs as strings separated by space.
Definition at line 231 of file qgshttpheaders.cpp.
bool QgsHttpHeaders::updateDomElement | ( | QDomElement & | el | ) | const |
Updates a map by adding all the HTTP headers.
KEY_REFERER value will be available at attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility)
true
if the update succeed Definition at line 122 of file qgshttpheaders.cpp.
bool QgsHttpHeaders::updateMap | ( | QVariantMap & | map | ) | const |
Updates a map by adding all the HTTP headers.
KEY_REFERER value will be available at key "KEY_PREFIX+KEY_REFERER" and key "KEY_REFERER" (for backward compatibility)
true
if the update succeed Definition at line 107 of file qgshttpheaders.cpp.
bool QgsHttpHeaders::updateNetworkRequest | ( | QNetworkRequest & | request | ) | const |
Updates a request by adding all the HTTP headers.
true
if the update succeed Definition at line 61 of file qgshttpheaders.cpp.
bool QgsHttpHeaders::updateSettings | ( | QgsSettings & | settings, |
const QString & | key = QString() |
||
) | const |
Updates the settings by adding all the http headers in the path "key/PATH_PREFIX/".
KEY_REFERER value will be available at path "key/PATH_PREFIX/KEY_REFERER" and path "key/KEY_REFERER" (for backward compatibility)
settings | |
key | sub group path |
true
if the update succeed Definition at line 79 of file qgshttpheaders.cpp.
bool QgsHttpHeaders::updateUrlQuery | ( | QUrlQuery & | uri | ) | const |
Updates an uri by adding all the HTTP headers.
true
if the update succeed Definition at line 70 of file qgshttpheaders.cpp.
|
static |
Used in settings as the referer key.
Definition at line 48 of file qgshttpheaders.h.
|
static |
Used in uri to pass headers as params.
Definition at line 51 of file qgshttpheaders.h.
|
static |
Used in settings as the group name.
Definition at line 45 of file qgshttpheaders.h.