KWeatherCore::DailyWeatherForecast

Search for usage in LXR

KWeatherCore::DailyWeatherForecast Class Reference

#include <dailyweatherforecast.h>

Properties

QDateTime date
 
qreal humidity
 
qreal maxTemp
 
qreal minTemp
 
qreal precipitation
 
qreal pressure
 
qreal uvIndex
 
bool valid
 
QString weatherDescription
 
QString weatherIcon
 

Public Member Functions

 DailyWeatherForecast ()
 
 DailyWeatherForecast (const DailyWeatherForecast &other)
 
 DailyWeatherForecast (const QDate &date)
 
 DailyWeatherForecast (DailyWeatherForecast &&other)
 
const QDatedate () const
 
QDateTime dateTime () const
 
const std::vector< HourlyWeatherForecast > & hourlyWeatherForecast () const
 
double humidity () const
 
bool isValid () const
 
double maxTemp () const
 
double minTemp () const
 
DailyWeatherForecastoperator+= (const HourlyWeatherForecast &forecast)
 
bool operator< (const DailyWeatherForecast &forecast) const
 
DailyWeatherForecastoperator= (const DailyWeatherForecast &other)
 
DailyWeatherForecastoperator= (DailyWeatherForecast &&other)
 
bool operator== (const DailyWeatherForecast &forecast) const
 
double precipitation () const
 
double pressure () const
 
void setDate (const QDate &date)
 
void setDate (const QDateTime &date)
 
void setHourlyWeatherForecast (const std::vector< HourlyWeatherForecast > &forecast)
 
void setHourlyWeatherForecast (std::vector< HourlyWeatherForecast > &&forecast)
 
void setHumidity (double humidity)
 
void setMaxTemp (double maxTemp)
 
void setMinTemp (double minTemp)
 
void setPrecipitation (double precipitation)
 
void setPressure (double pressure)
 
void setUvIndex (double uvIndex)
 
void setWeatherDescription (const QString &description)
 
void setWeatherIcon (const QString &icon)
 
QJsonObject toJson ()
 
double uvIndex () const
 
const QStringweatherDescription () const
 
const QStringweatherIcon () const
 

Static Public Member Functions

static DailyWeatherForecast fromJson (const QJsonObject &obj)
 

Detailed Description

Class represents weatherforecast in a day.

This is a class to hold general weather conditions and hourly forecast in a day All QDate/DateTime are on the location's timezone

See also
HourlyForecast
Author
Han Young hanyo.nosp@m.ung@.nosp@m.proto.nosp@m.nmai.nosp@m.l.com

Definition at line 24 of file dailyweatherforecast.h.

Constructor & Destructor Documentation

◆ DailyWeatherForecast()

KWeatherCore::DailyWeatherForecast::DailyWeatherForecast ( )

Creates a invalid DailyWeatherForecast.

Definition at line 33 of file dailyweatherforecast.cpp.

Member Function Documentation

◆ date()

const QDate& KWeatherCore::DailyWeatherForecast::date ( ) const

return date this object represents

Returns
date, date can be invalid if constructed without data

◆ fromJson()

DailyWeatherForecast KWeatherCore::DailyWeatherForecast::fromJson ( const QJsonObject obj)
static

Construct a DailyWeatherForecast from QJsonObject.

Definition at line 68 of file dailyweatherforecast.cpp.

◆ hourlyWeatherForecast()

const std::vector< HourlyWeatherForecast > & KWeatherCore::DailyWeatherForecast::hourlyWeatherForecast ( ) const

returns all HourlyWeathreForecast belonged to this day

Returns
all HourlyWeathreForecast belonged to this day

Definition at line 171 of file dailyweatherforecast.cpp.

◆ humidity()

double KWeatherCore::DailyWeatherForecast::humidity ( ) const

return humidity

Returns
this value is initialized to zero

◆ isValid()

bool KWeatherCore::DailyWeatherForecast::isValid ( ) const
Returns
true if the object is created without data this value won't change once the class is created with the exceptions of Day/Hour merge

Definition at line 87 of file dailyweatherforecast.cpp.

◆ maxTemp()

double KWeatherCore::DailyWeatherForecast::maxTemp ( ) const

return maximum temperature

Returns
maximum temperature, this value is initialized to the smallest value double can hold

◆ minTemp()

double KWeatherCore::DailyWeatherForecast::minTemp ( ) const

return minimum temperature

Returns
minimum temperature, this value is initialized to the largest value double can hold

◆ operator+=()

DailyWeatherForecast & KWeatherCore::DailyWeatherForecast::operator+= ( const HourlyWeatherForecast forecast)

append hourly forecast, you can append valid hourly forecast into a invalid daily forecast, daily forecast becomes valid afterwards

Parameters
forecastmake sure it's on the same day
Returns
result DailyWeatherForecast

Definition at line 184 of file dailyweatherforecast.cpp.

◆ operator<()

bool KWeatherCore::DailyWeatherForecast::operator< ( const DailyWeatherForecast forecast) const

if this is earlier than

Parameters
forecast
forecast
Returns
true if this is earlier than
Parameters
forecast

Definition at line 216 of file dailyweatherforecast.cpp.

◆ operator==()

bool KWeatherCore::DailyWeatherForecast::operator== ( const DailyWeatherForecast forecast) const

if on the same day

Parameters
forecast
Returns
true if on the same day

Definition at line 211 of file dailyweatherforecast.cpp.

◆ precipitation()

double KWeatherCore::DailyWeatherForecast::precipitation ( ) const

return precipitation

Returns
this value is initialized to zero

◆ pressure()

double KWeatherCore::DailyWeatherForecast::pressure ( ) const

return pressure

Returns
this value is initialized to zero

◆ setDate()

void KWeatherCore::DailyWeatherForecast::setDate ( const QDate date)

set the date this object represents

Parameters
date

Definition at line 123 of file dailyweatherforecast.cpp.

◆ setHourlyWeatherForecast() [1/2]

void KWeatherCore::DailyWeatherForecast::setHourlyWeatherForecast ( const std::vector< HourlyWeatherForecast > &  forecast)

set the hourly forecast of the day

Parameters
forecastmake sure they are sorted and on the same day

Definition at line 175 of file dailyweatherforecast.cpp.

◆ setHourlyWeatherForecast() [2/2]

void KWeatherCore::DailyWeatherForecast::setHourlyWeatherForecast ( std::vector< HourlyWeatherForecast > &&  forecast)

overloaded version

Parameters
forecast

Definition at line 179 of file dailyweatherforecast.cpp.

◆ setHumidity()

void KWeatherCore::DailyWeatherForecast::setHumidity ( double  humidity)

set the humidity of the day

Parameters
humidityhumidity of the day, in percentage

Definition at line 107 of file dailyweatherforecast.cpp.

◆ setMaxTemp()

void KWeatherCore::DailyWeatherForecast::setMaxTemp ( double  maxTemp)

set the maximum temperature of the day

Parameters
maxTempmaximum temperature of the day, in celsius

Definition at line 91 of file dailyweatherforecast.cpp.

◆ setMinTemp()

void KWeatherCore::DailyWeatherForecast::setMinTemp ( double  minTemp)

set the minimum temperature of the day

Parameters
minTempminimum temperature of the day, in celsius

Definition at line 95 of file dailyweatherforecast.cpp.

◆ setPrecipitation()

void KWeatherCore::DailyWeatherForecast::setPrecipitation ( double  precipitation)

set the precipitation of the day

Parameters
precipitationprecipitation of the day, in mm

Definition at line 99 of file dailyweatherforecast.cpp.

◆ setPressure()

void KWeatherCore::DailyWeatherForecast::setPressure ( double  pressure)

set the pressure of the day

Parameters
pressurepressure of the day, in hpa

Definition at line 111 of file dailyweatherforecast.cpp.

◆ setUvIndex()

void KWeatherCore::DailyWeatherForecast::setUvIndex ( double  uvIndex)

set the UvIndex of the day

Parameters
uvIndex0-1

Definition at line 103 of file dailyweatherforecast.cpp.

◆ setWeatherDescription()

void KWeatherCore::DailyWeatherForecast::setWeatherDescription ( const QString description)

set the weather description of the day

Parameters
description

Definition at line 119 of file dailyweatherforecast.cpp.

◆ setWeatherIcon()

void KWeatherCore::DailyWeatherForecast::setWeatherIcon ( const QString icon)

set the weather icon of the day

Parameters
icon

Definition at line 115 of file dailyweatherforecast.cpp.

◆ toJson()

QJsonObject KWeatherCore::DailyWeatherForecast::toJson ( )

Return a QJsonObject that can be converted back with DailyWeatherForecast::fromJson.

Definition at line 49 of file dailyweatherforecast.cpp.

◆ uvIndex()

double KWeatherCore::DailyWeatherForecast::uvIndex ( ) const

return uvIndex

Returns
this value is initialized to zero

◆ weatherDescription()

const QString& KWeatherCore::DailyWeatherForecast::weatherDescription ( ) const

return weather description

Returns
weather description, can be empty string if constructed without data

◆ weatherIcon()

const QString& KWeatherCore::DailyWeatherForecast::weatherIcon ( ) const

return weather icon

Returns
weather icon, can be empty string if constructed without data

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 03:54:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.