LeviLamina
Loading...
Searching...
No Matches
Option.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/GameVersion.h"
7#include "mc/deps/core/utility/pub_sub/Publisher.h"
8#include "mc/deps/core/utility/pub_sub/Subscription.h"
9#include "mc/deps/input/InputMode.h"
10#include "mc/events/PrivacyTagEnterprise.h"
11#include "mc/options/option_types/OptionID.h"
12#include "mc/options/option_types/OptionOwnerType.h"
13#include "mc/options/option_types/OptionResetFlags.h"
14#include "mc/options/option_types/OptionType.h"
15
16// auto generated forward declare list
17// clang-format off
18namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
19namespace Json { class Value; }
20// clang-format on
21
22class Option {
23public:
24 // Option inner types declare
25 // clang-format off
26 class Impl;
27 // clang-format on
28
29 // Option inner types define
30 class Impl {
31 public:
32 // member variables
33 // NOLINTBEGIN
34 ::ll::TypedStorage<
35 8,
36 128,
38 mValueChangedPublisher;
39 ::ll::TypedStorage<
40 8,
41 128,
42 ::Bedrock::PubSub::
43 Publisher<void(::Option const&, ::InputMode), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>>
44 mInputModeChangedPublisher;
45 ::ll::TypedStorage<
46 8,
47 128,
49 mValueResetPublisher;
50 ::ll::TypedStorage<
51 8,
52 8,
53 ::std::unique_ptr<
55 mLock;
56 ::ll::TypedStorage<8, 32, ::std::string> mSaveTag;
57 ::ll::TypedStorage<8, 32, ::std::string> mTelemetryProperty;
58#ifdef LL_PLAT_S
59 ::ll::TypedStorage<1, 4, ::Social::Events::PrivacyTagEnterprise> mTelemetryTag;
60 ::ll::TypedStorage<1, 4, ::OptionID const> mID;
61#else // LL_PLAT_C
62 ::ll::TypedStorage<1, 1, ::Social::Events::PrivacyTagEnterprise> mTelemetryTag;
63 ::ll::TypedStorage<4, 4, ::OptionID const> mID;
64#endif
65 ::ll::TypedStorage<4, 4, ::OptionOwnerType const> mOwnerType;
66 ::ll::TypedStorage<4, 4, ::OptionType> mOptionType;
67 ::ll::TypedStorage<8, 32, ::std::string const> mCaptionId;
68 ::ll::TypedStorage<8, 56, ::GameVersion> mDefaultVersion;
69 ::ll::TypedStorage<4, 4, ::OptionResetFlags const> mOptionResetFlags;
70 ::ll::TypedStorage<8, 8, ::Option*> mOverrideSource;
71 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOverrideSourceValueChangedSubscription;
72 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOverrideSourceInputModeChangedSubscription;
73 ::ll::TypedStorage<8, 64, ::std::function<void(bool)>> mRequestSaveCallback;
74 // NOLINTEND
75
76 public:
77 // member functions
78 // NOLINTBEGIN
79#ifdef LL_PLAT_C
80 MCAPI ~Impl();
81#endif
82 // NOLINTEND
83
84 public:
85 // destructor thunk
86 // NOLINTBEGIN
87#ifdef LL_PLAT_C
88 MCAPI void $dtor();
89#endif
90 // NOLINTEND
91 };
92
93 using BoolFilter = ::std::function<bool(bool)>;
94
95 using SaveIntCallback = ::std::function<int(int)>;
96
97 using StringFilter = ::std::function<::std::string(::std::string const&)>;
98
99public:
100 // member variables
101 // NOLINTBEGIN
102 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Option::Impl>> mImpl;
103 // NOLINTEND
104
105#ifdef LL_PLAT_S
106#else // LL_PLAT_C
107public:
108 // prevent constructor by default
109 Option();
110
111#endif
112public:
113 // virtual functions
114 // NOLINTBEGIN
115#ifdef LL_PLAT_S
116 virtual ~Option() = default;
117#else // LL_PLAT_C
118 virtual ~Option();
119#endif
120
121 virtual void save(::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector) = 0;
122
123 virtual void load(::std::string const& valueString) = 0;
124
125 virtual void load(::std::map<::std::string, ::std::string>& propertyMap);
126
127 virtual void load(::Json::Value const& valueJson);
128 // NOLINTEND
129
130public:
131 // member functions
132 // NOLINTBEGIN
133#ifdef LL_PLAT_C
134 MCAPI Option(
135 ::OptionID id,
136 ::OptionOwnerType ownerType,
137 ::OptionResetFlags resetFlags,
138 ::std::string const& captionId,
139 ::std::string const& saveTag,
140 ::OptionType optionType,
141 ::GameVersion version
142 );
143
144 MCAPI void _resetOption(::InputMode inputMode, bool saveOptionChange);
145
146 MCAPI void _updatePropertyVector(
147 ::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector,
148 ::std::string const& value
149 );
150
151 MCAPI bool canModify() const;
152
153 MCAPI bool isDefaultValue(::InputMode inputMode) const;
154
155 MCAPI bool isNewVersion(::GameVersion currentVersion) const;
156
157 MCAPI ::Bedrock::PubSub::Subscription registerLock(::std::function<void(bool&)> isModifiableCondition);
158
159 MCAPI ::Bedrock::PubSub::Subscription
160 registerObserver(::std::function<void(::Option const&)> onValueChangedCallback);
161
162 MCAPI void setCoerceSaveValueCallback(::std::function<int(int)> callback);
163
164 MCAPI void setCoerceValueCallback(::std::function<::std::string(::std::string const&)> f);
165
166 MCAPI void setCoerceValueCallback(::std::function<bool(bool)> f);
167
168 MCAPI void setOverrideSource(::Option* overrideSource);
169
170 MCAPI void toggle();
171#endif
172 // NOLINTEND
173
174public:
175 // static functions
176 // NOLINTBEGIN
177#ifdef LL_PLAT_C
178 MCAPI static bool read(::std::string const& valueString, int& output);
179
180 MCAPI static bool read(::std::string const& valueString, float& output);
181
182 MCAPI static bool read(::std::string const& valueString, bool& output);
183#endif
184 // NOLINTEND
185
186public:
187 // constructor thunks
188 // NOLINTBEGIN
189#ifdef LL_PLAT_C
190 MCAPI void* $ctor(
191 ::OptionID id,
192 ::OptionOwnerType ownerType,
193 ::OptionResetFlags resetFlags,
194 ::std::string const& captionId,
195 ::std::string const& saveTag,
196 ::OptionType optionType,
197 ::GameVersion version
198 );
199#endif
200 // NOLINTEND
201
202public:
203 // destructor thunk
204 // NOLINTBEGIN
205#ifdef LL_PLAT_C
206 MCAPI void $dtor();
207#endif
208 // NOLINTEND
209
210public:
211 // virtual function thunks
212 // NOLINTBEGIN
213 MCAPI void $load(::std::map<::std::string, ::std::string>& propertyMap);
214
215 MCAPI void $load(::Json::Value const& valueJson);
216
217
218 // NOLINTEND
219
220public:
221 // vftables
222 // NOLINTBEGIN
223 MCNAPI static void** $vftable();
224 // NOLINTEND
225};
Definition Publisher.h:25
Definition GameVersion.h:10
Definition Value.h:16
Definition Option.h:30
static MCAPI void ** $vftable()