8 using sec_t = std::vector<std::string>;
9 using key_t = std::string_view;
14 void SettingLoad(
void* a_file, sec_t a_section, key_t a_key, T& a_value, T& a_valueDefault);
17 void SettingSave(
void* a_file, sec_t a_section, key_t a_key, T& a_value);
21 public TSettingStore<SettingStore>
24 virtual void Load()
override;
25 virtual void Save()
override;
28 template <
class T,
class Store = SettingStore>
30 public TSetting<T, Store>
33 Setting(key_t a_key, T a_default) :
34 TSetting<T, Store>(a_default),
39 Setting(std::string_view a_section, key_t a_key, T a_default) :
40 TSetting<T, Store>(a_default),
44 for (
const auto token : std::ranges::split_view{ a_section, std::string_view{
"." } }) {
45 m_section.emplace_back(token.data(), token.size());
49 Setting(std::initializer_list<std::string> a_section, key_t a_key, T a_default) :
50 TSetting<T, Store>(a_default),
56 virtual void Load(
void* a_data,
bool a_isBase)
override
59 Impl::SettingLoad(a_data, m_section, m_key, this->m_valueDefault, this->m_valueDefault);
60 this->SetValue(this->m_valueDefault);
62 Impl::SettingLoad(a_data, m_section, m_key, this->m_value, this->m_valueDefault);
66 virtual void Save(
void* a_data)
override
68 Impl::SettingSave(a_data, m_section, m_key, this->m_value);
76 template <
class Store = SettingStore>
77 using Bool = Setting<bool, Store>;
79 template <
class Store = SettingStore>
80 using F32 = Setting<float, Store>;
82 template <
class Store = SettingStore>
83 using F64 = Setting<double, Store>;
85 template <
class Store = SettingStore>
86 using I8 = Setting<std::int8_t, Store>;
88 template <
class Store = SettingStore>
89 using I16 = Setting<std::int16_t, Store>;
91 template <
class Store = SettingStore>
92 using I32 = Setting<std::int32_t, Store>;
94 template <
class Store = SettingStore>
95 using U8 = Setting<std::uint8_t, Store>;
97 template <
class Store = SettingStore>
98 using U16 = Setting<std::uint16_t, Store>;
100 template <
class Store = SettingStore>
101 using U32 = Setting<std::uint32_t, Store>;
103 template <
class Store = SettingStore>
104 using Str = Setting<std::string, Store>;
107 template <
class T,
class S,
class CharT>
108 struct std::formatter<
REX::TOML::Setting<T, S>, CharT> : std::formatter<T, CharT>
110 template <
class FormatContext>
111 auto format(
const REX::TOML::Setting<T, S>& a_setting, FormatContext& a_ctx)
const
113 return std::formatter<T, CharT>::format(a_setting.GetValue(), a_ctx);
Definition: BSDirectInputManager.h:8
constexpr REL::ID Save(static_cast< std::uint64_t >(34818))
constexpr REL::ID Load(static_cast< std::uint64_t >(34819))