summaryrefslogtreecommitdiffstats
path: root/weather/forecastdata.h
blob: c224e488ffddb0b9b2ec19c1beec85519d83c974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef FORECASTDATA_H
#define FORECASTDATA_H

#include <QString>
#include "forecast.h"

class ForecastData
{
public:
    ForecastData()
        : m_error(false)
        , m_lower(0)
        , m_current(0)
        , m_upper(0)
    {}
    ForecastData(bool error, Forecast::ForecastType type, bool night, const QString &key,
                 const QString &cityName, int lower, int current, int upper)
        : m_type(type)
        , m_night(night)
        , m_error(error)
        , m_key(key)
        , m_cityName(cityName)
        , m_lower(lower)
        , m_current(current)
        , m_upper(upper)
    {}

    Forecast::ForecastType type() const { return m_type; }
    bool night() const { return m_night; }
    bool error() const { return m_error; }
    QString key() const { return m_key; }
    QString cityName() const { return m_cityName; }
    int lower() const { return m_lower; }
    int current() const { return m_current; }
    int upper() const { return m_upper; }

    inline bool operator==(const ForecastData &other);
    bool operator!=(const ForecastData &other) { return !operator==(other); }

private:
    Forecast::ForecastType m_type;
    bool m_night;
    bool m_error;
    QString m_key;
    QString m_cityName;
    int m_lower;
    int m_current;
    int m_upper;
};

bool ForecastData::operator==(const ForecastData &other)
{
    return    m_type == other.m_type && m_night == other.m_night && m_error == other.m_error
           && m_key == other.m_key && m_cityName == other.m_cityName && m_lower == other.m_lower
           && m_current == other.m_current && m_upper == other.m_upper;
}

#endif // FORECASTDATA_H