LeviLamina
Loading...
Searching...
No Matches
ModManagerRegistry.h
1#pragma once
2
3#include "ll/api/Expected.h"
4#include "ll/api/base/Macro.h"
5#include "ll/api/coro/Generator.h"
6#include "ll/api/data/DependencyGraph.h"
7#include "ll/api/mod/ModManager.h"
8
9namespace ll::mod {
10class ModRegistrar;
12 friend ModRegistrar;
13 friend Mod;
14 struct Impl;
15 std::unique_ptr<Impl> impl;
16
19
20 Expected<> loadMod(Manifest manifest) noexcept;
21
22 Expected<> unloadMod(std::string_view name) noexcept;
23
24 Expected<> enableMod(std::string_view name) const noexcept;
25
26 Expected<> disableMod(std::string_view name) const noexcept;
27
28 Expected<> onModLoad(std::string_view name) const noexcept;
29
30 Expected<> onModUnload(std::string_view name) const noexcept;
31
32 Expected<> onModEnable(std::string_view name) const noexcept;
33
34 Expected<> onModDisable(std::string_view name) const noexcept;
35
36public:
37 LLNDAPI static ModManagerRegistry& getInstance();
38
39 LLNDAPI bool addManager(std::shared_ptr<ModManager> const& manager);
40
41 LLNDAPI bool eraseManager(std::string_view type);
42
43 LLNDAPI bool hasManager(std::string_view type) const;
44
45 LLNDAPI std::shared_ptr<ModManager> getManager(std::string_view type) const;
46
47 LLNDAPI std::shared_ptr<ModManager> getManagerForMod(std::string_view name) const;
48
49 LLNDAPI coro::Generator<ModManager&> managers() const;
50
51 LLNDAPI coro::Generator<Mod&> mods() const;
52
53 LLNDAPI bool hasMod(std::string_view name) const;
54
55 LLNDAPI std::string getModType(std::string_view name) const;
56
57 LLNDAPI std::shared_ptr<Mod> getMod(std::string_view name) const;
58
59 LLAPI void executeOnModLoad(std::function<void(std::string_view name)>&& fn) noexcept;
60
61 LLAPI void executeOnModUnload(std::function<void(std::string_view name)>&& fn) noexcept;
62
63 LLAPI void executeOnModEnable(std::function<void(std::string_view name)>&& fn) noexcept;
64
65 LLAPI void executeOnModDisable(std::function<void(std::string_view name)>&& fn) noexcept;
66};
67} // namespace ll::mod
Definition ModManagerRegistry.h:11
Definition Mod.h:17
Definition Generator.h:13
Definition Manifest.h:31