-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnotify.h
34 lines (30 loc) · 1.01 KB
/
notify.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include <string>
namespace vrok {
class Notify {
public:
class Notifier {
public:
virtual void OnError(int level, std::string msg) { }
virtual void OnWarning(int level, std::string msg) { }
virtual void OnInformation(std::string msg) { }
virtual void OnDebug(int level, std::string msg) { }
};
Notify() : _notifier(nullptr), _elevel(0), _dlevel(0), _wlevel(0) { }
static Notify *GetInstance() {
static Notify notify;
return ¬ify;
}
void SetNotifier(Notifier *notifier) { _notifier = notifier; }
void SetErrorLevel(int level) { _elevel = level; }
void setWarningLevel(int level) { _wlevel = level; }
void setDebugLevel(int level) { _dlevel = level; }
void NotifyError(int level, std::string msg);
void NotifyWarning(int level, std::string msg);
void NotifyInformation(std::string msg);
void NotifyDebug(int level, std::string msg);
private:
Notifier *_notifier;
int _elevel, _dlevel, _wlevel;
};
}