From bda8914f1a072b15438d87f4a2b1f03dee9d8c72 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 2 Sep 2024 16:35:25 +0200 Subject: [PATCH] Add free functions: previousDayHoliday(): Check if previous day was a holiday. Check is done relative to computed endtime. isHoliday(): Check if startDateTime is on a holiday. getPaymentOptionIndex(): Compute the index of the payment-options-section inside a tariff-file. This is done as workaround (and backward compatibility). parseWeekDay(): Parse new structure of tariff-file. --- library/include/mobilisis/configuration.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/library/include/mobilisis/configuration.h b/library/include/mobilisis/configuration.h index 8108b19..cf9a8a8 100644 --- a/library/include/mobilisis/configuration.h +++ b/library/include/mobilisis/configuration.h @@ -36,6 +36,7 @@ using namespace std; using namespace rapidjson; + class Calculator; class Configuration { @@ -59,7 +60,7 @@ public: multimap PaymentRate; SpecialDaysWorktimeType SpecialDaysWorktime; SpecialDaysType SpecialDays; - multimap WeekDays; + multimap WeekDays; multimap YearPeriod; multimap WeekDaysWorktime; ATBPaymentOptionType PaymentOption; @@ -126,3 +127,15 @@ private: QVector currentPaymentOptions; }; + +bool previousDayHoliday(Configuration const &cfg, QDateTime const &t); +bool isHoliday(Configuration const &cfg, QDateTime const &t); +int getPaymentOptionIndex(Configuration const &cfg); + +ATBWeekDay parseWeekDay(Configuration &cfg, + rapidjson::GenericMemberIterator, + rapidjson::MemoryPoolAllocator> k, + QString const &innerObjName, + Qt::DayOfWeek weekDay, + QString const &weekDayName);