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

Function SetUpTimeTable

libs/editor/ui2oh.cpp:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void SetUpTimeTable(osmoh::TTimespans spans, editor::ui::TimeTable & tt)
46{
47 using namespace osmoh;
48
49 // Expand plus: 13:15+ -> 13:15-24:00.
50 for (auto & span : spans)
51 span.ExpandPlus();
52
53 std::sort(std::begin(spans), std::end(spans), [](Timespan const & a, Timespan const & b)
54 {
55 auto const start1 = a.GetStart().GetHourMinutes().GetDuration();
56 auto const start2 = b.GetStart().GetHourMinutes().GetDuration();
57
58 return start1 < start2;
59 });
60
61 // Take first start and last end as opening time span.
62 tt.SetOpeningTime({spans.front().GetStart(), spans.back().GetEnd()});
63
64 // Add an end of a span of index i and start of following span
65 // as exclude time.
66 for (size_t i = 0; i + 1 < spans.size(); ++i)
67 tt.AddExcludeTime({spans[i].GetEnd(), spans[i + 1].GetStart()});
68}
69
70int32_t WeekdayNumber(osmoh::Weekday const wd)
71{

Callers 1

MakeTimeTableSetFunction · 0.85

Calls 11

ExpandPlusMethod · 0.80
SetOpeningTimeMethod · 0.80
frontMethod · 0.80
backMethod · 0.80
AddExcludeTimeMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
GetDurationMethod · 0.45
GetStartMethod · 0.45
GetEndMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected