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
 
QString weatherDescription
 
QString weatherIcon
 

Public Member Functions

 DailyWeatherForecast ()
 
 DailyWeatherForecast (const DailyWeatherForecast &other)
 
 DailyWeatherForecast (const QDate &date)
 
 DailyWeatherForecast (DailyWeatherForecast &&other) noexcept
 
const QDatedate () const
 
QDateTime dateTime () const
 
const std::vector< HourlyWeatherForecast > & hourlyWeatherForecast () const
 
double humidity () const
 
double maxTemp () const
 
double minTemp () const
 
DailyWeatherForecastoperator+= (HourlyWeatherForecast &&forecast)
 
bool operator< (const DailyWeatherForecast &forecast) const
 
DailyWeatherForecastoperator= (const DailyWeatherForecast &other)
 
DailyWeatherForecastoperator= (DailyWeatherForecast &&other) noexcept
 
bool operator== (const DailyWeatherForecast &forecast) const
 
double precipitation () const
 
double pressure () const
 
void setDate (const QDate &date)
 
void setDate (const QDateTime &date)
 
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 () const
 
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 31 of file dailyweatherforecast.h.

Property Documentation

◆ date

QDateTime KWeatherCore::DailyWeatherForecast::date
read

Definition at line 42 of file dailyweatherforecast.h.

◆ humidity

qreal KWeatherCore::DailyWeatherForecast::humidity
read

Definition at line 38 of file dailyweatherforecast.h.

◆ maxTemp

qreal KWeatherCore::DailyWeatherForecast::maxTemp
read

Definition at line 34 of file dailyweatherforecast.h.

◆ minTemp

qreal KWeatherCore::DailyWeatherForecast::minTemp
read

Definition at line 35 of file dailyweatherforecast.h.

◆ precipitation

qreal KWeatherCore::DailyWeatherForecast::precipitation
read

Definition at line 36 of file dailyweatherforecast.h.

◆ pressure

qreal KWeatherCore::DailyWeatherForecast::pressure
read

Definition at line 39 of file dailyweatherforecast.h.

◆ uvIndex

qreal KWeatherCore::DailyWeatherForecast::uvIndex
read

Definition at line 37 of file dailyweatherforecast.h.

◆ weatherDescription

QString KWeatherCore::DailyWeatherForecast::weatherDescription
read

Definition at line 41 of file dailyweatherforecast.h.

◆ weatherIcon

QString KWeatherCore::DailyWeatherForecast::weatherIcon
read

Definition at line 40 of file dailyweatherforecast.h.

Constructor & Destructor Documentation

◆ DailyWeatherForecast() [1/2]

KWeatherCore::DailyWeatherForecast::DailyWeatherForecast ( )

Creates a invalid DailyWeatherForecast.

Definition at line 34 of file dailyweatherforecast.cpp.

◆ DailyWeatherForecast() [2/2]

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

Definition at line 38 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

Definition at line 155 of file dailyweatherforecast.cpp.

◆ dateTime()

QDateTime KWeatherCore::DailyWeatherForecast::dateTime ( ) const

Definition at line 159 of file dailyweatherforecast.cpp.

◆ fromJson()

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

Construct a DailyWeatherForecast from QJsonObject.

Definition at line 64 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 163 of file dailyweatherforecast.cpp.

◆ humidity()

double KWeatherCore::DailyWeatherForecast::humidity ( ) const

return humidity

Returns
this value is initialized to zero

Definition at line 139 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

Definition at line 123 of file dailyweatherforecast.cpp.

◆ minTemp()

double KWeatherCore::DailyWeatherForecast::minTemp ( ) const

return minimum temperature

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

Definition at line 127 of file dailyweatherforecast.cpp.

◆ operator+=()

DailyWeatherForecast & KWeatherCore::DailyWeatherForecast::operator+= ( 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 172 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 203 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 198 of file dailyweatherforecast.cpp.

◆ precipitation()

double KWeatherCore::DailyWeatherForecast::precipitation ( ) const

return precipitation

Returns
this value is initialized to zero

Definition at line 131 of file dailyweatherforecast.cpp.

◆ pressure()

double KWeatherCore::DailyWeatherForecast::pressure ( ) const

return pressure

Returns
this value is initialized to zero

Definition at line 143 of file dailyweatherforecast.cpp.

◆ setDate() [1/2]

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

set the date this object represents

Parameters
date

Definition at line 115 of file dailyweatherforecast.cpp.

◆ setDate() [2/2]

void KWeatherCore::DailyWeatherForecast::setDate ( const QDateTime & date)

Definition at line 119 of file dailyweatherforecast.cpp.

◆ setHourlyWeatherForecast()

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

overloaded version

Parameters
forecast

Definition at line 167 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 99 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 83 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 87 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 91 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 103 of file dailyweatherforecast.cpp.

◆ setUvIndex()

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

set the UvIndex of the day

Parameters
uvIndex0-1

Definition at line 95 of file dailyweatherforecast.cpp.

◆ setWeatherDescription()

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

set the weather description of the day

Parameters
description

Definition at line 111 of file dailyweatherforecast.cpp.

◆ setWeatherIcon()

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

set the weather icon of the day

Parameters
icon

Definition at line 107 of file dailyweatherforecast.cpp.

◆ toJson()

QJsonObject KWeatherCore::DailyWeatherForecast::toJson ( ) const

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

Definition at line 45 of file dailyweatherforecast.cpp.

◆ uvIndex()

double KWeatherCore::DailyWeatherForecast::uvIndex ( ) const

return uvIndex

Returns
this value is initialized to zero

Definition at line 135 of file dailyweatherforecast.cpp.

◆ weatherDescription()

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

return weather description

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

Definition at line 151 of file dailyweatherforecast.cpp.

◆ weatherIcon()

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

return weather icon

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

Definition at line 147 of file dailyweatherforecast.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.