1
0
Fork 0
forked from suyu/suyu

frontend_common: config: Move WriteIntegerSetting definition to header

Fixes a compiler error where the compiler could not see the definition of the method in qt_config and others.
This commit is contained in:
t895 2024-01-03 17:57:20 -05:00
parent 148ad0cf0b
commit bdf87ba0f8
2 changed files with 11 additions and 16 deletions

View file

@ -762,17 +762,6 @@ void Config::WriteBooleanSetting(const std::string& key, const bool& value,
WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global); WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global);
} }
template <typename T>
std::enable_if_t<std::is_integral_v<T>> Config::WriteIntegerSetting(
const std::string& key, const T& value, const std::optional<T>& default_value,
const std::optional<bool>& use_global) {
std::optional<std::string> string_default = std::nullopt;
if (default_value.has_value()) {
string_default = std::make_optional(ToString(default_value.value()));
}
WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global);
}
void Config::WriteDoubleSetting(const std::string& key, const double& value, void Config::WriteDoubleSetting(const std::string& key, const double& value,
const std::optional<double>& default_value, const std::optional<double>& default_value,
const std::optional<bool>& use_global) { const std::optional<bool>& use_global) {

View file

@ -157,17 +157,23 @@ protected:
void WriteBooleanSetting(const std::string& key, const bool& value, void WriteBooleanSetting(const std::string& key, const bool& value,
const std::optional<bool>& default_value = std::nullopt, const std::optional<bool>& default_value = std::nullopt,
const std::optional<bool>& use_global = std::nullopt); const std::optional<bool>& use_global = std::nullopt);
template <typename T>
std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting(
const std::string& key, const T& value,
const std::optional<T>& default_value = std::nullopt,
const std::optional<bool>& use_global = std::nullopt);
void WriteDoubleSetting(const std::string& key, const double& value, void WriteDoubleSetting(const std::string& key, const double& value,
const std::optional<double>& default_value = std::nullopt, const std::optional<double>& default_value = std::nullopt,
const std::optional<bool>& use_global = std::nullopt); const std::optional<bool>& use_global = std::nullopt);
void WriteStringSetting(const std::string& key, const std::string& value, void WriteStringSetting(const std::string& key, const std::string& value,
const std::optional<std::string>& default_value = std::nullopt, const std::optional<std::string>& default_value = std::nullopt,
const std::optional<bool>& use_global = std::nullopt); const std::optional<bool>& use_global = std::nullopt);
template <typename T>
std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting(
const std::string& key, const T& value,
const std::optional<T>& default_value = std::nullopt,
const std::optional<bool>& use_global = std::nullopt) {
std::optional<std::string> string_default = std::nullopt;
if (default_value.has_value()) {
string_default = std::make_optional(ToString(default_value.value()));
}
WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global);
}
void ReadCategory(Settings::Category category); void ReadCategory(Settings::Category category);
void WriteCategory(Settings::Category category); void WriteCategory(Settings::Category category);