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.

Property Documentation

◆ date

QDateTime KWeatherCore::DailyWeatherForecast::date
readwrite

Definition at line 36 of file dailyweatherforecast.h.

◆ humidity

qreal KWeatherCore::DailyWeatherForecast::humidity
readwrite

Definition at line 32 of file dailyweatherforecast.h.

◆ maxTemp

qreal KWeatherCore::DailyWeatherForecast::maxTemp
readwrite

Definition at line 28 of file dailyweatherforecast.h.

◆ minTemp

qreal KWeatherCore::DailyWeatherForecast::minTemp
readwrite

Definition at line 29 of file dailyweatherforecast.h.

◆ precipitation

qreal KWeatherCore::DailyWeatherForecast::precipitation
readwrite

Definition at line 30 of file dailyweatherforecast.h.

◆ pressure

qreal KWeatherCore::DailyWeatherForecast::pressure
readwrite

Definition at line 33 of file dailyweatherforecast.h.

◆ uvIndex

qreal KWeatherCore::DailyWeatherForecast::uvIndex
readwrite

Definition at line 31 of file dailyweatherforecast.h.

◆ valid

bool KWeatherCore::DailyWeatherForecast::valid
read

Definition at line 27 of file dailyweatherforecast.h.

◆ weatherDescription

QString KWeatherCore::DailyWeatherForecast::weatherDescription
readwrite

Definition at line 35 of file dailyweatherforecast.h.

◆ weatherIcon

QString KWeatherCore::DailyWeatherForecast::weatherIcon
readwrite

Definition at line 34 of file dailyweatherforecast.h.

Constructor & Destructor Documentation

◆ DailyWeatherForecast() [1/3]

KWeatherCore::DailyWeatherForecast::DailyWeatherForecast ( )

Creates a invalid DailyWeatherForecast.

Definition at line 33 of file dailyweatherforecast.cpp.

◆ DailyWeatherForecast() [2/3]

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

Definition at line 37 of file dailyweatherforecast.cpp.

◆ DailyWeatherForecast() [3/3]

KWeatherCore::DailyWeatherForecast::DailyWeatherForecast ( const DailyWeatherForecast & other)

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

◆ dateTime()

QDateTime KWeatherCore::DailyWeatherForecast::dateTime ( ) const

Definition at line 167 of file dailyweatherforecast.cpp.

◆ 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

Definition at line 147 of file dailyweatherforecast.cpp.

◆ 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

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

◆ 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=()

DailyWeatherForecast & KWeatherCore::DailyWeatherForecast::operator= ( const DailyWeatherForecast & other)

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

Definition at line 139 of file dailyweatherforecast.cpp.

◆ pressure()

double KWeatherCore::DailyWeatherForecast::pressure ( ) const

return pressure

Returns
this value is initialized to zero

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

◆ setDate() [2/2]

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

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

Definition at line 143 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 159 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 155 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 Tue Mar 26 2024 11:20:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.