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::BTCommandStack Class Reference

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

#include <BTEditorCommand.h>

Public Member Functions

void Execute (std::unique_ptr< BTEditorCommand > cmd)
 Execute a command and add it to the 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 the next undo command.
 
std::string GetRedoDescription () const
 Get description of the next redo command.
 
void Clear ()
 Clear all commands.
 
void Execute (std::unique_ptr< BTEditorCommand > cmd)
 Execute a command and add it to the 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 the next undo command.
 
std::string GetRedoDescription () const
 Get description of the next redo command.
 
void Clear ()
 Clear all commands.
 

Private Attributes

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

Static Private Attributes

static const size_t kMaxStackSize = 100
 

Detailed Description

Manages undo/redo stacks for editor commands.

Definition at line 56 of file BTEditorCommand.h.

Member Function Documentation

◆ CanRedo() [1/2]

bool Olympe::BTCommandStack::CanRedo ( ) const

Check if redo is available.

Definition at line 71 of file BTEditorCommand.cpp.

References m_redoStack.

Referenced by GetRedoDescription(), and Redo().

+ Here is the caller graph for this function:

◆ CanRedo() [2/2]

bool Olympe::BTCommandStack::CanRedo ( ) const

Check if redo is available.

◆ CanUndo() [1/2]

bool Olympe::BTCommandStack::CanUndo ( ) const

Check if undo is available.

Definition at line 66 of file BTEditorCommand.cpp.

References m_undoStack.

Referenced by GetUndoDescription(), and Undo().

+ Here is the caller graph for this function:

◆ CanUndo() [2/2]

bool Olympe::BTCommandStack::CanUndo ( ) const

Check if undo is available.

◆ Clear() [1/2]

void Olympe::BTCommandStack::Clear ( )

Clear all commands.

Definition at line 92 of file BTEditorCommand.cpp.

References m_redoStack, and m_undoStack.

◆ Clear() [2/2]

void Olympe::BTCommandStack::Clear ( )

Clear all commands.

◆ Execute() [1/2]

void Olympe::BTCommandStack::Execute ( std::unique_ptr< BTEditorCommand cmd)

Execute a command and add it to the undo stack.

Parameters
cmdCommand to execute

Definition at line 21 of file BTEditorCommand.cpp.

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

Referenced by Olympe::NodeGraphShared::CommandAdapter::AddNode(), Olympe::NodeGraphShared::CommandAdapter::ConnectNodes(), Olympe::NodeGraphShared::CommandAdapter::DeleteNode(), Olympe::NodeGraphShared::CommandAdapter::DisconnectNodes(), and Olympe::NodeGraphShared::CommandAdapter::MoveNode().

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

◆ Execute() [2/2]

void Olympe::BTCommandStack::Execute ( std::unique_ptr< BTEditorCommand cmd)

Execute a command and add it to the undo stack.

Parameters
cmdCommand to execute

◆ GetRedoDescription() [1/2]

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

Get description of the next redo command.

Definition at line 84 of file BTEditorCommand.cpp.

References CanRedo(), and m_redoStack.

+ Here is the call graph for this function:

◆ GetRedoDescription() [2/2]

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

Get description of the next redo command.

◆ GetUndoDescription() [1/2]

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

Get description of the next undo command.

Definition at line 76 of file BTEditorCommand.cpp.

References CanUndo(), and m_undoStack.

+ Here is the call graph for this function:

◆ GetUndoDescription() [2/2]

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

Get description of the next undo command.

◆ Redo() [1/2]

void Olympe::BTCommandStack::Redo ( )

Redo the last undone command.

Definition at line 53 of file BTEditorCommand.cpp.

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

+ Here is the call graph for this function:

◆ Redo() [2/2]

void Olympe::BTCommandStack::Redo ( )

Redo the last undone command.

◆ Undo() [1/2]

void Olympe::BTCommandStack::Undo ( )

Undo the last command.

Definition at line 40 of file BTEditorCommand.cpp.

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

+ Here is the call graph for this function:

◆ Undo() [2/2]

void Olympe::BTCommandStack::Undo ( )

Undo the last command.

Member Data Documentation

◆ kMaxStackSize

static const size_t Olympe::BTCommandStack::kMaxStackSize = 100
staticprivate

Definition at line 103 of file BTEditorCommand.h.

Referenced by Execute().

◆ m_redoStack

std::vector< std::unique_ptr< BTEditorCommand > > Olympe::BTCommandStack::m_redoStack
private

Definition at line 102 of file BTEditorCommand.h.

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

◆ m_undoStack

std::vector< std::unique_ptr< BTEditorCommand > > Olympe::BTCommandStack::m_undoStack
private

Definition at line 101 of file BTEditorCommand.h.

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


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