From 5222a2fd1ba372f6eb67dc8fa71e334f1ff10bbb Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 8 Jan 2024 17:26:41 +0800 Subject: fix: solve compile issue --- src/core/function/GlobalSettingStation.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/core/function/GlobalSettingStation.h') diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index 5582562a..06f37264 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -168,6 +168,26 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation return value; } + /** + * @brief Looks up a setting by path. + * @param path The path to the setting. + * @param default_value The default value to return if setting is not found. + * @return The setting value. + */ + template + auto SaveSettings(std::string path, libconfig::Setting::Type type, + T value) noexcept -> T { + try { + if (!GetMainSettings().exists(path)) { + // TODO + GetMainSettings().add(path, type); + } + } catch (...) { + GF_CORE_LOG_WARN("setting not found: {}", path); + } + return value; + } + private: class Impl; SecureUniquePtr p_; -- cgit v1.2.3