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

Function IsActive

3party/opening_hours/rules_evaluation.cpp:212–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210using ::operator==;
211
212bool IsActive(Timespan span, std::tm const & time)
213{
214 // Timespan with e.h. should be split into parts with no e.h.
215 // before calling IsActive().
216 // TODO(mgsergio): set assert(!span.HasExtendedHours())
217
218 span.ExpandPlus();
219 if (span.HasStart() && span.HasEnd())
220 {
221 THourMinutes start;
222 THourMinutes end;
223 THourMinutes toBeChecked;
224
225 if (!ToHourMinutes(span.GetStart(), start))
226 return false;
227
228 if (!ToHourMinutes(span.GetEnd(), end))
229 return false;
230
231 if (!ToHourMinutes(time, toBeChecked))
232 return false;
233
234 return start <= toBeChecked && toBeChecked <= end;
235 }
236 else if (span.HasStart() && span.HasPlus())
237 {
238 // TODO(mgsergio): Not implemented yet
239 return false;
240 }
241 return false;
242}
243
244bool IsActive(WeekdayRange const & range, std::tm const & date)
245{

Callers 3

IsActiveAnyFunction · 0.70
IsDayActiveFunction · 0.70
IsFinishedMethod · 0.50

Calls 14

ToHourMinutesFunction · 0.85
ToWeekdayFunction · 0.85
NormalizeEndFunction · 0.85
GetWeekNumberFunction · 0.85
IsActiveImplFunction · 0.85
ExpandPlusMethod · 0.80
HasWdayMethod · 0.80
HasStartMethod · 0.45
HasEndMethod · 0.45
GetStartMethod · 0.45
GetEndMethod · 0.45
HasPlusMethod · 0.45

Tested by

no test coverage detected