Add private mathods isParkingAllowedForWeekDay() and isParkingAllowedForSpecialDay().

Overload isParkingAllowed().
GetCostFromDuration(): add default parameter "int paymentOptionIndex=0"
This commit is contained in:
Gerhard Hoffmann 2024-04-19 13:06:37 +02:00
parent 2dbcc7018c
commit 10828e0708

View File

@ -17,6 +17,16 @@ class Calculator {
mutable QVector<QList<int>> m_timeSteps;
mutable QList<int> m_priceSteps;
CalcState isParkingAllowedForWeekDay(Configuration const *cfg,
QDateTime const &start,
int netto_parking_time,
int paymentOptionIndex);
CalcState isParkingAllowedForSpecialDay(Configuration const *cfg,
QDateTime const &start,
int netto_parking_time,
int paymentOptionIndex);
protected:
explicit Calculator() = default;
@ -44,7 +54,13 @@ public:
void ResetPriceSteps() { m_priceSteps.clear(); }
QList<int> priceSteps() const { return m_priceSteps; }
CalcState isParkingAllowed(Configuration const *cfg, QDateTime const &start);
CalcState isParkingAllowed(Configuration const *cfg,
QDateTime const &start);
CalcState isParkingAllowed(Configuration const *cfg,
QDateTime const &start,
int netto_parking_time,
int paymentOptionIndex);
/// <summary>
/// Gets duration in seconds from cost
@ -96,8 +112,8 @@ public:
// testing public:
// Introduced for PaymentMethod::Steps (e.g. Schoenau)
// For tariff of following structure: only steps, no special days, nonstop.
uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, quint64 durationMinutes) const;
uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end) const;
uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, quint64 durationMinutes, int paymentOptionIndex=0) const;
uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end, int paymentOptionIndex=0) const;
private:
Ticket private_GetCostFromDuration(Configuration const* cfg,
@ -113,7 +129,7 @@ private:
int durationMinutes);
//
uint32_t GetPriceForTimeStep(Configuration *cfg, int timeStep) const;
uint32_t GetPriceForTimeStep(Configuration *cfg, int timeStep, int paymentOptionIndex=0) const;
uint32_t GetPriceForStep(Configuration *cfg, int step) const {
return GetPriceForTimeStep(cfg, step);
}