Implement wxDateTime::Is{EqualTo,{Earlier,Later}Than}() in terms of operators

Avoid duplicating the same code, even if it's trivial, in both places.

Notice that these functions are implemented in terms of operators and not vice
versa because we have no functions corresponding to operator<=() or
operator>=().
This commit is contained in:
Kevin B. McCarty 2015-05-09 19:28:04 +02:00 committed by Vadim Zeitlin
parent d47efc42ff
commit fda904ea77

View File

@ -1768,23 +1768,17 @@ inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
return m_time == datetime.m_time;
return *this == datetime;
}
inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
return m_time < datetime.m_time;
return *this < datetime;
}
inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
return m_time > datetime.m_time;
return *this > datetime;
}
inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,