diff options
Diffstat (limited to '3party/opening_hours/opening_hours.cpp')
-rw-r--r-- | 3party/opening_hours/opening_hours.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/3party/opening_hours/opening_hours.cpp b/3party/opening_hours/opening_hours.cpp index cac81f87d8..441cc6a776 100644 --- a/3party/opening_hours/opening_hours.cpp +++ b/3party/opening_hours/opening_hours.cpp @@ -277,6 +277,16 @@ std::ostream & operator<<(std::ostream & ost, Time const & time) return ost; } +bool operator==(Time const & lhs, Time const & rhs) +{ + if (lhs.IsEmpty() && rhs.IsEmpty()) + return true; + + return lhs.GetType() == rhs.GetType() && + lhs.GetHours() == rhs.GetHours() && + lhs.GetMinutes() == rhs.GetMinutes(); +} + // TimespanPeriod ---------------------------------------------------------------------------------- TimespanPeriod::TimespanPeriod(HourMinutes const & hm): m_hourMinutes(hm), @@ -301,6 +311,16 @@ std::ostream & operator<<(std::ostream & ost, TimespanPeriod const p) return ost; } +bool operator==(TimespanPeriod const & lhs, TimespanPeriod const & rhs) +{ + if (lhs.IsEmpty() && rhs.IsEmpty()) + return true; + + return lhs.GetType() == rhs.GetType() && + lhs.GetHourMinutes() == rhs.GetHourMinutes() && + lhs.GetMinutes() == rhs.GetMinutes(); +} + // Timespan ---------------------------------------------------------------------------------------- bool Timespan::HasExtendedHours() const { @@ -349,6 +369,25 @@ std::ostream & operator<<(std::ostream & ost, osmoh::TTimespans const & timespan return ost; } +bool operator==(Timespan const & lhs, Timespan const & rhs) +{ + if (lhs.IsEmpty() && rhs.IsEmpty()) + return true; + + if (lhs.IsEmpty() != rhs.IsEmpty() || + lhs.HasStart() != rhs.HasStart() || + lhs.HasEnd() != rhs.HasEnd() || + lhs.HasPlus() != rhs.HasPlus() || + lhs.HasPeriod() != rhs.HasPeriod()) + { + return false; + } + + return lhs.GetStart() == rhs.GetStart() && + lhs.GetEnd() == rhs.GetEnd() && + lhs.GetPeriod() == lhs.GetPeriod(); +} + // NthWeekdayOfTheMonthEntry ----------------------------------------------------------------------- std::ostream & operator<<(std::ostream & ost, NthWeekdayOfTheMonthEntry const entry) { |