MOBILISIS-Calculator/library/include/mobilisis/weekdays.h

58 lines
2.1 KiB
C
Raw Normal View History

#include "tariff_settings.h"
#include "tariff_carryover_settings.h"
#include <QString>
#include <Qt>
#include <QDate>
struct ATBWeekDay {
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;
}
};