-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.h
36 lines (26 loc) · 877 Bytes
/
config.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
#ifndef __CONFIGH__
#define __CONFIGH__
#include <iostream>
#include <map>
#define CONFIG_COMMENT_PRE "#"
#define CONFIG_DELIMITER "="
#define CONFIG_FILE_DESCRIPTION "# Tibria advanced options configuration\n# DO NOT EDIT THIS FILE\n"
typedef std::map<std::string, std::string> valuesMap;
class Config {
public:
Config();
bool load(std::string filename);
bool save();
void free();
std::string getString(std::string key, std::string def = std::string());
int getInteger(std::string key, int def = 0);
bool getBoolean(std::string key, bool def = false);
void setString(std::string key, std::string value);
void setInteger(std::string key, int value);
void setBoolean(std::string key, bool value);
private:
std::map<std::string, std::string> m_values;
std::string m_file;
bool m_loaded;
};
#endif