DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::networking::ReplyResponse Class Referenceabstract

Interface for retrieving network replies from a sent request. When deriving, it'll provide methods for accessing various response information from a received network reply. More...

#include <RequestSender.hpp>

Inheritance diagram for drn::networking::ReplyResponse:
Collaboration diagram for drn::networking::ReplyResponse:

Signals

void ready ()
 Triggered when a response from a network request is ready for processing. This signal is meant to be connected to a slot or lambda function that handles the response once a network request completes. It indicates that the reply object contains data that is ready to be processed, or is in an error state.
 

Public Member Functions

 ReplyResponse (const foundation::QtPtr< QObject > &parent)
 Fully initialises the object with a specified parent.
 
virtual::QVariant attribute (const QNetworkRequest::Attribute code) const noexcept=0
 When implemented, retrieves the specified attribute from the network request. This is used to obtain various attributes associated with a network request, such as HTTP status codes, redirection targets, etc. It is essential for handling different aspects of the response beyond the raw data.
 
virtual::QNetworkReply::NetworkError error () const noexcept=0
 When implemented, provides the current error state of the network reply. This is used to retrieve the error status of a network operation. This information is crucial for handling any issues in network communication, allowing the application to react accordingly.
 
virtual::QString errorString () const noexcept=0
 When implemented, provides a human-readable description of any network error that has occurred during a request-response cycle. Useful for logging or displaying error messages to users.
 
virtual::QByteArray readAll ()=0
 When implemented, reads and retrieves all remaining data from the reply. This will extract all data that has been buffered into the reply object from a network operation. Typical usage involves calling this method after a network request has completed to obtain the full response payload for further processing. Use this method to read the entirety of the data content in one go.
 
virtual::QUrl url () const noexcept=0
 When implemented, gives the URL to which the network request was made.
 

Detailed Description

Interface for retrieving network replies from a sent request. When deriving, it'll provide methods for accessing various response information from a received network reply.

Constructor & Destructor Documentation

◆ ReplyResponse()

drn::networking::ReplyResponse::ReplyResponse ( const foundation::QtPtr< QObject > & parent)
explicit

Fully initialises the object with a specified parent.

Parameters
parentThe parent used to manage the memory and lifecycle of this instance, and ensuring it follows the Qt object hierarchy.

Member Function Documentation

◆ attribute()

virtual::QVariant drn::networking::ReplyResponse::attribute ( const QNetworkRequest::Attribute code) const
nodiscardpure virtualnoexcept

When implemented, retrieves the specified attribute from the network request. This is used to obtain various attributes associated with a network request, such as HTTP status codes, redirection targets, etc. It is essential for handling different aspects of the response beyond the raw data.

Parameters
codeThe attribute code to retrieve.
Returns
The value of the requested attribute wrapped in a QVariant. If the attribute is not present, the returned QVariant will be invalid.

Implemented in drn::networking::QtReplyResponse.

Here is the caller graph for this function:

◆ error()

virtual::QNetworkReply::NetworkError drn::networking::ReplyResponse::error ( ) const
nodiscardpure virtualnoexcept

When implemented, provides the current error state of the network reply. This is used to retrieve the error status of a network operation. This information is crucial for handling any issues in network communication, allowing the application to react accordingly.

Returns
It gives a value indicating the specific error that occurred during the request, if any.

Implemented in drn::networking::QtReplyResponse.

Here is the caller graph for this function:

◆ errorString()

virtual::QString drn::networking::ReplyResponse::errorString ( ) const
nodiscardpure virtualnoexcept

When implemented, provides a human-readable description of any network error that has occurred during a request-response cycle. Useful for logging or displaying error messages to users.

Returns
A description of the network error as a string. If no error occurred, the string will be empty.

Implemented in drn::networking::QtReplyResponse.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAll()

virtual::QByteArray drn::networking::ReplyResponse::readAll ( )
nodiscardpure virtual

When implemented, reads and retrieves all remaining data from the reply. This will extract all data that has been buffered into the reply object from a network operation. Typical usage involves calling this method after a network request has completed to obtain the full response payload for further processing. Use this method to read the entirety of the data content in one go.

Returns
All the data read from the reply.

Implemented in drn::networking::QtReplyResponse.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ready

void drn::networking::ReplyResponse::ready ( )
signal

Triggered when a response from a network request is ready for processing. This signal is meant to be connected to a slot or lambda function that handles the response once a network request completes. It indicates that the reply object contains data that is ready to be processed, or is in an error state.

◆ url()

virtual::QUrl drn::networking::ReplyResponse::url ( ) const
nodiscardpure virtualnoexcept

When implemented, gives the URL to which the network request was made.

Returns
The URL used for the network request.

Implemented in drn::networking::QtReplyResponse.

Here is the call graph for this function:
Here is the caller graph for this function: