87 lines
4.2 KiB
C
87 lines
4.2 KiB
C
#ifndef TARIFF_PREPAID_H_INCLUDED
|
|
#define TARIFF_PREPAID_H_INCLUDED
|
|
|
|
#include <QTime>
|
|
#include <QString>
|
|
|
|
#include "atb_time.h"
|
|
|
|
struct ATBPrepaid {
|
|
int id;
|
|
bool anytime;
|
|
bool never;
|
|
QTime static_start;
|
|
QTime static_end;
|
|
|
|
struct week {
|
|
int day;
|
|
QTime static_start;
|
|
QTime static_end;
|
|
int duration;
|
|
} prepaid[8];
|
|
|
|
explicit ATBPrepaid()
|
|
: id(-1)
|
|
, anytime(false)
|
|
, never(false)
|
|
, static_start(QTime(23, 59, 59))
|
|
, static_end(QTime(0, 0, 0)) {
|
|
|
|
for (int i = 0 ; i < 8; ++i) {
|
|
prepaid[i].day = -1;
|
|
prepaid[i].static_start = QTime(23, 59, 59);
|
|
prepaid[i].static_end = QTime(0, 0, 0);
|
|
prepaid[i].duration = -1;
|
|
}
|
|
}
|
|
|
|
friend QDebug operator<<(QDebug debug, ATBPrepaid const &pp) {
|
|
QDebugStateSaver saver(debug);
|
|
|
|
debug.nospace()
|
|
<< " id: " << pp.id << "\n"
|
|
<< " static_start: " << pp.static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.static_end.toString(Qt::ISODate) << "\n"
|
|
<< " anytime: " << pp.anytime << "\n"
|
|
<< " never: " << pp.never << "\n"
|
|
<< " **** Monday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Monday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Monday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Monday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Monday].duration << "\n"
|
|
<< " **** Tuesday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Tuesday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Tuesday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Tuesday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Tuesday].duration << "\n"
|
|
<< " **** Wednesday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Wednesday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Wednesday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Wednesday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Wednesday].duration << "\n"
|
|
<< " **** Thursday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Thursday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Thursday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Thursday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Thursday].duration << "\n"
|
|
<< " **** Friday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Friday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Friday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Friday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " **** Saturday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Saturday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Saturday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Saturday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Saturday].duration << "\n"
|
|
<< " **** Sunday **** \n"
|
|
<< " day: " << pp.prepaid[(int)Qt::Sunday].day << "\n"
|
|
<< " static_start: " << pp.prepaid[(int)Qt::Sunday].static_start.toString(Qt::ISODate) << "\n"
|
|
<< " static_end: " << pp.prepaid[(int)Qt::Sunday].static_end.toString(Qt::ISODate) << "\n"
|
|
<< " duration: " << pp.prepaid[(int)Qt::Sunday].duration << "\n";
|
|
|
|
return debug;
|
|
}
|
|
};
|
|
|
|
#endif // TARIFF_PREPAID_H_INCLUDED
|