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

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< GraphCommandPtrm_undoStack
 
std::vector< GraphCommandPtrm_redoStack
 

Detailed Description

Manages undo/redo stacks for graph operations.

Implements a standard undo/redo pattern with two stacks:

Definition at line 24 of file CommandHistory.h.

Constructor & Destructor Documentation

◆ CommandHistory()

Olympe::CommandHistory::CommandHistory ( )

Definition at line 11 of file CommandHistory.cpp.

◆ ~CommandHistory()

Olympe::CommandHistory::~CommandHistory ( )
default

Member Function Documentation

◆ CanRedo()

bool Olympe::CommandHistory::CanRedo ( ) const

Check if redo is available.

Returns
true if there's a command to redo

Definition at line 76 of file CommandHistory.cpp.

References m_redoStack.

◆ CanUndo()

bool Olympe::CommandHistory::CanUndo ( ) const

Check if undo is available.

Returns
true if there's a command to undo

Definition at line 71 of file CommandHistory.cpp.

References m_undoStack.

◆ Clear()

void Olympe::CommandHistory::Clear ( )

Clear all undo/redo history.

Definition at line 95 of file CommandHistory.cpp.

References m_redoStack, and m_undoStack.

◆ ExecuteCommand()

bool Olympe::CommandHistory::ExecuteCommand ( GraphCommandPtr  command)

Execute a new command and add it to history.

Parameters
commandThe command to execute
Returns
true if command executed successfully

Definition at line 15 of file CommandHistory.cpp.

References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.

+ Here is the call graph for this function:

◆ GetRedoDescription()

std::string Olympe::CommandHistory::GetRedoDescription ( ) const

Get description of next redo command.

Returns
Description string or empty if nothing to redo

Definition at line 88 of file CommandHistory.cpp.

References m_redoStack.

◆ GetRedoStackSize()

size_t Olympe::CommandHistory::GetRedoStackSize ( ) const
inline

Get current redo stack size.

Definition at line 86 of file CommandHistory.h.

References m_redoStack.

◆ GetUndoDescription()

std::string Olympe::CommandHistory::GetUndoDescription ( ) const

Get description of next undo command.

Returns
Description string or empty if nothing to undo

Definition at line 81 of file CommandHistory.cpp.

References Olympe::GraphCommand::GetDescription(), and m_undoStack.

+ Here is the call graph for this function:

◆ GetUndoStackSize()

size_t Olympe::CommandHistory::GetUndoStackSize ( ) const
inline

Get current undo stack size.

Definition at line 81 of file CommandHistory.h.

References m_undoStack.

◆ Redo()

bool Olympe::CommandHistory::Redo ( )

Redo the last undone command.

Returns
true if redo succeeded, false if nothing to redo

Definition at line 52 of file CommandHistory.cpp.

References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.

+ Here is the call graph for this function:

◆ Undo()

bool Olympe::CommandHistory::Undo ( )

Undo the last command.

Returns
true if undo succeeded, false if nothing to undo

Definition at line 33 of file CommandHistory.cpp.

References GetComponentTypeID_Static(), m_redoStack, and m_undoStack.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_redoStack

std::vector<GraphCommandPtr> Olympe::CommandHistory::m_redoStack
private

◆ m_undoStack

std::vector<GraphCommandPtr> Olympe::CommandHistory::m_undoStack
private

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