le2d v0.4.7
2D game engine framework
 
Loading...
Searching...
No Matches
registry.hpp
Go to the documentation of this file.
1#pragma once
3#include <map>
4
5namespace le::tweak {
7class Registry : public IStore {
8 public:
9 struct Entry {
10 std::string_view id{};
11 gsl::not_null<ITweakable*> tweakable;
12 };
13
14 void add_tweakable(std::string_view id, gsl::not_null<ITweakable*> tweakable) override;
15 void remove_tweakable(std::string_view id) override;
16
17 [[nodiscard]] auto find_tweakable(std::string_view id) const -> ITweakable*;
18
19 void fill_entries(std::vector<Entry>& out) const;
20 [[nodiscard]] auto get_entries() const -> std::vector<Entry>;
21
22 private:
23 std::map<std::string_view, gsl::not_null<ITweakable*>> m_tweakables{};
24};
25} // namespace le::tweak
Interface for concrete Tweakables.
Definition tweakable.hpp:14
Definition store.hpp:7
Tweakable registry.
Definition registry.hpp:7
void fill_entries(std::vector< Entry > &out) const
void add_tweakable(std::string_view id, gsl::not_null< ITweakable * > tweakable) override
auto find_tweakable(std::string_view id) const -> ITweakable *
auto get_entries() const -> std::vector< Entry >
void remove_tweakable(std::string_view id) override
Definition parser.hpp:7
Definition registry.hpp:9
gsl::not_null< ITweakable * > tweakable
Definition registry.hpp:11