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

Method SetOpeningTime

libs/editor/opening_hours_ui.cpp:157–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157bool TimeTable::SetOpeningTime(osmoh::Timespan const & span)
158{
159 if (IsTwentyFourHours())
160 return false;
161
162 m_openingTime = span;
163 osmoh::TTimespans excludeTime;
164 for (auto const & excludeSpan : GetExcludeTime())
165 {
166 auto const openingTimeStart = GetOpeningTime().GetStart().GetHourMinutes().GetDuration();
167 auto const openingTimeEnd = GetOpeningTime().GetEnd().GetHourMinutes().GetDuration();
168 auto const excludeSpanStart = excludeSpan.GetStart().GetHourMinutes().GetDuration();
169 auto const excludeSpanEnd = excludeSpan.GetEnd().GetHourMinutes().GetDuration();
170
171 if (!GetOpeningTime().HasExtendedHours() &&
172 (excludeSpanStart < openingTimeStart || openingTimeEnd < excludeSpanEnd))
173 continue;
174
175 excludeTime.push_back(excludeSpan);
176 }
177
178 m_excludeTime.swap(excludeTime);
179 return true;
180}
181
182bool TimeTable::CanAddExcludeTime() const
183{

Calls 6

HasExtendedHoursMethod · 0.80
GetDurationMethod · 0.45
GetStartMethod · 0.45
GetEndMethod · 0.45
push_backMethod · 0.45
swapMethod · 0.45

Tested by 2

UNIT_TESTFunction · 0.64
UNIT_TESTFunction · 0.64