Unravel Engine C++ Reference
Loading...
Searching...
No Matches
lambda_actions.cpp
Go to the documentation of this file.
1#include "lambda_actions.h"
2
3namespace unravel
4{
5
6// Untracked Action Implementation
8 : action(std::move(act))
9{
10}
11
13{
14 if (action)
15 {
16 action();
17 }
18}
19
21{
22 // Non-undoable actions do nothing on undo
23}
24
26{
27 return false; // This action type is not undoable
28}
29
30// Tracked Lambda Action Implementation
32 : do_func(std::move(do_action)), undo_func(std::move(undo_action))
33{
34}
35
37{
38 if (do_func)
39 {
40 do_func();
41 }
42}
43
45{
46 if (undo_func)
47 {
48 undo_func();
49 }
50}
51
53{
54 return true; // This action type is undoable
55}
56
57} // namespace unravel
auto is_undoable() const -> bool override
tracked_lambda_action_t(action_t do_action, action_t undo_action)
std::function< void()> action_t
auto is_undoable() const -> bool override
std::function< void()> action_t