Add default constructor, update debug output.

This commit is contained in:
Gerhard Hoffmann 2024-09-11 11:40:19 +02:00
parent f38a8d528c
commit e38a1bfe12

View File

@ -5,13 +5,34 @@
#include <QString>
struct ATBPrepaid {
explicit ATBPrepaid() = default;
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);
@ -20,7 +41,41 @@ struct ATBPrepaid {
<< " 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";
<< " 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;
}