-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.h
53 lines (47 loc) · 1002 Bytes
/
error.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef ERROR_H
#define ERROR_H
// Execution message enumerations
enum exemsg {
EXE_OK,
EXE_ARG2BIG,
EXE_ARG2SML,
EXE_CONFLICT,
EXE_BADFORM,
EXE_INVARG,
EXE_NOFILE,
EXE_NOTFOUND,
EXE_NOTWHITE,
EXE_NO_WLIST,
EXE_NODIR,
EXE_COUNT,
};
enum errfmt {
EF_0,
EF_1,
EF_2,
};
class error
{
public:
error(){}
void init (int argc, char **argv);
void print_cmdline();
void print_cmd_errmsg(int err, std::string& str1, std::string& str2);
void print_errmsg(int err, std::vector<std::string> strvec);
int get_cmderrmask() {return m_cmderrmask;}
void set_cmderrmask_bit(int bit) {m_cmderrmask |= bit;}
void clr_cmderrmask_bit(int bit) {m_cmderrmask &= ~bit;}
private:
void map_err(int err, std::string str);
int m_orig_argc;
char **m_orig_argv;
std::map <int, std::string> m_errmap;
std::string errstr[EXE_COUNT];
int m_cmderrmask =
((1 << EXE_ARG2BIG) |
(1 << EXE_ARG2SML) |
(1 << EXE_CONFLICT) |
(1 << EXE_BADFORM) |
(1 << EXE_INVARG));
};
#endif // ERROR_H