Skip to content
LeviMC
English
AutoLightDark
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 MCNAPI ~Impl();
81#endif
82 // NOLINTEND
83
84 public:
85 // destructor thunk
86 // NOLINTBEGIN
87#ifdef LL_PLAT_C
88 MCNAPI 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
105public:
106 // prevent constructor by default
107 Option();
108
109public:
110 // virtual functions
111 // NOLINTBEGIN
112#ifdef LL_PLAT_S
113 virtual ~Option() = default;
114#else // LL_PLAT_C
115 virtual ~Option();
116#endif
117
118 virtual void save(::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector) = 0;
119
120 virtual void load(::std::string const& valueString) = 0;
121
122 virtual void load(::std::map<::std::string, ::std::string>& propertyMap);
123
124 virtual void load(::Json::Value const& valueJson);
125 // NOLINTEND
126
127public:
128 // member functions
129 // NOLINTBEGIN
130 MCNAPI Option(
131 ::OptionID id,
132 ::OptionOwnerType ownerType,
133 ::OptionResetFlags resetFlags,
134 ::std::string const& captionId,
135 ::std::string const& saveTag,
136 ::OptionType optionType,
137 ::GameVersion version
138 );
139
140#ifdef LL_PLAT_C
141 MCNAPI void _resetOption(::InputMode inputMode, bool saveOptionChange);
142#endif
143
145 ::std::vector<::std::pair<::std::string, ::std::string>>& propertyVector,
146 ::std::string const& value
147 );
148
149#ifdef LL_PLAT_C
150 MCNAPI bool canModify() const;
151
152 MCNAPI bool isDefaultValue(::InputMode inputMode) const;
153
154 MCNAPI bool isNewVersion(::GameVersion currentVersion) const;
155#endif
156
157 MCNAPI ::Bedrock::PubSub::Subscription registerLock(::std::function<void(bool&)> isModifiableCondition);
158
159#ifdef LL_PLAT_C
160 MCNAPI void setCoerceSaveValueCallback(::std::function<int(int)> callback);
161
162 MCNAPI void setCoerceValueCallback(::std::function<::std::string(::std::string const&)> f);
163
164 MCNAPI void setCoerceValueCallback(::std::function<bool(bool)> f);
165
166 MCNAPI void setOverrideSource(::Option* overrideSource);
167
168 MCNAPI void toggle();
169#endif
170 // NOLINTEND
171
172public:
173 // static functions
174 // NOLINTBEGIN
175#ifdef LL_PLAT_C
176 MCNAPI static bool read(::std::string const& valueString, int& output);
177
178 MCNAPI static bool read(::std::string const& valueString, float& output);
179#endif
180
181 MCNAPI static bool read(::std::string const& valueString, bool& output);
182 // NOLINTEND
183
184public:
185 // constructor thunks
186 // NOLINTBEGIN
187 MCNAPI void* $ctor(
188 ::OptionID id,
189 ::OptionOwnerType ownerType,
190 ::OptionResetFlags resetFlags,
191 ::std::string const& captionId,
192 ::std::string const& saveTag,
193 ::OptionType optionType,
194 ::GameVersion version
195 );
196 // NOLINTEND
197
198public:
199 // destructor thunk
200 // NOLINTBEGIN
201#ifdef LL_PLAT_C
202 MCNAPI void $dtor();
203#endif
204 // NOLINTEND
205
206public:
207 // virtual function thunks
208 // NOLINTBEGIN
209 MCNAPI void $load(::std::map<::std::string, ::std::string>& propertyMap);
210
211 MCNAPI void $load(::Json::Value const& valueJson);
212
213
214 // NOLINTEND
215
216public:
217 // vftables
218 // NOLINTBEGIN
219 MCNAPI static void** $vftable();
220 // NOLINTEND
221};
Definition Publisher.h:25
Definition GameVersion.h:10
Definition Value.h:16
Definition Option.h:30
static MCAPI void ** $vftable()
MCAPI::Bedrock::PubSub::Subscription registerLock(::std::function< void(bool &)> isModifiableCondition)
static MCAPI bool read(::std::string const &valueString, bool &output)
MCAPI void $load(::std::map<::std::string, ::std::string > &propertyMap)
MCAPI void _updatePropertyVector(::std::vector<::std::pair<::std::string, ::std::string > > &propertyVector, ::std::string const &value)
MCAPI void * $ctor(::OptionID id, ::OptionOwnerType ownerType, ::OptionResetFlags resetFlags, ::std::string const &captionId, ::std::string const &saveTag, ::OptionType optionType, ::GameVersion version)
MCAPI Option(::OptionID id, ::OptionOwnerType ownerType, ::OptionResetFlags resetFlags, ::std::string const &captionId, ::std::string const &saveTag, ::OptionType optionType, ::GameVersion version)
MCAPI void $load(::Json::Value const &valueJson)