Tag Parser  6.5.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
notification.h
Go to the documentation of this file.
1 #ifndef NOTIFICATION_H
2 #define NOTIFICATION_H
3 
4 #include "./global.h"
5 
6 #include <c++utilities/chrono/datetime.h>
7 
8 #include <string>
9 #include <list>
10 
11 namespace Media {
12 
18 enum class NotificationType
19 {
20  None = 0,
21  Debug = 1,
22  Information = 2,
23  Warning = 3,
24  Critical = 4
25 };
26 
27 
32 {
33  if(lhs < rhs) {
34  lhs = rhs;
35  }
36  return lhs;
37 }
38 
40 
41 typedef std::list<Notification> NotificationList;
42 
44 {
45 public:
46  Notification(NotificationType type, const std::string &message, const std::string &context);
47 
48  NotificationType type() const;
49  const char *typeName() const;
50  const std::string &message() const;
51  const std::string &context() const;
52  const ChronoUtilities::DateTime &creationTime() const;
53  static constexpr inline NotificationType worstNotificationType();
54  static void sortByTime(NotificationList &notifications);
55  bool operator==(const Notification &other) const;
56 
57 private:
58  NotificationType m_type;
59  std::string m_msg;
60  std::string m_context;
61  ChronoUtilities::DateTime m_creationTime;
62 };
63 
68 {
69  return m_type;
70 }
71 
75 inline const std::string &Notification::message() const
76 {
77  return m_msg;
78 }
79 
83 inline const std::string &Notification::context() const
84 {
85  return m_context;
86 }
87 
92 {
93  return m_creationTime;
94 }
95 
100 {
102 }
103 
108 inline bool Notification::operator==(const Notification &other) const
109 {
110  return m_type == other.m_type && m_msg == other.m_msg && m_context == other.m_context;
111 }
112 
113 }
114 
115 #endif // NOTIFICATION_H
NotificationType
Specifies the notification type.
Definition: notification.h:18
static constexpr NotificationType worstNotificationType()
Returns the worst notification type.
Definition: notification.h:99
const ChronoUtilities::DateTime & creationTime() const
Returns the time when the notification originally was created.
Definition: notification.h:91
bool operator==(const Notification &other) const
Returns whether the current instance equals other.
Definition: notification.h:108
NotificationType type() const
Returns the notification type.
Definition: notification.h:67
std::list< Notification > NotificationList
Definition: notification.h:39
The Notification class holds a notification message of a certain notification type.
Definition: notification.h:43
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:28
const std::string & context() const
Returns the context, eg.
Definition: notification.h:83
const std::string & message() const
Returns the message.
Definition: notification.h:75
NotificationType & operator|=(NotificationType &lhs, const NotificationType &rhs)
Sets lhs to rhs if rhs is worse than lhs and returns lhs.
Definition: notification.h:31
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.