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.
2
3#include <algorithm>
4#include <utility>
5
6namespace yaze {
7namespace editor {
8
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
20void 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
28
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
void ForEach(const std::function< void(const MoreAction &)> &fn) const