Added overoaded versions for compute_price_for_parking_ticket() and
compute_duration_for_parking_ticket() using QDateTime parameters. Added new error code WRONG_ISO_TIME_FORMAT.
This commit is contained in:
		| @@ -5,6 +5,7 @@ | ||||
| #include <inttypes.h> | ||||
|  | ||||
| #include <QString> | ||||
| #include <QDateTime> | ||||
|  | ||||
| #ifdef WIN32 | ||||
| #ifdef CALCULATE_LIBRARY_EXPORTS | ||||
| @@ -20,9 +21,9 @@ class Configuration; | ||||
|  | ||||
| typedef Configuration parking_tariff_t; | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| //#ifdef __cplusplus | ||||
| //extern "C" { | ||||
| //#endif | ||||
|  | ||||
| struct CALCULATE_LIBRARY_API price_t { | ||||
|     uint32_t units; | ||||
| @@ -41,6 +42,7 @@ struct CALCULATE_LIBRARY_API CalcState { | ||||
|         NEGATIVE_PARING_TIME, | ||||
|         INVALID_START_DATE, | ||||
|         WRONG_PARAM_VALUES, | ||||
|         WRONG_ISO_TIME_FORMAT, | ||||
|         ABOVE_MAX_PARKING_TIME, | ||||
|         BELOW_MIN_PARKING_TIME, | ||||
|         BELOW_MIN_PARKING_PRICE, | ||||
| @@ -92,6 +94,8 @@ struct CALCULATE_LIBRARY_API CalcState { | ||||
|         case State::INVALID_START_DATE: | ||||
|             s = "INVALID_START_DATE"; | ||||
|             break; | ||||
|         case State::WRONG_ISO_TIME_FORMAT: | ||||
|             s = "WRONG_ISO_TIME_FORMAT"; | ||||
|         } | ||||
|         return s + ":" + m_desc; | ||||
|     } | ||||
| @@ -111,13 +115,25 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( | ||||
|                                             time_t end_parking_time, | ||||
|                                             struct price_t *price); | ||||
|  | ||||
| CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( | ||||
|                                             parking_tariff_t *tariff, | ||||
|                                             QDateTime const &start_parking_time, | ||||
|                                             QDateTime const &end_parking_time, | ||||
|                                             struct price_t *price); | ||||
|  | ||||
| CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( | ||||
|                                             parking_tariff_t *tariff, | ||||
|                                             time_t start_parking_time, | ||||
|                                             double cost, | ||||
|                                             QString &duration); | ||||
| #ifdef __cplusplus | ||||
| } // extern "C" | ||||
| #endif | ||||
|  | ||||
| CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( | ||||
|                                             parking_tariff_t *tariff, | ||||
|                                             QDateTime const &start_parking_time, | ||||
|                                             double cost, | ||||
|                                             QDateTime &ticketEndTime); | ||||
| //#ifdef __cplusplus | ||||
| //} // extern "C" | ||||
| //#endif | ||||
|  | ||||
| #endif // CALCULATE_PRICE_H | ||||
|   | ||||
		Reference in New Issue
	
	Block a user