QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
network
qgsnetworkreply.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsnetworkreply.h
3
-----------------
4
begin : November 2018
5
copyright : (C) 2018 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSNETWORKREPLY_H
16
#define QGSNETWORKREPLY_H
17
18
#include "qgis_core.h"
19
20
#include <QByteArray>
21
#include <QNetworkReply>
22
28
class
CORE_EXPORT
QgsNetworkReplyContent
29
{
30
public
:
34
QgsNetworkReplyContent
() =
default
;
35
39
explicit
QgsNetworkReplyContent
( QNetworkReply *reply );
40
44
void
clear
();
45
55
QVariant
attribute
( QNetworkRequest::Attribute code )
const
;
56
57
#ifndef SIP_RUN
58
65
QMap< QNetworkRequest::Attribute, QVariant >
attributes
()
const
{
return
mAttributes; }
66
#endif
67
74
QNetworkReply::NetworkError
error
()
const
{
return
mError; }
75
82
QString
errorString
()
const
{
return
mErrorString; }
83
84
#ifndef SIP_RUN
85
typedef
QPair<QByteArray, QByteArray>
RawHeaderPair
;
86
94
const
QList<RawHeaderPair> &
rawHeaderPairs
()
const
{
return
mRawHeaderPairs; }
95
#endif
96
103
bool
hasRawHeader(
const
QByteArray &headerName )
const
;
104
111
QList<QByteArray> rawHeaderList()
const
;
112
120
QByteArray rawHeader(
const
QByteArray &headerName )
const
;
121
125
int
requestId
()
const
{
return
mRequestId; }
126
130
QNetworkRequest
request
()
const
{
return
mRequest; }
131
138
void
setContent
(
const
QByteArray &
content
) { mContent =
content
; }
139
148
QByteArray
content
()
const
{
return
mContent; }
149
155
static
QString extractFilenameFromContentDispositionHeader( QNetworkReply *reply );
156
162
static
QString extractFileNameFromContentDispositionHeader(
const
QString &header );
163
164
private
:
165
QNetworkReply::NetworkError mError = QNetworkReply::NoError;
166
QString mErrorString;
167
QList<RawHeaderPair> mRawHeaderPairs;
168
QMap< QNetworkRequest::Attribute, QVariant > mAttributes;
169
int
mRequestId = -1;
170
QNetworkRequest mRequest;
171
QByteArray mContent;
172
};
173
174
#endif
// QGSNETWORKREPLY_H
QgsNetworkReplyContent::rawHeaderPairs
const QList< RawHeaderPair > & rawHeaderPairs() const
Returns the list of raw header pairs in the reply.
Definition
qgsnetworkreply.h:94
QgsNetworkReplyContent::attribute
QVariant attribute(QNetworkRequest::Attribute code) const
Returns the attribute associated with the code.
Definition
qgsnetworkreply.cpp:46
QgsNetworkReplyContent::QgsNetworkReplyContent
QgsNetworkReplyContent()=default
Default constructor for an empty reply.
QgsNetworkReplyContent::errorString
QString errorString() const
Returns the error text for the reply, or an empty string if no error was encountered.
Definition
qgsnetworkreply.h:82
QgsNetworkReplyContent::setContent
void setContent(const QByteArray &content)
Sets the reply content.
Definition
qgsnetworkreply.h:138
QgsNetworkReplyContent::content
QByteArray content() const
Returns the reply content.
Definition
qgsnetworkreply.h:148
QgsNetworkReplyContent::error
QNetworkReply::NetworkError error() const
Returns the reply's error message, or QNetworkReply::NoError if no error was encountered.
Definition
qgsnetworkreply.h:74
QgsNetworkReplyContent::attributes
QMap< QNetworkRequest::Attribute, QVariant > attributes() const
Returns a list of valid attributes received in the reply.
Definition
qgsnetworkreply.h:65
QgsNetworkReplyContent::clear
void clear()
Clears the reply, resetting it back to a default, empty reply.
Definition
qgsnetworkreply.cpp:41
QgsNetworkReplyContent::requestId
int requestId() const
Returns the unique ID identifying the original request which this response was formed from.
Definition
qgsnetworkreply.h:125
QgsNetworkReplyContent::RawHeaderPair
QPair< QByteArray, QByteArray > RawHeaderPair
Definition
qgsnetworkreply.h:85
QgsNetworkReplyContent::request
QNetworkRequest request() const
Returns the original network request.
Definition
qgsnetworkreply.h:130
Generated on
for QGIS API Documentation by
1.17.0