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 ::ll::TypedStorage<1, 1, ::Social::Events::PrivacyTagEnterprise> mTelemetryTag;
59 ::ll::TypedStorage<4, 4, ::OptionID const> mID;
60 ::ll::TypedStorage<4, 4, ::OptionOwnerType const> mOwnerType;
61 ::ll::TypedStorage<4, 4, ::OptionType> mOptionType;
62 ::ll::TypedStorage<8, 32, ::std::string const> mCaptionId;
63 ::ll::TypedStorage<8, 56, ::GameVersion> mDefaultVersion;
64 ::ll::TypedStorage<4, 4, ::OptionResetFlags const> mOptionResetFlags;
65 ::ll::TypedStorage<8, 8, ::Option*> mOverrideSource;
66 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOverrideSourceValueChangedSubscription;
67 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOverrideSourceInputModeChangedSubscription;
68 ::ll::TypedStorage<8, 64, ::std::function<void(bool)>> mRequestSaveCallback;
69 // NOLINTEND
70
71 public:
72 // prevent constructor by default
73 Impl();
74
75 public:
76 // member functions
77 // NOLINTBEGIN
78 MCAPI Impl(
79 ::OptionID id,
80 ::OptionOwnerType ownerType,
81 ::OptionResetFlags resetFlags,
82 ::std::string const& captionId,
83 ::std::string const& saveTag,
84 ::OptionType optionType,
85 ::GameVersion version
86 );
87
88 MCAPI ~Impl();
89 // NOLINTEND
90
91 public:
92 // constructor thunks
93 // NOLINTBEGIN
94 MCAPI void* $ctor(
95 ::OptionID id,
96 ::OptionOwnerType ownerType,
97 ::OptionResetFlags resetFlags,
98 ::std::string const& captionId,
99 ::std::string const& saveTag,
100 ::OptionType optionType,
101 ::GameVersion version
102 );
103 // NOLINTEND
104
105 public:
106 // destructor thunk
107 // NOLINTBEGIN
108 MCAPI void $dtor();
109 // NOLINTEND
110 };
111
112 using BoolFilter = ::std::function<bool(bool)>;
113
114 using SaveIntCallback = ::std::function<int(int)>;
115
116 using StringFilter = ::std::function<::std::string(::std::string const&)>;
117
118public:
119 // member variables
120 // NOLINTBEGIN
121 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Option::Impl>> mImpl;
122 // NOLINTEND
123
124public:
125 // prevent constructor by default
126 Option();
127
128public:
129 // virtual functions
130 // NOLINTBEGIN
131#ifdef LL_PLAT_S
132 virtual ~Option() = default;
133#else // LL_PLAT_C
134 virtual ~Option();
135#endif
136
137 virtual void save(::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector) = 0;
138
139 virtual void load(::std::string const& valueString) = 0;
140
141 virtual void load(::std::map<::std::string, ::std::string>& propertyMap);
142
143 virtual void load(::Json::Value const& valueJson);
144 // NOLINTEND
145
146public:
147 // member functions
148 // NOLINTBEGIN
149 MCAPI Option(
150 ::OptionID id,
151 ::OptionOwnerType ownerType,
152 ::OptionResetFlags resetFlags,
153 ::std::string const& captionId,
154 ::std::string const& saveTag,
155 ::OptionType optionType,
156 ::GameVersion version
157 );
158
159#ifdef LL_PLAT_C
160 MCAPI void _resetOption(::InputMode inputMode, bool saveOptionChange);
161#endif
162
163 MCAPI void _updatePropertyVector(
164 ::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector,
165 ::std::string const& value
166 );
167
168#ifdef LL_PLAT_C
169 MCAPI bool canModify() const;
170
171 MCAPI void clearSaveTag();
172#endif
173
174 MCAPI bool getBool() const;
175
176#ifdef LL_PLAT_C
177 MCAPI bool getBool(::InputMode inputMode) const;
178
179 MCAPI ::std::string const& getCaptionId() const;
180
181 MCAPI float getFloat() const;
182
183 MCAPI float getFloat(::InputMode inputMode) const;
184
185 MCAPI float getFloatMax() const;
186
187 MCAPI float getFloatMin() const;
188
189 MCAPI ::OptionID getID() const;
190
191 MCAPI int getInt() const;
192
193 MCAPI int64 getInt64() const;
194
195 MCAPI int getIntMax() const;
196
197 MCAPI int getIntMin() const;
198
199 MCAPI ::OptionOwnerType getOptionOwnerType() const;
200
201 MCAPI ::OptionResetFlags getOptionResetFlags() const;
202
203 MCAPI ::std::string const& getSaveTag() const;
204
205 MCAPI ::std::string const& getString() const;
206
207 MCAPI ::std::vector<::std::string> getStringList() const;
208
209 MCAPI ::std::string const& getTelemetryProperty() const;
210
211 MCAPI ::Social::Events::PrivacyTagEnterprise getTelemetryTag() const;
212
213 MCAPI ::OptionType getType() const;
214
215 MCAPI ::std::unordered_map<int, ::std::string> const& getValueNameMap() const;
216
217 MCAPI ::std::vector<int> const& getValues() const;
218
219 MCAPI bool hasOverrideSource() const;
220
221 MCAPI bool isDefaultValue() const;
222
223 MCAPI bool isDefaultValue(::InputMode inputMode) const;
224
225 MCAPI bool isNewVersion(::GameVersion currentVersion) const;
226
227 MCAPI bool isType(::OptionType type) const;
228
229 MCAPI void notifyOptionValueChanged(bool saveOptionChange);
230
231 MCAPI void notifyOptionValueChanged(::InputMode inputMode, bool saveOptionChange);
232#endif
233
234 MCAPI ::Bedrock::PubSub::Subscription registerLock(::std::function<void(bool&)> isModifiableCondition);
235
236#ifdef LL_PLAT_C
237 MCAPI ::Bedrock::PubSub::Subscription
238 registerObserver(::std::function<void(::Option const&, ::InputMode)> onInputModeChangedCallback);
239#endif
240
241 MCAPI ::Bedrock::PubSub::Subscription
242 registerObserver(::std::function<void(::Option const&)> onValueChangedCallback);
243
244#ifdef LL_PLAT_C
245 MCAPI ::Bedrock::PubSub::Subscription
246 registerResetObserver(::std::function<void(::Option const&)> onValueResetCallback);
247
248 MCAPI ::Option&
249 registerTelemetryProperty(::std::string const& propertyName, ::Social::Events::PrivacyTagEnterprise propertyTag);
250
251 MCAPI void reset();
252
253 MCAPI void reset(::InputMode inputMode);
254
255 MCAPI void resetForced(bool saveOptionChange);
256
257 MCAPI void set(int value);
258
259 MCAPI void set(::InputMode inputmode, float value);
260
261 MCAPI void set(::InputMode inputmode, bool value);
262
263 MCAPI void setCoerceSaveValueCallback(::std::function<int(int)> callback);
264
265 MCAPI void setCoerceValueCallback(::std::function<::std::string(::std::string const&)> f);
266
267 MCAPI void setCoerceValueCallback(::std::function<bool(bool)> f);
268
269 MCAPI void setOverrideSource(::Option* overrideSource);
270
271 MCAPI void setRequestSaveCallback(::std::function<void(bool)> callback);
272
273 MCAPI void toggle();
274#endif
275 // NOLINTEND
276
277public:
278 // static functions
279 // NOLINTBEGIN
280#ifdef LL_PLAT_C
281 MCAPI static bool read(::std::string const& valueString, int& output);
282
283 MCAPI static bool read(::std::string const& valueString, float& output);
284
285 MCAPI static bool read(::std::string const& valueString, ::std::vector<::std::string>& output);
286#endif
287
288 MCAPI static bool read(::std::string const& valueString, bool& output);
289 // NOLINTEND
290
291public:
292 // constructor thunks
293 // NOLINTBEGIN
294 MCAPI void* $ctor(
295 ::OptionID id,
296 ::OptionOwnerType ownerType,
297 ::OptionResetFlags resetFlags,
298 ::std::string const& captionId,
299 ::std::string const& saveTag,
300 ::OptionType optionType,
301 ::GameVersion version
302 );
303 // NOLINTEND
304
305public:
306 // destructor thunk
307 // NOLINTBEGIN
308 MCAPI void $dtor();
309 // NOLINTEND
310
311public:
312 // virtual function thunks
313 // NOLINTBEGIN
314 MCAPI void $load(::std::map<::std::string, ::std::string>& propertyMap);
315
316 MCAPI void $load(::Json::Value const& valueJson);
317
318
319 // NOLINTEND
320
321public:
322 // vftables
323 // NOLINTBEGIN
324 MCNAPI static void** $vftable();
325 // NOLINTEND
326};
Definition Publisher.h:8
Definition GameVersion.h:10
Definition Value.h:16
Definition Option.h:30
static MCAPI void ** $vftable()