CommonLibSSE (powerof3)
Setting.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
REX/REX/Singleton.h
"
4
5
namespace
REX
6
{
7
class
ISetting
8
{
9
public
:
10
virtual
void
Load
(
void
* a_data,
bool
a_isBase) = 0;
11
virtual
void
Save
(
void
* a_data) = 0;
12
};
13
14
class
ISettingStore
15
{
16
public
:
17
virtual
void
Init
(
const
char
* a_file,
const
char
* a_fileCustom) = 0;
18
virtual
void
Load
() = 0;
19
virtual
void
Save
() = 0;
20
virtual
void
Register
(
ISetting
* a_setting) = 0;
21
};
22
23
template
<
class
T,
class
Store>
24
class
TSetting
:
25
public
ISetting
26
{
27
public
:
28
TSetting
() =
delete
;
29
30
TSetting
(T a_default) :
31
m_value
(a_default),
32
m_valueDefault
(a_default)
33
{
34
Store::GetSingleton
()->Register(
this
);
35
}
36
37
public
:
38
T
GetValue
()
const
{
return
m_value
; }
39
40
T
GetValueDefault
()
const
{
return
m_valueDefault
; }
41
42
void
SetValue
(T a_value) {
m_value
= a_value; }
43
44
protected
:
45
T
m_value
;
46
T
m_valueDefault
;
47
};
48
49
template
<
class
T>
50
class
TSettingStore
:
51
public
ISettingStore
,
52
public
Singleton
<T>
53
{
54
public
:
55
virtual
void
Init
(
const
char
* a_fileBase,
const
char
* a_fileUser)
override
56
{
57
m_fileBase
= a_fileBase;
58
m_fileUser
= a_fileUser;
59
}
60
61
virtual
void
Register
(
ISetting
* a_setting)
override
62
{
63
m_settings
.emplace_back(a_setting);
64
}
65
66
protected
:
67
std::string_view
m_fileBase
;
68
std::string_view
m_fileUser
;
69
std::vector<ISetting*>
m_settings
;
70
};
71
}
Singleton.h
REX::ISettingStore
Definition:
Setting.h:15
REX::ISettingStore::Register
virtual void Register(ISetting *a_setting)=0
REX::ISettingStore::Save
virtual void Save()=0
REX::ISettingStore::Init
virtual void Init(const char *a_file, const char *a_fileCustom)=0
REX::ISettingStore::Load
virtual void Load()=0
REX::ISetting
Definition:
Setting.h:8
REX::ISetting::Load
virtual void Load(void *a_data, bool a_isBase)=0
REX::ISetting::Save
virtual void Save(void *a_data)=0
REX::Singleton
Definition:
Singleton.h:7
REX::TSettingStore
Definition:
Setting.h:53
REX::TSettingStore::m_settings
std::vector< ISetting * > m_settings
Definition:
Setting.h:69
REX::TSettingStore::Register
virtual void Register(ISetting *a_setting) override
Definition:
Setting.h:61
REX::TSettingStore::m_fileUser
std::string_view m_fileUser
Definition:
Setting.h:68
REX::TSettingStore::Init
virtual void Init(const char *a_fileBase, const char *a_fileUser) override
Definition:
Setting.h:55
REX::TSettingStore::m_fileBase
std::string_view m_fileBase
Definition:
Setting.h:67
REX::TSetting
Definition:
Setting.h:26
REX::TSetting::TSetting
TSetting(T a_default)
Definition:
Setting.h:30
REX::TSetting::GetValue
T GetValue() const
Definition:
Setting.h:38
REX::TSetting::GetValueDefault
T GetValueDefault() const
Definition:
Setting.h:40
REX::TSetting::SetValue
void SetValue(T a_value)
Definition:
Setting.h:42
REX::TSetting::m_valueDefault
T m_valueDefault
Definition:
Setting.h:46
REX::TSetting::m_value
T m_value
Definition:
Setting.h:45
REX::TSetting::TSetting
TSetting()=delete
REX
Definition:
BSDirectInputManager.h:8
RE::Offset::BGSStoryEventManager::GetSingleton
constexpr REL::ID GetSingleton(static_cast< std::uint64_t >(22317))
CommonLibSSE
include
REX
REX
Setting.h
Generated by
1.9.1