Tag Parser  6.2.2
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 
56 private:
57  NotificationType m_type;
58  std::string m_msg;
59  std::string m_context;
60  ChronoUtilities::DateTime m_creationTime;
61 };
62 
67 {
68  return m_type;
69 }
70 
74 inline const std::string &Notification::message() const
75 {
76  return m_msg;
77 }
78 
82 inline const std::string &Notification::context() const
83 {
84  return m_context;
85 }
86 
91 {
92  return m_creationTime;
93 }
94 
99 {
101 }
102 
103 }
104 
105 #endif // NOTIFICATION_H
NotificationType
Specifies the notification type.
Definition: notification.h:18
static constexpr NotificationType worstNotificationType()
Returns the worst notification type.
Definition: notification.h:98
const ChronoUtilities::DateTime & creationTime() const
Returns the time when the notification originally was created.
Definition: notification.h:90
NotificationType type() const
Returns the notification type.
Definition: notification.h:66
std::list< Notification > NotificationList
Definition: notification.h:39
The Notification class holds a notification message of a certain notification type.
Definition: notification.h:43
const std::string & context() const
Returns the context, eg.
Definition: notification.h:82
const std::string & message() const
Returns the message.
Definition: notification.h:74
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.