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
 
KWeatherCore::Sunrise sunrise
 
qreal uvIndex
 
bool valid
 
QString weatherDescription
 
QString weatherIcon
 

Public Member Functions

 DailyWeatherForecast ()
 
 DailyWeatherForecast (const QDate &date)
 
 DailyWeatherForecast (const DailyWeatherForecast &other)
 
 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 DailyWeatherForecast &forecast)
 
DailyWeatherForecastoperator+= (const DailyWeatherForecast &forecast)
 
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 setSunrise (Sunrise sunrise)
 
void setUvIndex (double uvIndex)
 
void setWeatherDescription (const QString &description)
 
void setWeatherIcon (const QString &icon)
 
const Sunrisesunrise () const
 
QJsonObject toJson ()
 
double uvIndex () const
 
const QStringweatherDescription () const
 
const QStringweatherIcon () const
 

Static Public Member Functions

static DailyWeatherForecast fromJson (QJsonObject obj)
 

Detailed Description

Class represents weatherforecast in a day.

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

See also
HourlyForecast, Sunrise
Author
Han Young hanyo[email protected][email protected][email protected]proto[email protected]nmai[email protected]l.com

Definition at line 25 of file dailyweatherforecast.h.

Constructor & Destructor Documentation

KWeatherCore::DailyWeatherForecast::DailyWeatherForecast ( )

Creates a invalid DailyWeatherForecast.

Definition at line 34 of file dailyweatherforecast.cpp.

Member Function Documentation

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

return date this object represents

Returns
date, date can be invalid if constructed without data
DailyWeatherForecast KWeatherCore::DailyWeatherForecast::fromJson ( QJsonObject  obj)
static

Construct a DailyWeatherForecast from QJsonObject.

Definition at line 70 of file dailyweatherforecast.cpp.

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 178 of file dailyweatherforecast.cpp.

double KWeatherCore::DailyWeatherForecast::humidity ( ) const

return humidity

Returns
this value is initialized to zero
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 90 of file dailyweatherforecast.cpp.

double KWeatherCore::DailyWeatherForecast::maxTemp ( ) const

return maximum temperature

Returns
maximum temperature, this value is initialized to the smallest value double can hold
double KWeatherCore::DailyWeatherForecast::minTemp ( ) const

return minimum temperature

Returns
minimum temperature, this value is initialized to the largest value double can hold
DailyWeatherForecast & KWeatherCore::DailyWeatherForecast::operator+ ( const DailyWeatherForecast forecast)

merge two daily forecast, note the hourly forecast is unchanged

Parameters
forecastmake sure it is on the same day
Returns
result DailyWeatherForecast

Definition at line 194 of file dailyweatherforecast.cpp.

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

merge two daily forecast, note the hourly forecast is unchanged, daily forecast becomes valid afterwards

Parameters
forecastmake sure it is on the same day
Returns
result DailyWeatherForecast

Definition at line 215 of file dailyweatherforecast.cpp.

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 220 of file dailyweatherforecast.cpp.

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 252 of file dailyweatherforecast.cpp.

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 247 of file dailyweatherforecast.cpp.

double KWeatherCore::DailyWeatherForecast::precipitation ( ) const

return precipitation

Returns
this value is initialized to zero
double KWeatherCore::DailyWeatherForecast::pressure ( ) const

return pressure

Returns
this value is initialized to zero
void KWeatherCore::DailyWeatherForecast::setDate ( const QDate date)

set the date this object represents

Parameters
date

Definition at line 126 of file dailyweatherforecast.cpp.

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 186 of file dailyweatherforecast.cpp.

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

overloaded version

Parameters
forecast

Definition at line 190 of file dailyweatherforecast.cpp.

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

set the humidity of the day

Parameters
humidityhumidity of the day, in percentage

Definition at line 110 of file dailyweatherforecast.cpp.

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

set the maximum temperature of the day

Parameters
maxTempmaximum temperature of the day, in celsius

Definition at line 94 of file dailyweatherforecast.cpp.

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

set the minimum temperature of the day

Parameters
minTempminimum temperature of the day, in celsius

Definition at line 98 of file dailyweatherforecast.cpp.

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

set the precipitation of the day

Parameters
precipitationprecipitation of the day, in mm

Definition at line 102 of file dailyweatherforecast.cpp.

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

set the pressure of the day

Parameters
pressurepressure of the day, in hpa

Definition at line 114 of file dailyweatherforecast.cpp.

void KWeatherCore::DailyWeatherForecast::setSunrise ( Sunrise  sunrise)

set sunrise

Parameters
sunriseif this object and sunrise isn't on the same day, this function does nothing

Definition at line 182 of file dailyweatherforecast.cpp.

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

set the UvIndex of the day

Parameters
uvIndex0-1

Definition at line 106 of file dailyweatherforecast.cpp.

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

set the weather description of the day

Parameters
description

Definition at line 122 of file dailyweatherforecast.cpp.

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

set the weather icon of the day

Parameters
icon

Definition at line 118 of file dailyweatherforecast.cpp.

const Sunrise& KWeatherCore::DailyWeatherForecast::sunrise ( ) const

return sunrise data

Returns
sunrise data
QJsonObject KWeatherCore::DailyWeatherForecast::toJson ( )

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

Definition at line 50 of file dailyweatherforecast.cpp.

double KWeatherCore::DailyWeatherForecast::uvIndex ( ) const

return uvIndex

Returns
this value is initialized to zero
const QString& KWeatherCore::DailyWeatherForecast::weatherDescription ( ) const

return weather description

Returns
weather description, can be empty string if constructed without data
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-2021 The KDE developers.
Generated on Sun Oct 24 2021 23:03:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.