Reuse of "class ATBWeekDays":
Description of a weekday: Mon-Sun. For holidays contains a type-flag to indicate such a day. Each weekday has some tariff-settings and some carry-over-settings.
This commit is contained in:
parent
2b9657787d
commit
929a8a4a27
@ -1,10 +1,57 @@
|
|||||||
#pragma once
|
#include "tariff_settings.h"
|
||||||
#include <string>
|
#include "tariff_carryover_settings.h"
|
||||||
|
|
||||||
class ATBWeekDays
|
#include <QString>
|
||||||
{
|
#include <Qt>
|
||||||
public:
|
#include <QDate>
|
||||||
int pdiw_id;
|
|
||||||
std::string pdiw_label;
|
struct ATBWeekDay {
|
||||||
int pdiw_index;
|
enum WeekDayType {USUAL_WEEKDAY=0, HOLIDAY=1};
|
||||||
};
|
|
||||||
|
Qt::DayOfWeek m_id;
|
||||||
|
QString m_name;
|
||||||
|
QDate m_date;
|
||||||
|
WeekDayType m_type;
|
||||||
|
ATBTariffSettings m_tariffSettings;
|
||||||
|
ATBTariffCarryOverSettings m_tariffCarryOverSettings;
|
||||||
|
|
||||||
|
explicit ATBWeekDay()
|
||||||
|
: m_id(Qt::Monday)
|
||||||
|
, m_name("")
|
||||||
|
, m_date(QDate())
|
||||||
|
, m_type(USUAL_WEEKDAY)
|
||||||
|
, m_tariffSettings()
|
||||||
|
, m_tariffCarryOverSettings() {}
|
||||||
|
|
||||||
|
explicit ATBWeekDay(Qt::DayOfWeek id, QString const &name, WeekDayType type,
|
||||||
|
QDate const &date,
|
||||||
|
ATBTariffSettings const &tariffSettings,
|
||||||
|
ATBTariffCarryOverSettings const &tariffCarryOverSettings)
|
||||||
|
: m_id(id)
|
||||||
|
, m_name(name)
|
||||||
|
, m_date(date)
|
||||||
|
, m_type(type)
|
||||||
|
, m_tariffSettings(tariffSettings)
|
||||||
|
, m_tariffCarryOverSettings(tariffCarryOverSettings) {}
|
||||||
|
|
||||||
|
ATBTariffCarryOverSettings &getTariffCarryOverSettings() { return m_tariffCarryOverSettings; }
|
||||||
|
ATBTariffCarryOverSettings const &getTariffCarryOverSettings() const { return m_tariffCarryOverSettings; }
|
||||||
|
|
||||||
|
ATBTariffSettings &getTariffSettings() { return m_tariffSettings; }
|
||||||
|
ATBTariffSettings const &getTariffSettings() const { return m_tariffSettings; }
|
||||||
|
|
||||||
|
friend QDebug operator<<(QDebug debug, ATBWeekDay const &wd) {
|
||||||
|
QDebugStateSaver saver(debug);
|
||||||
|
|
||||||
|
debug.nospace()
|
||||||
|
<< " id: " << (int)wd.m_id << "\n"
|
||||||
|
<< " name: " << wd.m_name << "\n"
|
||||||
|
<< " type: " << (int)wd.m_type << "\n\n"
|
||||||
|
<< " tariff settings: " << "\n"
|
||||||
|
<< wd.m_tariffSettings << "\n"
|
||||||
|
<< "tariff carryover settings: " << "\n"
|
||||||
|
<< wd.m_tariffCarryOverSettings << endl;
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user