-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.hpp
56 lines (40 loc) · 986 Bytes
/
Config.hpp
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
54
55
56
//
// Created by rege on 09.03.17.
//
#ifndef THECAR_CONFIG_HPP
#define THECAR_CONFIG_HPP
#define CGET_INT(s) Config::getInstance().getInt(s)
#define CGET_STR(s) Config::getInstance().getString(s)
#define CGET_BOOL(s) Config::getInstance().getBool(s)
#include <string>
using namespace std;
const string DEFAULT_CONFIG_PATH = "/etc/TheCarConfig.lua";
#if false
typedef class NotFoundException : public exception
{
} NotFoundException;
#endif
// singletone
class Config
{
private:
static string filePath;
Config (string configPath);
Config (const Config &);
Config & operator= (Config &);
public:
static Config & getInstance ()
{
if (filePath == "")
{
filePath = DEFAULT_CONFIG_PATH;
}
static Config instance(filePath);
return instance;
}
static void setFilePath (string s);
int getInt (string);
bool getBool (string);
string getString (string);
};
#endif //THECAR_CONFIG_HPP