CCIMXDesktop
 
Loading...
Searching...
No Matches
WeatherRequest Class Referenceabstract

The WeatherRequest class provides the interface to request weather data. More...

#include <MyWeatherRequest.h>

Inheritance diagram for WeatherRequest:
AppWeatherRequest

Signals

void errorOccurs (QNetworkReply *reply)
 Emitted when an error occurs in the request.
 
void result_available (const QString json)
 Emitted when the result is available.
 

Public Member Functions

 Q_DISABLE_COPY (WeatherRequest)
 Disables copy constructor and copy assignment. This prevents copying of the WeatherRequest object.
 
 WeatherRequest (QObject *parent=nullptr)
 Constructor for WeatherRequest.
 
void async_request (const char *base_url)
 Sends the request asynchronously.
 
virtual QUrlQuery compose_request ()=0
 Composes the request parameters.
 

Protected Attributes

QNetworkAccessManager manager
 The network manager handling requests.
 

Static Protected Attributes

static constexpr const char * private_key = _DEF_WEATHER_PRIVATE_KEY
 Private key for accessing the weather service.
 

Detailed Description

The WeatherRequest class provides the interface to request weather data.

This class manages the HTTP requests and handles the returned JSON.

Constructor & Destructor Documentation

◆ WeatherRequest()

WeatherRequest::WeatherRequest ( QObject *  parent = nullptr)
explicit

Constructor for WeatherRequest.

Parameters
parentThe parent QObject.

Member Function Documentation

◆ async_request()

void WeatherRequest::async_request ( const char *  base_url)

Sends the request asynchronously.

Parameters
base_urlThe base URL without any request parameters.

◆ compose_request()

virtual QUrlQuery WeatherRequest::compose_request ( )
pure virtual

Composes the request parameters.

Returns
The composed request query.

Implemented in AppWeatherRequest.

◆ errorOccurs

void WeatherRequest::errorOccurs ( QNetworkReply *  reply)
signal

Emitted when an error occurs in the request.

Parameters
replyThe reply object that caused the error.

◆ result_available

void WeatherRequest::result_available ( const QString  json)
signal

Emitted when the result is available.

Parameters
jsonThe JSON string returned from the request.

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