NDEVR
API Documentation
QtNetworkRequest

Contains information specific for making a network request within the Qt Framework. More...

Inheritance diagram for QtNetworkRequest:
[legend]
Collaboration diagram for QtNetworkRequest:
[legend]

Public Member Functions

 QtNetworkRequest (const QNetworkRequest &request, QNetworkAccessManager *manager)
 Constructs a network request from a QNetworkRequest and access manager.
virtual void abort () override
 Aborts the in-progress network request.
virtual void close () override
 Closes the network reply and releases associated resources.
virtual QByteArray data () override
 Returns the response data received from the network.
virtual bool isRunning () override
 Checks whether the network request is still in progress.
void setData (const Buffer< uint01 > &data)
 Sets the raw byte data to upload with this request.
void setData (const File &data)
 Sets a file whose contents will be uploaded with this request.
void setReply (QNetworkReply *reply)
 Assigns the QNetworkReply received from the network access manager.
virtual bool start () override
 Initiates the network request.
Public Member Functions inherited from NetworkRequest
void downloadProgressSignal (qint64 bytesReceived, qint64 bytesTotal)
 Emitted to report download progress.
void errorOccurredSignal (StringView error)
 Emitted when an error occurs, with a description.
void finishedSignal ()
 Emitted when the request has finished.
void metaDataChangedSignal ()
 Emitted when response metadata changes.
void redirectAllowedSignal ()
 Emitted when a redirect is allowed.
void requestSentSignal ()
 Emitted when the request has been sent.
void socketStartedConnectingSignal ()
 Emitted when the socket begins connecting.
void uploadProgressSignal (qint64 bytesSent, qint64 bytesTotal)
 Emitted to report upload progress.

Protected Member Functions

void processErrorSlot (QNetworkReply::NetworkError error)
 Handles network errors emitted by the QNetworkReply.

Protected Attributes

Buffer< uint01m_data
 Raw byte data to upload with the request.
File m_file
 File to upload with the request.
QNetworkAccessManager * m_manager
 The Qt network access manager executing the request.
QNetworkReply * m_reply = nullptr
 The active network reply, or nullptr if not started.
QNetworkRequest m_request
 The underlying Qt network request.

Detailed Description

Contains information specific for making a network request within the Qt Framework.


Definition at line 17 of file QTNetworkRequest.h.

Constructor & Destructor Documentation

◆ QtNetworkRequest()

QtNetworkRequest::QtNetworkRequest ( const QNetworkRequest & request,
QNetworkAccessManager * manager )

Constructs a network request from a QNetworkRequest and access manager.

Parameters
[in]requestThe Qt network request to wrap.
[in]managerThe Qt network access manager that will execute the request.

Member Function Documentation

◆ data()

virtual QByteArray QtNetworkRequest::data ( )
overridevirtual

Returns the response data received from the network.

Returns
The response body as a QByteArray.

Implements NetworkRequest.

Referenced by setData(), and setData().

◆ isRunning()

virtual bool QtNetworkRequest::isRunning ( )
overridevirtual

Checks whether the network request is still in progress.

Returns
True if the request is currently running.

Implements NetworkRequest.

◆ processErrorSlot()

void QtNetworkRequest::processErrorSlot ( QNetworkReply::NetworkError error)
protected

Handles network errors emitted by the QNetworkReply.

Parameters
[in]errorThe network error code.

◆ setData() [1/2]

void QtNetworkRequest::setData ( const Buffer< uint01 > & data)

Sets the raw byte data to upload with this request.

Parameters
[in]dataThe buffer of bytes to send.

References data().

◆ setData() [2/2]

void QtNetworkRequest::setData ( const File & data)

Sets a file whose contents will be uploaded with this request.

Parameters
[in]dataThe file to send.

References data().

◆ setReply()

void QtNetworkRequest::setReply ( QNetworkReply * reply)

Assigns the QNetworkReply received from the network access manager.

Parameters
[in]replyThe reply object to monitor for completion and errors.

◆ start()

virtual bool QtNetworkRequest::start ( )
overridevirtual

Initiates the network request.

Returns
True if the request was successfully started.

Implements NetworkRequest.


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