Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Olympe::NodeGraph::CommandStack Class Reference

Manages undo/redo stacks for commands. More...

#include <CommandSystem.h>

Public Member Functions

void ExecuteCommand (std::unique_ptr< ICommand > cmd)
 Execute a command and add to undo stack.
 
void Undo ()
 Undo the last command.
 
void 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 commands.
 

Private Attributes

std::vector< std::unique_ptr< ICommand > > m_undoStack
 
std::vector< std::unique_ptr< ICommand > > m_redoStack
 

Static Private Attributes

static const size_t MAX_STACK_SIZE = 100
 

Detailed Description

Manages undo/redo stacks for commands.

Definition at line 48 of file CommandSystem.h.

Member Function Documentation

◆ CanRedo()

bool Olympe::NodeGraph::CommandStack::CanRedo ( ) const

Check if redo is available.

Definition at line 67 of file CommandSystem.cpp.

References m_redoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Redo(), Redo(), and Olympe::AI::AIEditorGUI::RenderMenuBar().

+ Here is the caller graph for this function:

◆ CanUndo()

bool Olympe::NodeGraph::CommandStack::CanUndo ( ) const

Check if undo is available.

Definition at line 62 of file CommandSystem.cpp.

References m_undoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Undo(), Olympe::AI::AIEditorGUI::RenderMenuBar(), and Undo().

+ Here is the caller graph for this function:

◆ Clear()

void Olympe::NodeGraph::CommandStack::Clear ( )

Clear all commands.

Definition at line 88 of file CommandSystem.cpp.

References m_redoStack, and m_undoStack.

Referenced by Olympe::AI::AIEditorGUI::Shutdown().

+ Here is the caller graph for this function:

◆ ExecuteCommand()

void Olympe::NodeGraph::CommandStack::ExecuteCommand ( std::unique_ptr< ICommand cmd)

Execute a command and add to undo stack.

Parameters
cmdCommand to execute

Definition at line 17 of file CommandSystem.cpp.

References GetComponentTypeID_Static(), m_redoStack, m_undoStack, and MAX_STACK_SIZE.

Referenced by Olympe::AI::AIEditorGUI::Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRedoDescription()

std::string Olympe::NodeGraph::CommandStack::GetRedoDescription ( ) const

Get description of next redo command.

Definition at line 80 of file CommandSystem.cpp.

References m_redoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Redo().

+ Here is the caller graph for this function:

◆ GetUndoDescription()

std::string Olympe::NodeGraph::CommandStack::GetUndoDescription ( ) const

Get description of next undo command.

Definition at line 72 of file CommandSystem.cpp.

References m_undoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Undo().

+ Here is the caller graph for this function:

◆ Redo()

void Olympe::NodeGraph::CommandStack::Redo ( )

Redo the last undone command.

Definition at line 49 of file CommandSystem.cpp.

References CanRedo(), GetComponentTypeID_Static(), m_redoStack, and m_undoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Redo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Undo()

void Olympe::NodeGraph::CommandStack::Undo ( )

Undo the last command.

Definition at line 36 of file CommandSystem.cpp.

References CanUndo(), GetComponentTypeID_Static(), m_redoStack, and m_undoStack.

Referenced by Olympe::AI::AIEditorGUI::MenuAction_Undo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_redoStack

std::vector<std::unique_ptr<ICommand> > Olympe::NodeGraph::CommandStack::m_redoStack
private

Definition at line 93 of file CommandSystem.h.

Referenced by CanRedo(), Clear(), ExecuteCommand(), GetRedoDescription(), Redo(), and Undo().

◆ m_undoStack

std::vector<std::unique_ptr<ICommand> > Olympe::NodeGraph::CommandStack::m_undoStack
private

Definition at line 92 of file CommandSystem.h.

Referenced by CanUndo(), Clear(), ExecuteCommand(), GetUndoDescription(), Redo(), and Undo().

◆ MAX_STACK_SIZE

const size_t Olympe::NodeGraph::CommandStack::MAX_STACK_SIZE = 100
staticprivate

Definition at line 94 of file CommandSystem.h.

Referenced by ExecuteCommand().


The documentation for this class was generated from the following files: