OpenCPN Partial API docs
Loading...
Searching...
No Matches
notification.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2025 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#ifndef NOTIFICATION_H_
25#define NOTIFICATION_H_
26
27#include <string>
28
29enum class NotificationSeverity : int {
30 kInformational = 0,
31 kWarning = 1,
32 kCritical = 2
33};
34
37public:
38 Notification(NotificationSeverity _severity, const std::string &_message,
39 int _timeout_secs = -1);
40 virtual ~Notification() = default;
41
42 std::string GetMessage() { return message; }
43 NotificationSeverity GetSeverity() const { return severity; }
44 time_t GetActivateTime() const { return activate_time; }
45 std::string GetGuid() const { return guid; }
46 size_t GetStringHash() const { return message_hash; }
47 int GetTimeoutStart() const { return auto_timeout_start; }
48 int GetTimeoutLeft() const { return auto_timeout_left; }
49 void DecrementTimoutCount() { auto_timeout_left--; }
50
51private:
52 NotificationSeverity severity;
53 const std::string message;
54 const time_t activate_time;
55 const std::string guid;
56 const size_t message_hash;
57 int auto_timeout_start;
58 int auto_timeout_left;
59};
60
61#endif
User visible notification.