This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.hpp
98 lines (70 loc) · 1.87 KB
/
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
// Created by rege on 09.03.17.
//
#ifndef THECAR_CONFIG_HPP
#define THECAR_CONFIG_HPP
#include <string>
const std::string DEFAULT_CONFIG_PATH = "/home/rege/Workspace/CLionProjects/TheCar2/TheCarConfig.lua";
// singleton
class Config
{
private:
static std::string filePath;
Config ();
Config (const Config &);
Config & operator= (Config &);
public:
static Config & getInstance ()
{
static Config instance;
return instance;
}
void init (const char * pathToConfig);
std::string getString (std::string path);
int getInt (std::string path);
unsigned int getUint (std::string path);
long long int getLLong (std::string path);
unsigned long long int getUllong (std::string path);
double getDouble (std::string path);
float getFloat (std::string path);
bool getBool (std::string path);
std::vector<std::string> getStringVector (std::string path);
};
inline std::string getString (std::string path)
{
return Config::getInstance().getString(path);
}
inline int getInt (std::string path)
{
return Config::getInstance().getInt(path);
}
inline unsigned int getUint (std::string path)
{
return Config::getInstance().getUint(path);
}
inline long long int getLLong (std::string path)
{
return Config::getInstance().getLLong(path);
}
inline unsigned long long int getUllong (std::string path)
{
return Config::getInstance().getUllong(path);
}
inline double getDouble (std::string path)
{
return Config::getInstance().getDouble(path);
}
inline float getFloat (std::string path)
{
return Config::getInstance().getFloat(path);
}
inline bool getBool (std::string path)
{
return Config::getInstance().getBool(path);
}
// separator is ';'
inline std::vector<std::string> getStringVector (std::string path)
{
return Config::getInstance().getStringVector(path);
}
#endif //THECAR_CONFIG_HPP