Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlga Khlopkova <o.khlopkova@corp.mail.ru>2020-09-02 17:55:16 +0300
committerMaksim Andrianov <maksimandrianov1@gmail.com>2020-09-18 12:41:49 +0300
commitc4d4f8fd98c982a433b5e25b6bbdcc503a7e3ad7 (patch)
tree927652440f05c8360560336f74775e2f513e94b1 /transit
parent1912bc58b7e28cccf2d89f10193675a08aeabe0d (diff)
[transit] Replace magic numbers with enum in Schedule.
Diffstat (limited to 'transit')
-rw-r--r--transit/transit_schedule.cpp14
-rw-r--r--transit/transit_schedule.hpp11
2 files changed, 18 insertions, 7 deletions
diff --git a/transit/transit_schedule.cpp b/transit/transit_schedule.cpp
index 0a48a445cd..7ca110c491 100644
--- a/transit/transit_schedule.cpp
+++ b/transit/transit_schedule.cpp
@@ -147,13 +147,13 @@ std::tuple<Date, Date, WeekSchedule> DatesInterval::Extract() const
date2.m_month = (m_data >> 12) & kMask4bits;
date2.m_day = (m_data >> 7) & kMask5bits;
- week[0] = m_data & 0x40;
- week[1] = m_data & 0x20;
- week[2] = m_data & 0x10;
- week[3] = m_data & 0x8;
- week[4] = m_data & 0x4;
- week[5] = m_data & 0x2;
- week[6] = m_data & 0x1;
+ week[WeekDays::Sunday] = m_data & 0x40;
+ week[WeekDays::Monday] = m_data & 0x20;
+ week[WeekDays::Tuesday] = m_data & 0x10;
+ week[WeekDays::Wednesday] = m_data & 0x8;
+ week[WeekDays::Thursday] = m_data & 0x4;
+ week[WeekDays::Friday] = m_data & 0x2;
+ week[WeekDays::Saturday] = m_data & 0x1;
return {date1, date2, week};
}
diff --git a/transit/transit_schedule.hpp b/transit/transit_schedule.hpp
index 816d95f8b4..570d8fe4cf 100644
--- a/transit/transit_schedule.hpp
+++ b/transit/transit_schedule.hpp
@@ -87,6 +87,17 @@ struct Time
};
using WeekSchedule = std::array<bool, 7>;
+
+enum WeekDays
+{
+ Sunday = 0,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday
+};
// Service dates specified using a weekly schedule with start and end dates. Dates range is
// specified by the start_date and end_date fields in the GTFS calendar.txt.
// Dates interval and open/closed states for week days are stored |m_data|.