LeviLamina
Loading...
Searching...
No Matches
ModManager.h
1#pragma once
2
3#include <cstddef>
4#include <functional>
5#include <memory>
6#include <mutex>
7#include <string>
8#include <string_view>
9
10#include "ll/api/Expected.h"
11#include "ll/api/base/Macro.h"
12#include "ll/api/coro/Generator.h"
13#include "ll/api/mod/Manifest.h"
14#include "ll/api/mod/Mod.h"
15
16
17namespace ll::mod {
18class ModManagerRegistry;
20 friend ModManagerRegistry;
21 struct Impl;
22 std::unique_ptr<Impl> impl;
23
24public:
25 LLNDAPI std::string const& getType() const;
26
27 LLNDAPI bool hasMod(std::string_view name) const;
28
29 LLNDAPI std::shared_ptr<Mod> getMod(std::string_view name) const;
30
31 LLNDAPI size_t getModCount() const;
32
33 LLNDAPI coro::Generator<Mod&> mods() const;
34
35protected:
36 LLNDAPI std::lock_guard<std::recursive_mutex> lock() const;
37
38 LLNDAPI explicit ModManager(std::string_view type);
39
40 LLAPI virtual ~ModManager();
41
42 LLAPI void addMod(std::string_view name, std::shared_ptr<Mod> const& mod);
43
44 LLAPI void eraseMod(std::string_view name);
45
46 virtual Expected<> load(Manifest manifest) = 0;
47
48 virtual Expected<> unload(std::string_view name) = 0;
49
50 LLAPI virtual Expected<> enable(std::string_view name);
51
52 LLAPI virtual Expected<> disable(std::string_view name);
53};
54} // namespace ll::mod
Definition ModManagerRegistry.h:11
Definition ModManager.h:19
Definition Generator.h:13
Definition Manifest.h:31