Unravel Engine C++ Reference
Loading...
Searching...
No Matches
undo_redo_stack.h
Go to the documentation of this file.
1#pragma once
2
3#include "editing_action.h"
4#include <memory>
5#include <vector>
6
7namespace unravel
8{
9
11{
12 std::vector<std::shared_ptr<editing_action_t>> actions;
13 size_t current_index{0}; // Points to the last executed action (0 = no actions executed)
14 std::string last_action_name;
16
17
18 void push_if_undoable(std::shared_ptr<editing_action_t> action);
19
20 auto can_undo() const -> bool;
21 auto can_redo() const -> bool;
22
23 auto undo() -> std::shared_ptr<editing_action_t>;
24 auto redo() -> std::shared_ptr<editing_action_t>;
25 void clear();
26};
27
28} // namespace unravel
std::chrono::duration< float > delta_t
Hash specialization for batch_key to enable use in std::unordered_map.
auto redo() -> std::shared_ptr< editing_action_t >
auto undo() -> std::shared_ptr< editing_action_t >
void push_if_undoable(std::shared_ptr< editing_action_t > action)
auto can_undo() const -> bool
auto can_redo() const -> bool
std::vector< std::shared_ptr< editing_action_t > > actions