![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Manages undo/redo stacks for graph operations. More...
#include <CommandHistory.h>
Public Member Functions | |
| CommandHistory () | |
| ~CommandHistory ()=default | |
| bool | ExecuteCommand (GraphCommandPtr command) |
| Execute a new command and add it to history. | |
| bool | Undo () |
| Undo the last command. | |
| bool | Redo () |
| Redo the last undone command. | |
| bool | CanUndo () const |
| Check if undo is available. | |
| bool | CanRedo () const |
| Check if redo is available. | |
| std::string | GetUndoDescription () const |
| Get description of next undo command. | |
| std::string | GetRedoDescription () const |
| Get description of next redo command. | |
| void | Clear () |
| Clear all undo/redo history. | |
| size_t | GetUndoStackSize () const |
| Get current undo stack size. | |
| size_t | GetRedoStackSize () const |
| Get current redo stack size. | |
Private Attributes | |
| std::vector< GraphCommandPtr > | m_undoStack |
| std::vector< GraphCommandPtr > | m_redoStack |
Manages undo/redo stacks for graph operations.
Implements a standard undo/redo pattern with two stacks:
Definition at line 24 of file CommandHistory.h.
| Olympe::CommandHistory::CommandHistory | ( | ) |
Definition at line 11 of file CommandHistory.cpp.
|
default |
| bool Olympe::CommandHistory::CanRedo | ( | ) | const |
Check if redo is available.
Definition at line 76 of file CommandHistory.cpp.
References m_redoStack.
| bool Olympe::CommandHistory::CanUndo | ( | ) | const |
Check if undo is available.
Definition at line 71 of file CommandHistory.cpp.
References m_undoStack.
| void Olympe::CommandHistory::Clear | ( | ) |
Clear all undo/redo history.
Definition at line 95 of file CommandHistory.cpp.
References m_redoStack, and m_undoStack.
| bool Olympe::CommandHistory::ExecuteCommand | ( | GraphCommandPtr | command | ) |
Execute a new command and add it to history.
| command | The command to execute |
Definition at line 15 of file CommandHistory.cpp.
References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.
Here is the call graph for this function:| std::string Olympe::CommandHistory::GetRedoDescription | ( | ) | const |
Get description of next redo command.
Definition at line 88 of file CommandHistory.cpp.
References m_redoStack.
|
inline |
Get current redo stack size.
Definition at line 86 of file CommandHistory.h.
References m_redoStack.
| std::string Olympe::CommandHistory::GetUndoDescription | ( | ) | const |
Get description of next undo command.
Definition at line 81 of file CommandHistory.cpp.
References Olympe::GraphCommand::GetDescription(), and m_undoStack.
Here is the call graph for this function:
|
inline |
Get current undo stack size.
Definition at line 81 of file CommandHistory.h.
References m_undoStack.
| bool Olympe::CommandHistory::Redo | ( | ) |
Redo the last undone command.
Definition at line 52 of file CommandHistory.cpp.
References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.
Here is the call graph for this function:| bool Olympe::CommandHistory::Undo | ( | ) |
Undo the last command.
Definition at line 33 of file CommandHistory.cpp.
References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.
Here is the call graph for this function:
|
private |
Definition at line 90 of file CommandHistory.h.
Referenced by CanRedo(), Clear(), ExecuteCommand(), GetRedoDescription(), GetRedoStackSize(), Redo(), and Undo().
|
private |
Definition at line 89 of file CommandHistory.h.
Referenced by CanUndo(), Clear(), ExecuteCommand(), GetUndoDescription(), GetUndoStackSize(), Redo(), and Undo().