-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.h
28 lines (24 loc) · 792 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
#pragma once
#include <cstdint>
#include <exception>
#include <string>
class ConfigException : public std::exception {
protected:
std::string message;
public:
ConfigException(const std::string& message) noexcept;
virtual const char* what() const noexcept override;
};
class Config {
public:
Config() = delete;
static void SetDeafultConfig();
static void load_config(const std::string& path);
static void save_config(const std::string& path);
static void set_config(const std::string& key, const std::string& value);
static void set_config(const std::string& key, int value);
static void set_config(const std::string& key, bool value,bool re);
static void set_config(const std::string& key, double value);
template <typename T>
static T get_config(const std::string& key);
};