LeviLamina
Loading...
Searching...
No Matches
FeatureToggles.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
8#include "mc/options/FeatureOptionID.h"
9#include "mc/options/FeatureOptionTabID.h"
10
11// auto generated forward declare list
12// clang-format off
13class AppPlatform;
14class Option;
15namespace Bedrock::PubSub { class Subscription; }
16// clang-format on
17
18class FeatureToggles : public ::Bedrock::EnableNonOwnerReferences {
19public:
20 // FeatureToggles inner types declare
21 // clang-format off
22 struct FeatureToggle;
23 // clang-format on
24
25 // FeatureToggles inner types define
26 struct FeatureToggle {
27 public:
28 // member variables
29 // NOLINTBEGIN
30 ::ll::TypedStorage<4, 4, ::FeatureOptionID> featureID;
31 ::ll::TypedStorage<4, 4, ::FeatureOptionID> dependencyFeatureID;
32 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Option>> option;
33 ::ll::TypedStorage<8, 64, ::std::function<void(::Option&)>> setup;
34 ::ll::TypedStorage<8, 64, ::std::function<void(bool&)>> lock;
35 ::ll::TypedStorage<4, 4, ::FeatureOptionTabID> tabID;
36 // NOLINTEND
37
38 public:
39 // prevent constructor by default
40 FeatureToggle& operator=(FeatureToggle const&);
41 FeatureToggle(FeatureToggle const&);
42 FeatureToggle();
43
44 public:
45 // member functions
46 // NOLINTBEGIN
47 MCAPI ::FeatureToggles::FeatureToggle& operator=(::FeatureToggles::FeatureToggle&&);
48
49 MCAPI ~FeatureToggle();
50 // NOLINTEND
51
52 public:
53 // destructor thunk
54 // NOLINTBEGIN
55 MCAPI void $dtor();
56 // NOLINTEND
57 };
58
59 using ExpectedDisabled = ::std::vector<::FeatureOptionID>;
60
61 using ExpectedEnabled = ::std::vector<::FeatureOptionID>;
62
63 using FeatureTogglesArray = ::std::vector<::FeatureToggles::FeatureToggle>;
64
65 using LockFunction = ::std::function<void(bool&)>;
66
67 using SetupFunction = ::std::function<void(::Option&)>;
68
69public:
70 // member variables
71 // NOLINTBEGIN
72 ::ll::TypedStorage<8, 24, ::std::vector<::FeatureToggles::FeatureToggle>> mFeatures;
73 ::ll::TypedStorage<8, 24, ::std::vector<::Bedrock::PubSub::Subscription>> mOptionLockSubscriptions;
74 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFilePath;
75 ::ll::TypedStorage<1, 1, bool> mIsInGame;
76 // NOLINTEND
77
78public:
79 // prevent constructor by default
80 FeatureToggles();
81
82public:
83 // virtual functions
84 // NOLINTBEGIN
85 virtual ~FeatureToggles() /*override*/;
86 // NOLINTEND
87
88public:
89 // member functions
90 // NOLINTBEGIN
91 MCAPI explicit FeatureToggles(::AppPlatform& appPlatform);
92
93 MCAPI ::std::function<void(::Option&)> _getDisabledIfOptionExpectationsNotMetSetupCallback(
94 ::std::vector<::FeatureOptionID> expectedDisabledOptions,
95 ::std::vector<::FeatureOptionID> expectedEnabledOptions
96 );
97
98 MCAPI ::std::function<void(bool&)> _getLockIfInGameOrOptionExpectationsNotMetLockCallback(
99 ::std::vector<::FeatureOptionID> expectedDisabledOptions,
100 ::std::vector<::FeatureOptionID> expectedEnabledOptions
101 );
102
103 MCAPI void _initialize(::AppPlatform& appPlatform);
104
105 MCAPI void _registerFeature(
106 ::FeatureOptionTabID tabID,
107 ::FeatureOptionID featureID,
108 ::std::string const& locName,
109 ::std::string const& saveName,
110 bool defaultValue,
111 ::FeatureOptionID dependencyFeatureID,
112 ::std::function<void(::Option&)> setup,
113 ::std::function<void(bool&)> lock
114 );
115
116 MCAPI void _registerFeatures();
117
118 MCAPI void _setupDependencies();
119
120 MCAPI ::Option* get(::FeatureOptionID featureID);
121
122#ifdef LL_PLAT_C
123 MCAPI ::FeatureOptionID getFeatureIDFromSaveTag(::std::string_view featureSaveTag) const;
124#endif
125
126 MCAPI bool isEnabled(::FeatureOptionID featureID) const;
127
128#ifdef LL_PLAT_C
129 MCFOLD bool isGraniteBayFeatureEnabled() const;
130#endif
131 // NOLINTEND
132
133public:
134 // static variables
135 // NOLINTBEGIN
136 MCAPI static ::std::unique_ptr<::FeatureToggles>& mFeatureToggles();
137 // NOLINTEND
138
139public:
140 // constructor thunks
141 // NOLINTBEGIN
142 MCAPI void* $ctor(::AppPlatform& appPlatform);
143 // NOLINTEND
144
145public:
146 // destructor thunk
147 // NOLINTBEGIN
148 MCAPI void $dtor();
149 // NOLINTEND
150
151public:
152 // vftables
153 // NOLINTBEGIN
154 MCNAPI static void** $vftable();
155 // NOLINTEND
156};
Definition AppPlatform.h:91
Definition EnableNonOwnerReferences.h:7
Definition Subscription.h:10
static MCAPI void ** $vftable()
Definition Option.h:22
Definition FeatureToggles.h:26