-
Notifications
You must be signed in to change notification settings - Fork 0
/
msg.cpp
29 lines (25 loc) · 654 Bytes
/
msg.cpp
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
#include "msg.h"
int GetMsgLevel(MsgID id) {
static const int msg_level[] = {
#define MSG(ID, LEVEL, TEXT) LEVEL,
#include "msg.def"
-1,// use -1 as a sentinel
};
return msg_level[static_cast<int>(id)];
}
const char *GetMsgTitle(MsgID id) {
static const char *msg_title[] = {
#define MSG(ID, LEVEL, TEXT) #ID,
#include "msg.def"
nullptr,// use nullptr as a sentinel
};
return msg_title[static_cast<int>(id)];
}
const char *GetMsgText(MsgID id) {
static const char *msg_text[] = {
#define MSG(ID, LEVEL, TEXT) TEXT,
#include "msg.def"
nullptr,// use nullptr as a sentinel
};
return msg_text[static_cast<int>(id)];
}