QGIS API Documentation
3.6.0-Noosa (5873452)
|
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads. More...
#include <qgsnetworkreply.h>
Public Types | |
typedef QPair< QByteArray, QByteArray > | RawHeaderPair |
Public Member Functions | |
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.
Definition at line 28 of file qgsnetworkreply.h.
typedef QPair<QByteArray, QByteArray> QgsNetworkReplyContent::RawHeaderPair |
Definition at line 92 of file qgsnetworkreply.h.
|
default |
Default constructor for an empty reply.
|
explicit |
Constructor for QgsNetworkReplyContent, populated from the specified reply.
Definition at line 19 of file qgsnetworkreply.cpp.
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.
Definition at line 46 of file qgsnetworkreply.cpp.
|
inline |
Returns a list of valid attributes received in the reply.
Definition at line 66 of file qgsnetworkreply.h.
void QgsNetworkReplyContent::clear | ( | ) |
Clears the reply, resetting it back to a default, empty reply.
Definition at line 41 of file qgsnetworkreply.cpp.
|
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.
Definition at line 158 of file qgsnetworkreply.h.
|
inline |
Returns the reply's error message, or QNetworkReply::NoError if no error was encountered.
Definition at line 75 of file qgsnetworkreply.h.
|
inline |
Returns the error text for the reply, or an empty string if no error was encountered.
Definition at line 86 of file qgsnetworkreply.h.
bool QgsNetworkReplyContent::hasRawHeader | ( | const QByteArray & | headerName | ) | const |
Returns true if the reply contains a header with the specified headerName.
Definition at line 51 of file qgsnetworkreply.cpp.
QByteArray QgsNetworkReplyContent::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.
Definition at line 72 of file qgsnetworkreply.cpp.
QList< QByteArray > QgsNetworkReplyContent::rawHeaderList | ( | ) | const |
Returns a list of raw header names contained within the reply.
Definition at line 61 of file qgsnetworkreply.cpp.
|
inline |
Returns the list of raw header pairs in the reply.
Definition at line 101 of file qgsnetworkreply.h.
|
inline |
Returns the original network request.
Definition at line 140 of file qgsnetworkreply.h.
|
inline |
Returns the unique ID identifying the original request which this response was formed from.
Definition at line 135 of file qgsnetworkreply.h.
|
inline |
Sets the reply content.
This is not done by default, as reading network reply content can only be done once.
Definition at line 148 of file qgsnetworkreply.h.