Minor: format to Unix.

This commit is contained in:
Gerhard Hoffmann 2023-11-27 16:09:38 +01:00
parent 20cdb8b07f
commit e9047f995a

View File

@ -1,85 +1,85 @@
#pragma once #pragma once
#include <cstring> #include <cstring>
#include <string.h> #include <string.h>
#include <ctime> #include <ctime>
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#include "day_of_week.h" #include "day_of_week.h"
#include "configuration.h" #include "configuration.h"
#include "time_range.h" #include "time_range.h"
#include "payment_method.h" #include "payment_method.h"
#include <QDateTime> #include <QDateTime>
using namespace std; using namespace std;
namespace Utilities { namespace Utilities {
/// <summary> /// <summary>
/// Get day of week from current date (Zeller's Algorithm), starting day is Sunday /// Get day of week from current date (Zeller's Algorithm), starting day is Sunday
/// </summary> /// </summary>
/// <param name="date"></param> /// <param name="date"></param>
/// <returns></returns> /// <returns></returns>
DayOfWeek GetDayOfWeek(struct tm* tm); DayOfWeek GetDayOfWeek(struct tm* tm);
/// <summary> /// <summary>
/// Date and time parse helper function /// Date and time parse helper function
/// </summary> /// </summary>
/// <returns>Returns time (tm) structure</returns> /// <returns>Returns time (tm) structure</returns>
struct tm DateTimeToStructTm(const char* dateTimeStr); struct tm DateTimeToStructTm(const char* dateTimeStr);
/// <summary> /// <summary>
/// Date parse helper function /// Date parse helper function
/// </summary> /// </summary>
/// <returns>Returns time (tm) structure</returns> /// <returns>Returns time (tm) structure</returns>
struct tm DateToStructTm(const char* dateStr); struct tm DateToStructTm(const char* dateStr);
/// <summary> /// <summary>
/// Time parse helper function /// Time parse helper function
/// </summary> /// </summary>
/// <returns>Returns time (tm) structure</returns> /// <returns>Returns time (tm) structure</returns>
struct tm TimeToStructTm(const char* timeStr, int year, int mon, int mday, int wday); struct tm TimeToStructTm(const char* timeStr, int year, int mon, int mday, int wday);
/// <summary> /// <summary>
/// Get current local time /// Get current local time
/// </summary> /// </summary>
/// <returns>Returns time_t structure</returns> /// <returns>Returns time_t structure</returns>
time_t GetCurrentLocalTime(); time_t GetCurrentLocalTime();
/// <summary> /// <summary>
/// Zeller's algorithm for determining day of week /// Zeller's algorithm for determining day of week
/// </summary> /// </summary>
int ZellersAlgorithm(int day, int month, int year); int ZellersAlgorithm(int day, int month, int year);
/// <summary> /// <summary>
/// Checks if current datetime is in range between start and end month of parking worktime /// Checks if current datetime is in range between start and end month of parking worktime
/// </summary> /// </summary>
/// <param name="tariff_cfg"></param> /// <param name="tariff_cfg"></param>
/// <param name="currentDateTime"></param> /// <param name="currentDateTime"></param>
/// <returns></returns> /// <returns></returns>
bool IsYearPeriodActive(Configuration* cfg, struct tm* currentDateTime); bool IsYearPeriodActive(Configuration* cfg, struct tm* currentDateTime);
bool IsYearPeriodActive(Configuration const *cfg, QDateTime const &currentDateTime); bool IsYearPeriodActive(Configuration const *cfg, QDateTime const &currentDateTime);
/// <summary> /// <summary>
/// Check permissions /// Check permissions
/// </summary> /// </summary>
bool CheckSpecialDay(Configuration* cfg, const char* currentDateTimeStr, int* specialDayId, double* specialDayPrice); bool CheckSpecialDay(Configuration* cfg, const char* currentDateTimeStr, int* specialDayId, double* specialDayPrice);
bool CheckSpecialDay(Configuration const *cfg, bool CheckSpecialDay(Configuration const *cfg,
QDateTime const &currentDateTimeS, QDateTime const &currentDateTimeS,
int* specialDayId, uint32_t *specialDayPrice); int* specialDayId, uint32_t *specialDayPrice);
/// <summary> /// <summary>
/// Calculates price per unit /// Calculates price per unit
/// </summary> /// </summary>
/// <param name="pra_price"></param> /// <param name="pra_price"></param>
/// <returns></returns> /// <returns></returns>
double CalculatePricePerUnit(double pra_price, double durationUnit = -1); double CalculatePricePerUnit(double pra_price, double durationUnit = -1);
QTime SpecialDaysWorkTimeFrom(Configuration const *cfg, int specialDayId); QTime SpecialDaysWorkTimeFrom(Configuration const *cfg, int specialDayId);
QTime SpecialDaysWorkTimeUntil(Configuration const *cfg, int specialDayId); QTime SpecialDaysWorkTimeUntil(Configuration const *cfg, int specialDayId);
QTime WeekDaysWorkTimeFrom(std::multimap<int, ATBWeekDaysWorktime>::const_iterator itr); QTime WeekDaysWorkTimeFrom(std::multimap<int, ATBWeekDaysWorktime>::const_iterator itr);
QTime WeekDaysWorkTimeUntil(std::multimap<int, ATBWeekDaysWorktime>::const_iterator itr); QTime WeekDaysWorkTimeUntil(std::multimap<int, ATBWeekDaysWorktime>::const_iterator itr);
bool isCarryOverSet(Configuration const *cfg, PaymentMethod paymentMethodId); bool isCarryOverSet(Configuration const *cfg, PaymentMethod paymentMethodId);
bool isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymentMethodId); bool isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymentMethodId);
PaymentMethod getPaymentMethodId(Configuration const *cfg); PaymentMethod getPaymentMethodId(Configuration const *cfg);
} }