LeviLamina
Loading...
Searching...
No Matches
ContentManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/screens/models/ContentFlags.h"
7#include "mc/client/gui/screens/models/ContentManagerContextCollection.h"
8#include "mc/client/gui/screens/models/ContentType.h"
9#include "mc/client/gui/screens/models/IContentManager.h"
10#include "mc/deps/core/file/PathBuffer.h"
11#include "mc/deps/core/resource/PackType.h"
12#include "mc/deps/core/threading/Async.h"
13#include "mc/deps/core/utility/NonOwnerPointer.h"
14#include "mc/deps/core/utility/pub_sub/Publisher.h"
15#include "mc/world/level/LevelListCacheObserver.h"
16
17// auto generated forward declare list
18// clang-format off
22class ContentIdentity;
29class IEntitlementManager;
30class ILevelListCache;
36class Pack;
38class PackSource;
40class StoreCatalogRepository;
41class TaskGroup;
43struct ContentItem;
44struct ContentSource;
47namespace Bedrock::PubSub { class Subscription; }
48namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
49namespace ContentManagerUtils { class SourcesAsyncReloader; }
50namespace Core { class FilePathManager; }
51namespace Realms { class RealmsServicePackSource; }
52namespace Realms { struct Content; }
53namespace Realms { struct RealmId; }
54namespace StorageManager { class ContentItemProvider; }
55namespace StorageManager { class IContentHandler; }
56namespace mce { class UUID; }
57// clang-format on
58
61 public ::std::enable_shared_from_this<::ContentManager> {
62public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ContentManager>> mSelf;
66 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager>> mWorldTemplateManager;
67 ::ll::TypedStorage<8, 8, ::IPackManifestFactory&> mPackManifestFactory;
68 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::MutableContentItemCollection>>> mContent;
69 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ContentSource>>> mContentSources;
70 ::ll::TypedStorage<8, 24, ::ContentManagerContextCollection> mContexts;
71 ::ll::TypedStorage<8, 8, uint64> mContentId;
72 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IContentCatalogPackSource>> mCatalogResourcePackSource;
73 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::Realms::RealmsServicePackSource>>>
74 mRealmsServicePackSources;
75 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::CachedHostPackIdProvider>> mCachedHostPackIdProvider;
76 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContentManagerProxy>> mProxy;
77 ::ll::TypedStorage<1, 1, bool> mInitialized;
78 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_RESOURCE_PACK_FILENAME;
79 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_BEHAVIOR_PACK_FILENAME;
80 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
81 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mMutex;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IContentManagerFactory>> mFactory;
83 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::ContentManagerUtils::SourcesAsyncReloader>>>
84 mReloadSourcesAsync;
85 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager>> mEntitlementManager;
86 ::ll::TypedStorage<8, 48, ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::SingleThreaded, 0>>
87 mReloadViewsPublisher;
88 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::StorageManager::ContentItemProvider>> mWeakStorageContentItemProvider;
89 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::StorageManager::IContentHandler>>>
90 mStorageContentHandler;
91 // NOLINTEND
92
93public:
94 // prevent constructor by default
95 ContentManager& operator=(ContentManager const&);
96 ContentManager(ContentManager const&);
97 ContentManager();
98
99public:
100 // virtual functions
101 // NOLINTBEGIN
102 virtual ~ContentManager() /*override*/;
103
104 virtual ::ContentSource* loadContent(::ContentType contentType, ::ContentFlags flags) /*override*/;
105
106 virtual ::ContentSource* loadContent(::InvalidPacksFilterGroup const& invalidFilter) /*override*/;
107
108 virtual ::ContentSource*
109 loadContentForLevel(::std::string const& levelId, ::mce::UUID const& premiumTemplateId) /*override*/;
110
111 virtual ::ContentSource* loadContentForRealm(int64 const realmId) /*override*/;
112
113 virtual ::std::unique_ptr<::ContentSource> loadContentForRealmsWorld(
114 ::Realms::RealmId realmId,
115 ::std::vector<::Realms::Content> const& servicePackData
116 ) /*override*/;
117
118 virtual void addPackSourceFromPremiumTemplate(
119 ::RealmPackManagerContentSource* source,
120 ::mce::UUID const& premiumTemplateId,
121 ::PackType packType
122 ) /*override*/;
123
124 virtual void addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource) /*override*/;
125
126 virtual void addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack) /*override*/;
127
128 virtual void addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider) /*override*/;
129
130 virtual void clearRealmsUnknownPackSource() /*override*/;
131
132 virtual void removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const& id) /*override*/;
133
134 virtual ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
135 getGlobalResourcePackCollection(bool isEditorMode) /*override*/;
136
137 virtual ::std::unique_ptr<::IContentManagerContext>
138 createContext(::std::function<bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate) /*override*/;
139
140 virtual void removeContext(::IContentManagerContext& context) /*override*/;
141
142 virtual ::std::vector<::std::unique_ptr<::ContentSource>> const& getSources() const /*override*/;
143
144 virtual ::std::vector<::std::shared_ptr<::ContentItem>> getContentItems() const /*override*/;
145
146 virtual ::std::shared_ptr<::IVersionedContentItemCollection const> getVersionedItems() const /*override*/;
147
148 virtual void enableCatalogPackSource() /*override*/;
149
150 virtual void generateItems(::ContentSource* source) /*override*/;
151
152 virtual ::Bedrock::Threading::Async<void> reloadSources(bool saveSources) /*override*/;
153
154 virtual void reloadItems() /*override*/;
155
156 virtual void reloadViews() /*override*/;
157
158 virtual void populateDependencies() const /*override*/;
159
160 virtual void deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
161
162 virtual void deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
163
164 virtual void deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
165
166 virtual void
167 deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
168
169 virtual void postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
170
171 virtual void
172 postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
173
174 virtual uint64 generateContentId() /*override*/;
175
176 virtual ::Core::PathBuffer<::std::string> const getWorldResourcePath(::std::string const& levelId) const
177 /*override*/;
178
179 virtual ::Core::PathBuffer<::std::string> const getWorldBehaviorPath(::std::string const& levelId) const
180 /*override*/;
181
182 virtual ::Core::PathBuffer<::std::string> const getWorldResourceFolder(::std::string const& levelId) const
183 /*override*/;
184
185 virtual ::Core::PathBuffer<::std::string> const getWorldBehaviorFolder(::std::string const& levelId) const
186 /*override*/;
187
188 virtual ::Core::PathBuffer<::std::string> const getWorldPath(::std::string const& levelId) const /*override*/;
189
190 virtual ::Core::PathBuffer<::std::string> const&
191 getPremiumWorldTemplateFolder(::ContentIdentity const& templateId) /*override*/;
192
193 virtual ::ContentManagerProxy* getProxy() /*override*/;
194
195 virtual void beginAsyncInit(::TaskGroup& taskGroup) /*override*/;
196
197 virtual bool isInitialized() const /*override*/;
198
199 virtual void onLanguageChanged() /*override*/;
200
201 virtual void refreshContentCatalogPackSource() /*override*/;
202
203 virtual ::Bedrock::PubSub::Subscription
204 refreshContentCatalogPackSource(::std::function<void()>&& callback) /*override*/;
205
206 virtual ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> getFilePathManager() /*override*/;
207
208 virtual void onLevelDeleted(::std::string const& levelId) /*override*/;
209
210 virtual void onRealmsReset(::Realms::RealmId const realmsId) /*override*/;
211
212 virtual ::Bedrock::PubSub::Subscription
213 subscribeToSourcesReloadedAsyncCompleted(::std::function<void()>&& onSourcesReloadedAsyncCallback) /*override*/;
214
215 virtual ::std::shared_ptr<::StorageManager::ContentItemProvider> getStorageContentItemProvider() /*override*/;
216
217 virtual ::StorageManager::IContentHandler& getStorageContentHandler() /*override*/;
218
219 virtual ::Bedrock::PubSub::Subscription registerToReloadViews(::std::function<void()> callback) /*override*/;
220 // NOLINTEND
221
222public:
223 // member functions
224 // NOLINTBEGIN
225 MCAPI ContentManager(
226 ::std::unique_ptr<::IContentManagerFactory> factory,
227 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
228 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
229 ::IPackManifestFactory& packManifestFactory,
230 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager,
231 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
232 );
233
234 MCAPI ContentManager(
235 ::ILevelListCache& levelListCache,
236 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
237 ::IResourcePackRepository& resourcePackRepository,
238 ::ResourcePackManager& resourcePackManager,
239 ::PackManifestFactory& packManifestFactory,
240 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
241 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
242 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
243 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
244 ::ClientPackSourceFactory& packSourceFactory,
245 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
246 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
247 );
248
249 MCAPI void _asyncInitWork();
250
251 MCAPI void _dispatchReloadViewPublisher();
252
253 MCAPI ::ContentSource* _loadResourceContent(::ContentType type, ::ContentFlags flags);
254
255 MCAPI void _removeContentItemsFromSource(::gsl::not_null<::ContentSource*> source);
256
257 MCAPI void _retrievePackSources(::PackType packType, ::std::vector<::PackSource*>& packSources);
258
259 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Realms::RealmsServicePackSource> _updateOrCreateRealmsServicePackSource(
260 int64 realmId,
261 ::PackType packType,
262 ::std::vector<::gsl::not_null<::std::shared_ptr<::Pack>>>&& servicePackData
263 );
264
265 MCAPI void initExistanceTracking(::std::weak_ptr<::ContentManager> self);
266 // NOLINTEND
267
268public:
269 // static functions
270 // NOLINTBEGIN
271 MCAPI static void _deleteContent(
272 ::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems,
273 ::std::function<void(::ContentSource&, ::std::vector<::std::shared_ptr<::ContentItem const>> const&)>
274 deleteItemCallback
275 );
276
277 MCAPI static ::std::vector<::std::shared_ptr<::ContentItem const>>
278 _prepareContentItemsForDeleting(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
279 // NOLINTEND
280
281public:
282 // constructor thunks
283 // NOLINTBEGIN
284 MCAPI void* $ctor(
285 ::std::unique_ptr<::IContentManagerFactory> factory,
286 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
287 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
288 ::IPackManifestFactory& packManifestFactory,
289 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager,
290 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
291 );
292
293 MCAPI void* $ctor(
294 ::ILevelListCache& levelListCache,
295 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
296 ::IResourcePackRepository& resourcePackRepository,
297 ::ResourcePackManager& resourcePackManager,
298 ::PackManifestFactory& packManifestFactory,
299 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
300 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
301 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
302 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
303 ::ClientPackSourceFactory& packSourceFactory,
304 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
305 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
306 );
307 // NOLINTEND
308
309public:
310 // destructor thunk
311 // NOLINTBEGIN
312 MCAPI void $dtor();
313 // NOLINTEND
314
315public:
316 // virtual function thunks
317 // NOLINTBEGIN
318 MCAPI ::ContentSource* $loadContent(::ContentType contentType, ::ContentFlags flags);
319
320 MCAPI ::ContentSource* $loadContent(::InvalidPacksFilterGroup const& invalidFilter);
321
322 MCAPI ::ContentSource* $loadContentForLevel(::std::string const& levelId, ::mce::UUID const& premiumTemplateId);
323
324 MCAPI ::ContentSource* $loadContentForRealm(int64 const realmId);
325
326 MCAPI ::std::unique_ptr<::ContentSource>
327 $loadContentForRealmsWorld(::Realms::RealmId realmId, ::std::vector<::Realms::Content> const& servicePackData);
328
329 MCAPI void $addPackSourceFromPremiumTemplate(
330 ::RealmPackManagerContentSource* source,
331 ::mce::UUID const& premiumTemplateId,
332 ::PackType packType
333 );
334
335 MCAPI void $addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource);
336
337 MCAPI void $addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack);
338
339 MCAPI void $addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider);
340
341 MCAPI void $clearRealmsUnknownPackSource();
342
343 MCAPI void $removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const& id);
344
345 MCAPI ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
346 $getGlobalResourcePackCollection(bool isEditorMode);
347
348 MCAPI ::std::unique_ptr<::IContentManagerContext>
349 $createContext(::std::function<bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate);
350
351 MCAPI void $removeContext(::IContentManagerContext& context);
352
353 MCFOLD ::std::vector<::std::unique_ptr<::ContentSource>> const& $getSources() const;
354
355 MCAPI ::std::vector<::std::shared_ptr<::ContentItem>> $getContentItems() const;
356
357 MCFOLD ::std::shared_ptr<::IVersionedContentItemCollection const> $getVersionedItems() const;
358
359 MCAPI void $enableCatalogPackSource();
360
361 MCAPI void $generateItems(::ContentSource* source);
362
363 MCAPI ::Bedrock::Threading::Async<void> $reloadSources(bool saveSources);
364
365 MCAPI void $reloadItems();
366
367 MCAPI void $reloadViews();
368
369 MCAPI void $populateDependencies() const;
370
371 MCAPI void $deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
372
373 MCAPI void $deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
374
375 MCAPI void $deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem);
376
377 MCAPI void $deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
378
379 MCAPI void $postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
380
381 MCAPI void $postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
382
383 MCAPI uint64 $generateContentId();
384
385 MCAPI ::Core::PathBuffer<::std::string> const $getWorldResourcePath(::std::string const& levelId) const;
386
387 MCAPI ::Core::PathBuffer<::std::string> const $getWorldBehaviorPath(::std::string const& levelId) const;
388
389 MCAPI ::Core::PathBuffer<::std::string> const $getWorldResourceFolder(::std::string const& levelId) const;
390
391 MCAPI ::Core::PathBuffer<::std::string> const $getWorldBehaviorFolder(::std::string const& levelId) const;
392
393 MCAPI ::Core::PathBuffer<::std::string> const $getWorldPath(::std::string const& levelId) const;
394
395 MCAPI ::Core::PathBuffer<::std::string> const& $getPremiumWorldTemplateFolder(::ContentIdentity const& templateId);
396
397 MCAPI ::ContentManagerProxy* $getProxy();
398
399 MCAPI void $beginAsyncInit(::TaskGroup& taskGroup);
400
401 MCFOLD bool $isInitialized() const;
402
403 MCAPI void $onLanguageChanged();
404
405 MCAPI void $refreshContentCatalogPackSource();
406
407 MCAPI ::Bedrock::PubSub::Subscription $refreshContentCatalogPackSource(::std::function<void()>&& callback);
408
409 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> $getFilePathManager();
410
411 MCAPI void $onLevelDeleted(::std::string const& levelId);
412
413 MCAPI void $onRealmsReset(::Realms::RealmId const realmsId);
414
415 MCAPI ::Bedrock::PubSub::Subscription
416 $subscribeToSourcesReloadedAsyncCompleted(::std::function<void()>&& onSourcesReloadedAsyncCallback);
417
418 MCAPI ::std::shared_ptr<::StorageManager::ContentItemProvider> $getStorageContentItemProvider();
419
420 MCFOLD ::StorageManager::IContentHandler& $getStorageContentHandler();
421
422 MCAPI ::Bedrock::PubSub::Subscription $registerToReloadViews(::std::function<void()> callback);
423 // NOLINTEND
424
425public:
426 // vftables
427 // NOLINTBEGIN
428 MCNAPI static void** $vftableForIContentManager();
429
430 MCNAPI static void** $vftableForLevelListCacheObserver();
431 // NOLINTEND
432};
Definition Subscription.h:10
Definition CachedHostPackIdProvider.h:5
Definition ClientPackSourceFactory.h:5
Definition ContentCatalogService.h:5
Definition ContentIdentity.h:8
Definition ContentItemCollection.h:5
Definition ContentManagerProxy.h:5
Definition SourcesAsyncReloader.h:7
Definition ContentManager.h:5
static MCAPI void ** $vftableForIContentManager()
static MCAPI void ** $vftableForLevelListCacheObserver()
Definition FilePathManager.h:18
Definition IContentCatalogPackSource.h:5
Definition IContentManagerContext.h:5
Definition IContentManagerFactory.h:5
Definition IContentManager.h:5
Definition IContentTierManager.h:13
Definition ILevelListCache.h:27
Definition IPackManifestFactory.h:17
Definition IResourcePackRepository.h:34
Definition IVersionedContentItemCollection.h:5
Definition IWorldTemplateManager.h:17
Definition LevelListCacheObserver.h:13
Definition MutableContentItemCollection.h:5
Definition PackManifestFactory.h:21
Definition PackSource.h:30
Definition Pack.h:28
Definition RealmsServicePackSource.h:19
Definition ResourcePackManager.h:35
Definition ContentItemProvider.h:7
Definition IContentHandler.h:7
Definition TaskGroup.h:55
Definition WorldTemplateManager.h:22
Definition UUID.h:7
Definition ContentItem.h:5
Definition ContentSource.h:5
Definition InvalidPacksFilterGroup.h:8
Definition RealmPackManagerContentSource.h:5
Definition Content.h:7
Definition RealmId.h:7