yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
activity_bar_actions_registry.cc
Go to the documentation of this file.
1
#include "
app/editor/menu/activity_bar_actions_registry.h
"
2
3
#include <algorithm>
4
#include <utility>
5
6
namespace
yaze
{
7
namespace
editor {
8
9
void
MoreActionsRegistry::Register
(
MoreAction
action) {
10
auto
it = std::find_if(
11
actions_
.begin(),
actions_
.end(),
12
[&](
const
MoreAction
& existing) { return existing.id == action.id; });
13
if
(it !=
actions_
.end()) {
14
*it = std::move(action);
15
return
;
16
}
17
actions_
.push_back(std::move(action));
18
}
19
20
void
MoreActionsRegistry::Unregister
(
const
std::string&
id
) {
21
actions_
.erase(
22
std::remove_if(
actions_
.begin(),
actions_
.end(),
23
[&](
const
MoreAction
& a) { return a.id == id; }),
24
actions_
.end());
25
}
26
27
void
MoreActionsRegistry::Clear
() {
actions_
.clear(); }
28
29
void
MoreActionsRegistry::ForEach
(
30
const
std::function<
void
(
const
MoreAction
&)>& fn)
const
{
31
for
(
const
auto
& action :
actions_
) {
32
fn(action);
33
}
34
}
35
36
}
// namespace editor
37
}
// namespace yaze
activity_bar_actions_registry.h
yaze::editor::MoreActionsRegistry::ForEach
void ForEach(const std::function< void(const MoreAction &)> &fn) const
Definition
activity_bar_actions_registry.cc:29
yaze::editor::MoreActionsRegistry::actions_
std::vector< MoreAction > actions_
Definition
activity_bar_actions_registry.h:37
yaze::editor::MoreActionsRegistry::Unregister
void Unregister(const std::string &id)
Definition
activity_bar_actions_registry.cc:20
yaze::editor::MoreActionsRegistry::Register
void Register(MoreAction action)
Definition
activity_bar_actions_registry.cc:9
yaze::editor::MoreActionsRegistry::Clear
void Clear()
Definition
activity_bar_actions_registry.cc:27
yaze
Definition
patch_export_usage.cc:8
yaze::editor::MoreAction
Definition
activity_bar_actions_registry.h:14
src
app
editor
menu
activity_bar_actions_registry.cc
Generated by
1.10.0