MCPcopy Create free account
hub / github.com/comaps/comaps / SplitIntoIntervals

Function SplitIntoIntervals

libs/editor/ui2oh.cpp:113–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111using Weekdays = std::vector<osmoh::Weekday>;
112
113std::vector<Weekdays> SplitIntoIntervals(editor::ui::OpeningDays const & days)
114{
115 ASSERT_GREATER(days.size(), 0, ("At least one day must present."));
116 std::vector<Weekdays> result;
117 auto const & noInversionDays = RemoveInversion(days);
118 ASSERT(!noInversionDays.empty(), ());
119
120 auto previous = *begin(noInversionDays);
121 result.push_back({previous});
122
123 for (auto it = next(begin(noInversionDays)); it != end(noInversionDays); ++it)
124 {
125 if (NextWeekdayNumber(previous) != WeekdayNumber(*it))
126 result.push_back({});
127 result.back().push_back(*it);
128 previous = *it;
129 }
130
131 return result;
132}
133
134osmoh::Weekdays MakeWeekdays(editor::ui::TimeTable const & tt)
135{

Callers 1

MakeWeekdaysFunction · 0.85

Calls 10

RemoveInversionFunction · 0.85
ASSERTFunction · 0.85
NextWeekdayNumberFunction · 0.85
WeekdayNumberFunction · 0.85
backMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected