Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads.
More...
#include <qgsnetworkreply.h>
|
| QgsNetworkReplyContent ()=default |
| Default constructor for an empty reply. More...
|
|
| QgsNetworkReplyContent (QNetworkReply *reply) |
| Constructor for QgsNetworkReplyContent, populated from the specified reply. More...
|
|
QVariant | attribute (QNetworkRequest::Attribute code) const |
| Returns the attribute associated with the code. More...
|
|
QMap< QNetworkRequest::Attribute, QVariant > | attributes () const |
| Returns a list of valid attributes received in the reply. More...
|
|
void | clear () |
| Clears the reply, resetting it back to a default, empty reply. More...
|
|
QByteArray | content () const |
| Returns the reply content. More...
|
|
QNetworkReply::NetworkError | error () const |
| Returns the reply's error message, or QNetworkReply::NoError if no error was encountered. More...
|
|
QString | errorString () const |
| Returns the error text for the reply, or an empty string if no error was encountered. More...
|
|
bool | hasRawHeader (const QByteArray &headerName) const |
| Returns true if the reply contains a header with the specified headerName. More...
|
|
QByteArray | rawHeader (const QByteArray &headerName) const |
| Returns the content of the header with the specified headerName, or an empty QByteArray if the specified header was not found in the reply. More...
|
|
QList< QByteArray > | rawHeaderList () const |
| Returns a list of raw header names contained within the reply. More...
|
|
const QList< RawHeaderPair > & | rawHeaderPairs () const |
| Returns the list of raw header pairs in the reply. More...
|
|
QNetworkRequest | request () const |
| Returns the original network request. More...
|
|
int | requestId () const |
| Returns the unique ID identifying the original request which this response was formed from. More...
|
|
void | setContent (const QByteArray &content) |
| Sets the reply content. More...
|
|
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads.
- Since
- QGIS 3.6
Definition at line 28 of file qgsnetworkreply.h.
◆ RawHeaderPair
◆ QgsNetworkReplyContent() [1/2]
QgsNetworkReplyContent::QgsNetworkReplyContent |
( |
| ) |
|
|
default |
Default constructor for an empty reply.
◆ QgsNetworkReplyContent() [2/2]
QgsNetworkReplyContent::QgsNetworkReplyContent |
( |
QNetworkReply * |
reply | ) |
|
|
explicit |
◆ attribute()
QVariant QgsNetworkReplyContent::attribute |
( |
QNetworkRequest::Attribute |
code | ) |
const |
Returns the attribute associated with the code.
If the attribute has not been set, it returns an invalid QVariant.
You can expect the default values listed in QNetworkRequest::Attribute to be applied to the values returned by this function.
- See also
- attributes()
Definition at line 45 of file qgsnetworkreply.cpp.
◆ attributes()
QMap< QNetworkRequest::Attribute, QVariant > QgsNetworkReplyContent::attributes |
( |
| ) |
const |
|
inline |
Returns a list of valid attributes received in the reply.
- See also
- attribute()
- Note
- Not available in Python bindings
Definition at line 66 of file qgsnetworkreply.h.
◆ clear()
void QgsNetworkReplyContent::clear |
( |
| ) |
|
Clears the reply, resetting it back to a default, empty reply.
Definition at line 40 of file qgsnetworkreply.cpp.
◆ content()
QByteArray QgsNetworkReplyContent::content |
( |
| ) |
const |
|
inline |
Returns the reply content.
This is not available by default, as reading network reply content can only be done once.
Blocking network requests (see QgsBlockingNetworkRequest) will automatically populate this content.
- See also
- setContent()
Definition at line 158 of file qgsnetworkreply.h.
◆ error()
QNetworkReply::NetworkError QgsNetworkReplyContent::error |
( |
| ) |
const |
|
inline |
Returns the reply's error message, or QNetworkReply::NoError if no error was encountered.
- See also
- errorString()
Definition at line 75 of file qgsnetworkreply.h.
◆ errorString()
QString QgsNetworkReplyContent::errorString |
( |
| ) |
const |
|
inline |
Returns the error text for the reply, or an empty string if no error was encountered.
- See also
- error()
Definition at line 86 of file qgsnetworkreply.h.
◆ extractFileNameFromContentDispositionHeader()
QString QgsNetworkReplyContent::extractFileNameFromContentDispositionHeader |
( |
const QString & |
header | ) |
|
|
static |
Extracts the filename component of the content disposition header from the header.
- Since
- QGIS 3.28
Definition at line 89 of file qgsnetworkreply.cpp.
◆ extractFilenameFromContentDispositionHeader()
QString QgsNetworkReplyContent::extractFilenameFromContentDispositionHeader |
( |
QNetworkReply * |
reply | ) |
|
|
static |
Extracts the filename component of the content disposition header from a network reply.
- Since
- QGIS 3.28
Definition at line 81 of file qgsnetworkreply.cpp.
◆ hasRawHeader()
bool QgsNetworkReplyContent::hasRawHeader |
( |
const QByteArray & |
headerName | ) |
const |
◆ rawHeader()
QByteArray QgsNetworkReplyContent::rawHeader |
( |
const QByteArray & |
headerName | ) |
const |
◆ rawHeaderList()
QList< QByteArray > QgsNetworkReplyContent::rawHeaderList |
( |
| ) |
const |
◆ rawHeaderPairs()
const QList< RawHeaderPair > & QgsNetworkReplyContent::rawHeaderPairs |
( |
| ) |
const |
|
inline |
◆ request()
QNetworkRequest QgsNetworkReplyContent::request |
( |
| ) |
const |
|
inline |
◆ requestId()
int QgsNetworkReplyContent::requestId |
( |
| ) |
const |
|
inline |
Returns the unique ID identifying the original request which this response was formed from.
Definition at line 135 of file qgsnetworkreply.h.
◆ setContent()
void QgsNetworkReplyContent::setContent |
( |
const QByteArray & |
content | ) |
|
|
inline |
Sets the reply content.
This is not done by default, as reading network reply content can only be done once.
- See also
- content()
Definition at line 148 of file qgsnetworkreply.h.
The documentation for this class was generated from the following files: