rcpp_framework/core/settings/settings.h

38 lines
907 B
C
Raw Normal View History

2020-11-25 00:20:41 +01:00
#ifndef SETTINGS_H
#define SETTINGS_H
#include <map>
2020-12-08 16:22:18 +01:00
2022-01-06 18:58:25 +01:00
#include "core/object.h"
#include "core/string.h"
#include "core/variant.h"
2020-12-08 16:22:18 +01:00
2022-01-06 18:58:25 +01:00
class Settings : public Object {
RCPP_OBJECT(Settings, Object);
public:
Variant get_value(const String &key, const Variant &def = Variant());
String get_value_string(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
2022-01-06 18:58:25 +01:00
virtual void set_value(const String &key, const Variant &value);
2022-01-06 18:51:50 +01:00
void parse_ini_file(const String &path);
2020-12-08 16:22:18 +01:00
static Settings *get_singleton();
2020-12-08 16:22:18 +01:00
Settings(const bool singleton = false);
virtual ~Settings();
2020-12-08 16:22:18 +01:00
protected:
2022-01-06 18:36:31 +01:00
std::map<String, Variant> _data;
private:
static Settings *_singleton;
};
2020-11-25 00:20:41 +01:00
#endif