-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfig.h
More file actions
42 lines (34 loc) · 668 Bytes
/
Config.h
File metadata and controls
42 lines (34 loc) · 668 Bytes
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
#include <map>
#include <string>
#include <vector>
using std::map;
using std::string;
using std::vector;
class Config
{
public:
map<string, string> config;
void updateConfig(const char * fn);
void updateConfig(string & fn)
{
updateConfig(fn.c_str());
}
string & operator[](string & key) {
return config[key];
}
string & operator[](const char * key) {
string s = key;
return config[s];
}
vector<string> getValue(string & key)
{
return split(config[key], ';');
}
vector<string> getValue(const char * key)
{
string ts = config[key];
vector<string> tmp = split(ts, ';');
return tmp;
}
vector<string> split(string& str, char seq);
};