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
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
39 using ExpectedDisabled = ::std::vector<::FeatureOptionID>;
40
41 using ExpectedEnabled = ::std::vector<::FeatureOptionID>;
42
43 using FeatureTogglesArray = ::std::vector<::FeatureToggles::FeatureToggle>;
44
45 using LockFunction = ::std::function<void(bool&)>;
46
47 using SetupFunction = ::std::function<void(::Option&)>;
48
49public:
50 // member variables
51 // NOLINTBEGIN
52 ::ll::TypedStorage<8, 24, ::std::vector<::FeatureToggles::FeatureToggle>> mFeatures;
53 ::ll::TypedStorage<8, 24, ::std::vector<::Bedrock::PubSub::Subscription>> mOptionLockSubscriptions;
54 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFilePath;
55 ::ll::TypedStorage<1, 1, bool> mIsInGame;
56 // NOLINTEND
57
58public:
59 // prevent constructor by default
60 FeatureToggles();
61
62public:
63 // virtual functions
64 // NOLINTBEGIN
65 virtual ~FeatureToggles() /*override*/;
66 // NOLINTEND
67
68public:
69 // member functions
70 // NOLINTBEGIN
71 MCAPI explicit FeatureToggles(::AppPlatform& appPlatform);
72
73 MCAPI ::std::function<void(bool&)> _getLockIfInGameOrOptionExpectationsNotMetLockCallback(
74 ::std::vector<::FeatureOptionID> expectedDisabledOptions,
75 ::std::vector<::FeatureOptionID> expectedEnabledOptions
76 );
77
78 MCAPI void _initialize(::AppPlatform& appPlatform);
79
80 MCAPI void _registerFeature(
81 ::FeatureOptionTabID tabID,
82 ::FeatureOptionID featureID,
83 ::std::string const& locName,
84 ::std::string const& saveName,
85 bool defaultValue,
86 ::FeatureOptionID dependencyFeatureID,
87 ::std::function<void(::Option&)> setup,
88 ::std::function<void(bool&)> lock
89 );
90
91 MCAPI void _registerFeatures();
92
93 MCAPI bool isEnabled(::FeatureOptionID featureID) const;
94 // NOLINTEND
95
96public:
97 // constructor thunks
98 // NOLINTBEGIN
99 MCAPI void* $ctor(::AppPlatform& appPlatform);
100 // NOLINTEND
101
102public:
103 // destructor thunk
104 // NOLINTBEGIN
105 MCAPI void $dtor();
106 // NOLINTEND
107
108public:
109 // vftables
110 // NOLINTBEGIN
111 MCNAPI static void** $vftable();
112 // NOLINTEND
113};
Definition AppPlatform.h:89
Definition EnableNonOwnerReferences.h:7
Definition Subscription.h:10
static MCAPI void ** $vftable()
Definition Option.h:22
Definition FeatureToggles.h:26