2020-11-25 00:20:41 +01:00
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
#include <map>
|
2020-12-08 16:22:18 +01:00
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
#include "core/string.h"
|
2020-12-08 16:22:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
class Settings {
|
2021-11-19 20:02:59 +01:00
|
|
|
public:
|
|
|
|
String get_value(const String &key, const String &def = "");
|
|
|
|
int get_value_int(const String &key, const int def = 0);
|
|
|
|
float get_value_float(const String &key, const float def = 0);
|
|
|
|
double get_value_double(const String &key, const double def = 0);
|
|
|
|
bool get_value_bool(const String &key, const bool def = false);
|
2020-12-08 16:22:18 +01:00
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
void parse_ini_file(const String &path);
|
2020-12-08 16:22:18 +01:00
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
static Settings *get_singleton();
|
2020-12-08 16:22:18 +01:00
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
Settings(const bool singleton = false);
|
|
|
|
virtual ~Settings();
|
2020-12-08 16:22:18 +01:00
|
|
|
|
|
|
|
protected:
|
2021-11-19 20:02:59 +01:00
|
|
|
static Settings *_singleton;
|
2020-11-25 00:20:41 +01:00
|
|
|
|
2021-11-19 20:02:59 +01:00
|
|
|
std::map<String, String> _data;
|
|
|
|
};
|
2020-11-25 00:20:41 +01:00
|
|
|
|
|
|
|
#endif
|