Add == operator for notifications

This commit is contained in:
Martchus 2017-08-17 19:04:40 +02:00
parent de42acd190
commit 728a6a27dc
1 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,7 @@ public:
const ChronoUtilities::DateTime &creationTime() const; const ChronoUtilities::DateTime &creationTime() const;
static constexpr inline NotificationType worstNotificationType(); static constexpr inline NotificationType worstNotificationType();
static void sortByTime(NotificationList &notifications); static void sortByTime(NotificationList &notifications);
bool operator==(const Notification &other) const;
private: private:
NotificationType m_type; NotificationType m_type;
@ -100,6 +101,15 @@ constexpr NotificationType Notification::worstNotificationType()
return NotificationType::Critical; return NotificationType::Critical;
} }
/*!
* \brief Returns whether the current instance equals \a other.
* \remarks The creation time is *not* taken into account.
*/
inline bool Notification::operator==(const Notification &other) const
{
return m_type == other.m_type && m_msg == other.m_msg && m_context == other.m_context;
}
} }
#endif // NOTIFICATION_H #endif // NOTIFICATION_H