le2d
v0.4.7
2D game engine framework
Loading...
Searching...
No Matches
registry.hpp
Go to the documentation of this file.
1
#pragma once
2
#include "
le2d/tweak/store.hpp
"
3
#include <map>
4
5
namespace
le::tweak
{
7
class
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
le::ITweakable
Interface for concrete Tweakables.
Definition
tweakable.hpp:14
le::tweak::IStore
Definition
store.hpp:7
le::tweak::Registry
Tweakable registry.
Definition
registry.hpp:7
le::tweak::Registry::fill_entries
void fill_entries(std::vector< Entry > &out) const
le::tweak::Registry::add_tweakable
void add_tweakable(std::string_view id, gsl::not_null< ITweakable * > tweakable) override
le::tweak::Registry::find_tweakable
auto find_tweakable(std::string_view id) const -> ITweakable *
le::tweak::Registry::get_entries
auto get_entries() const -> std::vector< Entry >
le::tweak::Registry::remove_tweakable
void remove_tweakable(std::string_view id) override
le::tweak
Definition
parser.hpp:7
store.hpp
le::tweak::Registry::Entry
Definition
registry.hpp:9
le::tweak::Registry::Entry::tweakable
gsl::not_null< ITweakable * > tweakable
Definition
registry.hpp:11
lib
include
le2d
tweak
registry.hpp
Generated by
1.9.8