mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
allow limiting concurrent http requests
add Semaphore update SettingsManager a little
This commit is contained in:
14
settings.hpp
14
settings.hpp
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <SimpleIni.h>
|
||||
|
||||
class SettingsManager {
|
||||
@@ -7,8 +8,17 @@ public:
|
||||
SettingsManager(std::string filename);
|
||||
|
||||
void Close();
|
||||
std::string GetSetting(std::string section, std::string key, std::string fallback = "");
|
||||
void SetSetting(std::string section, std::string key, std::string value);
|
||||
std::string GetSettingString(std::string section, std::string key, std::string fallback = "") const;
|
||||
int GetSettingInt(std::string section, std::string key, int fallback) const;
|
||||
|
||||
template<typename T>
|
||||
void SetSetting(std::string section, std::string key, T value) {
|
||||
static_assert(std::is_convertible<T, std::string>::value);
|
||||
if constexpr (std::is_same<T, std::string>::value)
|
||||
m_ini.SetValue(section.c_str(), key.c_str(), value.c_str());
|
||||
else
|
||||
m_ini.SetValue(section.c_str(), key.c_str(), std::to_string(value).c_str());
|
||||
}
|
||||
bool IsValid() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user