CommonLibSSE (Parapets fork)
INISettingCollection.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/S/Setting.h"
5 
6 namespace RE
7 {
9  {
10  public:
11  inline static constexpr auto RTTI = RTTI_INISettingCollection;
12 
13  ~INISettingCollection() override; // 00
14 
15  // override (SettingCollectionList<Setting>)
16  bool WriteSetting(Setting* a_setting) override; // 03
17  bool ReadSetting(Setting* a_setting) override; // 04
18  bool OpenHandle(bool a_create) override; // 05 - { handle = this; return true; }
19  bool CloseHandle() override; // 06 - { handle = 0; return true; }
20 
22 
23  Setting* GetSetting(const char* a_name);
24  };
25  static_assert(sizeof(INISettingCollection) == 0x128);
26 
27  namespace literals
28  {
29  template <stl::nttp::zstring S>
30  inline auto operator""_ini()
31  {
32  static RE::Setting* setting = nullptr;
33  if (!setting) {
34  if (auto collection = INISettingCollection::GetSingleton()) {
35  setting = collection->GetSetting(S.data());
36  }
37  }
38 
39  if constexpr (S.front() == 'b') {
40  return setting ? std::optional(setting->data.b) : std::nullopt;
41  } else if constexpr (S.front() == 'f') {
42  return setting ? std::optional(setting->data.f) : std::nullopt;
43  } else if constexpr (S.front() == 'i') {
44  return setting ? std::optional(setting->data.i) : std::nullopt;
45  } else if constexpr (S.front() == 'r') {
46  return setting ? std::optional(setting->data.r) : std::nullopt;
47  } else if constexpr (S.front() == 's') {
48  return setting ? std::optional(setting->data.s) : std::nullopt;
49  } else if constexpr (S.front() == 'u') {
50  return setting ? std::optional(setting->data.u) : std::nullopt;
51  }
52  }
53  }
54 }
Definition: INISettingCollection.h:9
~INISettingCollection() override
static INISettingCollection * GetSingleton()
bool ReadSetting(Setting *a_setting) override
bool WriteSetting(Setting *a_setting) override
bool OpenHandle(bool a_create) override
Setting * GetSetting(const char *a_name)
bool CloseHandle() override
static constexpr auto RTTI
Definition: INISettingCollection.h:11
Definition: SettingCollectionList.h:10
Definition: Setting.h:8
Data data
Definition: Setting.h:51
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_INISettingCollection
Definition: Offsets_RTTI.h:5003
std::uint32_t u
Definition: Setting.h:30
float f
Definition: Setting.h:26
std::int32_t i
Definition: Setting.h:27
char * s
Definition: Setting.h:29
Color r
Definition: Setting.h:28
bool b
Definition: Setting.h:25