[Windows] Remove redundant DirectSound error codes
[xbmc.git] / xbmc / events / EventLog.h
blob4c71eef767b15408c6ffae8477e3afd18c5a5403
1 /*
2 * Copyright (C) 2015-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "events/IEvent.h"
12 #include "threads/CriticalSection.h"
14 #include <map>
15 #include <string>
16 #include <vector>
18 #define NOTIFICATION_DISPLAY_TIME 5000
19 #define NOTIFICATION_MESSAGE_TIME 1000
21 typedef std::vector<EventPtr> Events;
23 class CEventLog
25 public:
26 CEventLog() = default;
27 CEventLog(const CEventLog&) = delete;
28 CEventLog& operator=(CEventLog const&) = delete;
29 ~CEventLog() = default;
31 const Events& Get() const;
32 Events Get(EventLevel level, bool includeHigherLevels = false) const;
33 EventPtr Get(const std::string& eventIdentifier) const;
35 void Add(const EventPtr& event);
36 void Add(const EventPtr& event, bool withNotification, bool withSound = true);
37 void AddWithNotification(const EventPtr& event,
38 unsigned int displayTime = NOTIFICATION_DISPLAY_TIME,
39 unsigned int messageTime = NOTIFICATION_MESSAGE_TIME,
40 bool withSound = true);
41 void AddWithNotification(const EventPtr& event, bool withSound);
42 void Remove(const EventPtr& event);
43 void Remove(const std::string& eventIdentifier);
44 void Clear();
45 void Clear(EventLevel level, bool includeHigherLevels = false);
47 bool Execute(const std::string& eventIdentifier);
49 static std::string EventLevelToString(EventLevel level);
50 static EventLevel EventLevelFromString(const std::string& level);
52 void ShowFullEventLog(EventLevel level = EventLevel::Basic, bool includeHigherLevels = true);
54 private:
55 void SendMessage(const EventPtr& event, int message);
57 typedef std::vector<EventPtr> EventsList;
58 typedef std::map<std::string, EventPtr> EventsMap;
59 EventsList m_events;
60 EventsMap m_eventsMap;
61 mutable CCriticalSection m_critical;