Add private mathods isParkingAllowedForWeekDay() and isParkingAllowedForSpecialDay().
Overload isParkingAllowed(). GetCostFromDuration(): add default parameter "int paymentOptionIndex=0"
This commit is contained in:
		@@ -17,6 +17,16 @@ class Calculator {
 | 
				
			|||||||
    mutable QVector<QList<int>> m_timeSteps;
 | 
					    mutable QVector<QList<int>> m_timeSteps;
 | 
				
			||||||
    mutable QList<int> m_priceSteps;
 | 
					    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:
 | 
					protected:
 | 
				
			||||||
    explicit Calculator() = default;
 | 
					    explicit Calculator() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +54,13 @@ public:
 | 
				
			|||||||
    void ResetPriceSteps() { m_priceSteps.clear(); }
 | 
					    void ResetPriceSteps() { m_priceSteps.clear(); }
 | 
				
			||||||
    QList<int> priceSteps() const { return m_priceSteps; }
 | 
					    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>
 | 
						/// <summary>
 | 
				
			||||||
	/// Gets duration in seconds from cost
 | 
						/// Gets duration in seconds from cost
 | 
				
			||||||
@@ -96,8 +112,8 @@ public:
 | 
				
			|||||||
// testing public:
 | 
					// testing public:
 | 
				
			||||||
    // Introduced for PaymentMethod::Steps (e.g. Schoenau)
 | 
					    // Introduced for PaymentMethod::Steps (e.g. Schoenau)
 | 
				
			||||||
    // For tariff of following structure: only steps, no special days, nonstop.
 | 
					    // 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, quint64 durationMinutes, int paymentOptionIndex=0) const;
 | 
				
			||||||
    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end) const;
 | 
					    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end, int paymentOptionIndex=0) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
					    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
				
			||||||
@@ -113,7 +129,7 @@ private:
 | 
				
			|||||||
                              int durationMinutes);
 | 
					                              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 {
 | 
					    uint32_t GetPriceForStep(Configuration *cfg, int step) const {
 | 
				
			||||||
        return GetPriceForTimeStep(cfg, step);
 | 
					        return GetPriceForTimeStep(cfg, step);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user