Add new enum-values for business_hours. Keep the old ones for

backward-compatibility.
This commit is contained in:
Gerhard Hoffmann 2024-04-19 13:18:02 +02:00
parent b31fcc5f4f
commit 1991853b66

View File

@ -6,20 +6,23 @@
/// </summary>
///
#define _MON_ (1ULL << 8)
#define _TUE_ (1ULL << 9)
#define _WED_ (1ULL << 10)
#define _THU_ (1ULL << 11)
#define _FRI_ (1ULL << 12)
#define _SAT_ (1ULL << 13)
#define _SUN_ (1ULL << 14)
#include <Qt>
#define _NO_RESTRICTION_24_7_ (uint64_t)(0ULL)
#define _MON_ (uint64_t)(1ULL << 8)
#define _TUE_ (uint64_t)(1ULL << 9)
#define _WED_ (uint64_t)(1ULL << 10)
#define _THU_ (uint64_t)(1ULL << 11)
#define _FRI_ (uint64_t)(1ULL << 12)
#define _SAT_ (uint64_t)(1ULL << 13)
#define _SUN_ (uint64_t)(1ULL << 14)
#define _WEEK_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_))
#define _WORKING_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_|_SAT_))
#define _ALL_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_|_SAT_|_SUN_))
#define _OFFICIAL_HOLIDAY_ (1ULL << 15)
#define _ONLY_WEEKEND ((_SAT_|_SUN_))
#define _ONLY_OPEN_FOR_BUSINESS_DAYS (1ULL << 16) /* verkaufsoffen */
#define _NOT_DEFINED (~0ULL)
#define _OFFICIAL_HOLIDAY_ (uint64_t)(1ULL << 15)
#define _ONLY_WEEKEND_ ((_SAT_|_SUN_))
#define _ONLY_OPEN_FOR_BUSINESS_DAYS_ (uint64_t)(1ULL << 16) /* verkaufsoffen */
#define _NOT_DEFINED_ (uint64_t)(~0ULL)
enum BusinessHours : std::uint64_t
{
@ -37,7 +40,7 @@ enum BusinessHours : std::uint64_t
NoBusinessHoursDefined = 255,
// new 12.04.2024
NO_RESTRICTION_24_7 = 0,
NO_RESTRICTION_24_7 = _NO_RESTRICTION_24_7_,
MON = _MON_,
TUE = _TUE_,
WED = _WED_,
@ -49,11 +52,26 @@ enum BusinessHours : std::uint64_t
WORKING_DAYS = _WORKING_DAYS_,
ALL_DAYS = _ALL_DAYS_,
OFFICIAL_HOLIDAY = _OFFICIAL_HOLIDAY_,
ONLY_WEEKEND = _ONLY_WEEKEND,
ONLY_OPEN_FOR_BUSINESS_DAYS = _ONLY_OPEN_FOR_BUSINESS_DAYS,
NOT_DEFINED = _NOT_DEFINED
ONLY_WEEKEND = _ONLY_WEEKEND_,
ONLY_OPEN_FOR_BUSINESS_DAYS = _ONLY_OPEN_FOR_BUSINESS_DAYS_,
NOT_DEFINED = _NOT_DEFINED_
};
#if 0
static bool business(uint64_t businessHours, QDateTime &const dt) {
switch (dayOfWeek) {
case Qt::Monday:
(businessHours & _MON_) == _MON_;
case Qt::Tuesday:
case Qt::Wednesday:
case Qt::Thursday:
case Qt::Saturday:
case Qt::Sunday:
}
}
#endif
struct BusinessHours_struct {
BusinessHours bh;
};