LeviLamina
Loading...
Searching...
No Matches
PackSettingsFactory.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/cereal/ReflectionCtx.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/core/utility/pub_sub/Publisher.h"
9#include "mc/platform/UUID.h"
10#include "mc/platform/brstd/basic_cstring_view.h"
11
12// auto generated forward declare list
13// clang-format off
14class PackManifest;
15class PackSettings;
17namespace Bedrock::PubSub { class Subscription; }
18namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
19namespace Core { class Path; }
20namespace Core { class PathView; }
21namespace SharedTypes::v1_21_100::PackSettingsDefinition { struct Document; }
22// clang-format on
23
24class PackSettingsFactory {
25public:
26 // PackSettingsFactory inner types declare
27 // clang-format off
28 struct Stats;
29 // clang-format on
30
31 // PackSettingsFactory inner types define
32 struct Stats {
33 public:
34 // member variables
35 // NOLINTBEGIN
40 // NOLINTEND
41
42 public:
43 // prevent constructor by default
44 Stats& operator=(Stats const&);
45 Stats(Stats const&);
46 Stats();
47 };
48
49 using PackIdToSettingsMap = ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>;
50
51public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<8, 8, uint64 const> mMaxGlobalPackSettingEntriesPerFile;
55 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mGlobalPackSettingsPath;
56 ::ll::TypedStorage<4, 16, ::PackSettingsFactory::Stats> mStats;
57 ::ll::TypedStorage<8, 128, ::cereal::ReflectionCtx> mReflectionCtx;
58 ::ll::TypedStorage<
59 8,
60 256,
63 nullptr_t,
64 nullptr_t,
66 mLoader;
67 ::ll::TypedStorage<
68 8,
69 16,
70 ::std::shared_ptr<::Bedrock::PubSub::Publisher<
71 void(::mce::UUID const&, ::std::string const&, ::std::variant<float, bool, ::std::string> const&),
73 0>>>
74 mOnChangePublisher;
75 ::ll::TypedStorage<
76 8,
77 8,
78 ::std::unique_ptr<::std::unordered_map<
80 ::std::unique_ptr<::PackSettings, ::std::default_delete<::PackSettings>>>>>
81 mGlobalPackSettings;
82 ::ll::TypedStorage<
83 8,
84 64,
85 ::std::unordered_map<::std::string, ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>>>
86 mWorldPackSettings;
87 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>>
88 mGlobalUserOverrides;
89 ::ll::TypedStorage<
90 8,
91 64,
92 ::std::
93 unordered_map<::std::string, ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>>>
94 mPerWorldUserOverrides;
95 // NOLINTEND
96
97public:
98 // prevent constructor by default
99 PackSettingsFactory();
100
101public:
102 // virtual functions
103 // NOLINTBEGIN
104 virtual ~PackSettingsFactory();
105
106 virtual uint64 getAccessTimestamp() const;
107 // NOLINTEND
108
109public:
110 // member functions
111 // NOLINTBEGIN
112 MCAPI
113 PackSettingsFactory(uint64 maxGlobalPackSettingEntriesPerFile, ::std::optional<::Core::PathView> globalPathRoot);
114
115 MCAPI ::PackSettings* _getGlobalPackSettings(::PackManifest const& manifest);
116
117 MCAPI ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>&
118 _getWorldIdToPackSettingsMap(::std::string const& worldId);
119
120 MCAPI ::PackSettings* _getWorldPackSettings(::PackManifest const& manifest, ::std::optional<::std::string> worldId);
121
122 MCAPI ::std::map<::std::string, ::std::variant<float, bool, ::std::string>>*
123 _getWorldUserOverrides(::std::string const& worldId, ::mce::UUID packId);
124
125 MCAPI ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>
126 _loadUserOverridesFromFile(::Core::Path const& path) const;
127
128#ifdef LL_PLAT_C
129 MCAPI bool _saveUserOverridesToFile(
131 ::Core::Path const& path
132 ) const;
133
134 MCAPI void _syncPackSettingsToSaveDoc(
135 ::mce::UUID packId,
136 ::PackSettings const& packSettings,
138 bool includeTimestamp
139 ) const;
140#endif
141
142 MCAPI ::PackSettings* getPackSettings(::PackManifest const& manifest, ::std::optional<::std::string> worldId);
143
144 MCAPI bool loadGlobalUserOverrides();
145
146 MCAPI bool loadPerWorldUserOverrides(::std::string const& worldId, ::Core::Path const& worldPath);
147
148#ifdef LL_PLAT_C
149 MCAPI ::Bedrock::PubSub::Subscription registerObserver(
150 ::std::function<
151 void(::mce::UUID const&, ::std::string const&, ::std::variant<float, bool, ::std::string> const&)> callback
152 );
153
154 MCAPI bool saveGlobalUserOverrides();
155
156 MCAPI bool savePerWorldUserOverrides(::std::string const& worldId, ::Core::Path const& worldPath);
157
158 MCAPI ::std::string serializePackSettingsNameValueMap(
159 ::std::unordered_map<::std::string, ::PackSettingValueAndDefault> const& packSettingsNameValueMap
160 ) const;
161#endif
162 // NOLINTEND
163
164public:
165 // static variables
166 // NOLINTBEGIN
167 MCAPI static ::brstd::basic_cstring_view<char, ::std::char_traits<char>> const&
168 GLOBAL_RESOURCE_PACK_SETTINGS_FILENAME();
169
170 MCAPI static ::brstd::basic_cstring_view<char, ::std::char_traits<char>> const&
171 WORLD_BEHAVIOR_PACK_SETTINGS_FILENAME();
172 // NOLINTEND
173
174public:
175 // constructor thunks
176 // NOLINTBEGIN
177 MCAPI void* $ctor(uint64 maxGlobalPackSettingEntriesPerFile, ::std::optional<::Core::PathView> globalPathRoot);
178 // NOLINTEND
179
180public:
181 // destructor thunk
182 // NOLINTBEGIN
183 MCAPI void $dtor();
184 // NOLINTEND
185
186public:
187 // virtual function thunks
188 // NOLINTBEGIN
189 MCAPI uint64 $getAccessTimestamp() const;
190
191
192 // NOLINTEND
193
194public:
195 // vftables
196 // NOLINTBEGIN
197 MCNAPI static void** $vftable();
198 // NOLINTEND
199};
Definition Publisher.h:8
Definition Subscription.h:10
Definition PathView.h:19
Definition Path.h:12
Definition PackManifest.h:38
static MCAPI void ** $vftable()
Definition PackSettings.h:19
Definition _HeaderOutputPredefine.h:364
Definition UUID.h:7
Definition PackSettingValueAndDefault.h:5
Definition PackSettingsFactory.h:32
Definition Alias.h:14