From f322d30e36300796660de4b26e6259e6cd059006 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 11 Sep 2024 11:35:17 +0200 Subject: [PATCH] Add default constructor, fix debug output. --- library/include/mobilisis/tariff_carryover.h | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/library/include/mobilisis/tariff_carryover.h b/library/include/mobilisis/tariff_carryover.h index 08ffb89..034fd63 100644 --- a/library/include/mobilisis/tariff_carryover.h +++ b/library/include/mobilisis/tariff_carryover.h @@ -15,6 +15,19 @@ struct ATBCarryOver { int id; + explicit ATBCarryOver() + : id(-1) { + + for (int i = 0 ; i < 8; ++i) { + carryover[i].day = -1; + carryover[i].seemless = false; + carryover[i].never = false; + carryover[i].static_start = QTime(23, 59, 59); + carryover[i].static_end = QTime(0, 0, 0); + carryover[i].duration = -1; + } + } + friend QDebug operator<<(QDebug debug, ATBCarryOver const &co) { QDebugStateSaver saver(debug); @@ -31,21 +44,21 @@ struct ATBCarryOver { << " day: " << co.carryover[(int)Qt::Tuesday].day << "\n" << " static_start: " << co.carryover[(int)Qt::Tuesday].static_start.toString(Qt::ISODate) << "\n" << " static_end: " << co.carryover[(int)Qt::Tuesday].static_end.toString(Qt::ISODate) << "\n" - << " duration: " << co.carryover[(int)Qt::Monday].duration << "\n" + << " duration: " << co.carryover[(int)Qt::Tuesday].duration << "\n" << " anytime: " << co.carryover[(int)Qt::Tuesday].seemless << "\n" << " never: " << co.carryover[(int)Qt::Tuesday].never << "\n" << " **** Wednesday **** \n" << " day: " << co.carryover[(int)Qt::Wednesday].day << "\n" << " static_start: " << co.carryover[(int)Qt::Wednesday].static_start.toString(Qt::ISODate) << "\n" << " static_end: " << co.carryover[(int)Qt::Wednesday].static_end.toString(Qt::ISODate) << "\n" - << " duration: " << co.carryover[(int)Qt::Monday].duration << "\n" + << " duration: " << co.carryover[(int)Qt::Wednesday].duration << "\n" << " anytime: " << co.carryover[(int)Qt::Wednesday].seemless << "\n" << " never: " << co.carryover[(int)Qt::Wednesday].never << "\n" << " **** Thursday **** \n" << " day: " << co.carryover[(int)Qt::Thursday].day << "\n" << " static_start: " << co.carryover[(int)Qt::Thursday].static_start.toString(Qt::ISODate) << "\n" << " static_end: " << co.carryover[(int)Qt::Thursday].static_end.toString(Qt::ISODate) << "\n" - << " duration: " << co.carryover[(int)Qt::Monday].duration << "\n" + << " duration: " << co.carryover[(int)Qt::Thursday].duration << "\n" << " anytime: " << co.carryover[(int)Qt::Thursday].seemless << "\n" << " never: " << co.carryover[(int)Qt::Thursday].never << "\n" << " **** Friday **** \n" @@ -58,14 +71,14 @@ struct ATBCarryOver { << " day: " << co.carryover[(int)Qt::Saturday].day << "\n" << " static_start: " << co.carryover[(int)Qt::Saturday].static_start.toString(Qt::ISODate) << "\n" << " static_end: " << co.carryover[(int)Qt::Saturday].static_end.toString(Qt::ISODate) << "\n" - << " duration: " << co.carryover[(int)Qt::Monday].duration << "\n" + << " duration: " << co.carryover[(int)Qt::Saturday].duration << "\n" << " anytime: " << co.carryover[(int)Qt::Saturday].seemless << "\n" << " never: " << co.carryover[(int)Qt::Saturday].never << "\n" << " **** Sunday **** \n" << " day: " << co.carryover[(int)Qt::Sunday].day << "\n" << " static_start: " << co.carryover[(int)Qt::Sunday].static_start.toString(Qt::ISODate) << "\n" << " static_end: " << co.carryover[(int)Qt::Sunday].static_end.toString(Qt::ISODate) << "\n" - << " duration: " << co.carryover[(int)Qt::Monday].duration << "\n" + << " duration: " << co.carryover[(int)Qt::Sunday].duration << "\n" << " anytime: " << co.carryover[(int)Qt::Sunday].seemless << "\n" << " never: " << co.carryover[(int)Qt::Sunday].never << "\n";