BambooTracker/command/command_manager.hpp
raw| 1 | /* |
| 2 | * SPDX-FileCopyrightText: 2018 Rerrah |
| 3 | * SPDX-License-Identifier: MIT |
| 4 | */ |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <deque> |
| 9 | #include <memory> |
| 10 | #include "abstract_command.hpp" |
| 11 | |
| 12 | class CommandManager |
| 13 | { |
| 14 | public: |
| 15 | using CommandIPtr = std::unique_ptr<AbstractCommand>; |
| 16 | |
| 17 | bool invoke(CommandIPtr command); |
| 18 | bool undo(); |
| 19 | bool redo(); |
| 20 | void clear(); |
| 21 | |
| 22 | private: |
| 23 | std::deque<CommandIPtr> undoStack_, redoStack_; |
| 24 | }; |