7namespace ehm_dal::tools::schedule_template_generator {
17 QDate date(
const qint32 index);
20 void setDayPriorities(
const qint32 mon,
27 void setDayPriorities(
const std::vector<qint32> &day_priorities);
30 void setExcludedDateRange(
const QDate &excluded_start_date,
const QDate &excluded_end_date);
33 bool generate(
const qint32 target_dates_count);
36 inline qint32 count()
const {
return static_cast<qint32
>(schedule_dates_.size()); }
40 std::vector<QDate> schedule_dates_;
43 std::vector<std::vector<QDate>> date_cache_;
45 void populateCache(std::vector<QDate> &cache, Qt::DayOfWeek day);
46 void tidyUpCache(std::vector<QDate> &cache);
49 void addDate(std::vector<QDate> &cache,
const qint32 index);
50 bool isValidDate(
const QDate &date)
const;
51 void pickDates(std::vector<QDate> &cache,
const qint32 step);
54 qint32 target_dates_count_{0};
57 QDate excluded_start_date_;
58 QDate excluded_end_date_;
60 inline bool areMoreDatesRequired()
const {
return count() < target_dates_count_; }
61 inline bool hasSufficientDates()
const {
return !areMoreDatesRequired(); }
73 DAYS_IN_A_WEEK = DAY_COUNT
76 inline qint32 dayToIndex(
const Qt::DayOfWeek day)
const {
return static_cast<qint32
>(day) - 1; }
77 inline Qt::DayOfWeek indexToDay(
const ENUM_DAYS index)
const
79 return static_cast<Qt::DayOfWeek
>(index + 1);
83 std::vector<std::pair<ENUM_DAYS, qint32>> day_priority_list_;
86 bool generateDates(
const auto &step_calculation_lambda);