Add helpers GetSteps(), noSpecialDays(), specialDays() and tariffIs24_7()

to make the source more readable.
This commit is contained in:
Gerhard Hoffmann 2023-12-12 10:36:22 +01:00
parent d11cffb8bd
commit 6e0a74c8cc

View File

@ -45,6 +45,20 @@ public:
// (e.g. Schoenau/Koenigsee)
//
QList<int> GetTimeSteps(Configuration *cfg) const;
QList<int> GetSteps(Configuration *cfg) const { return GetTimeSteps(cfg); }
// additional helper functions
bool noSpecialDays(Configuration const *cfg) const {
return (cfg->SpecialDays.size() == 0) && (cfg->SpecialDaysWorktime.size() == 0);
}
bool specialDays(Configuration const *cfg) const {
return !noSpecialDays(cfg);
}
bool tariffIs24_7(Configuration const *cfg) const {
return (cfg->YearPeriod.size() == 0 &&
cfg->SpecialDays.size() == 0 &&
cfg->SpecialDaysWorktime.size() == 0);
}
private:
// Introduced for PaymentMethod::Steps (e.g. Schoenau)