BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
ICommand Class Referenceabstract

Command interface. Allows executing the command and undoing it. More...

Inheritance diagram for ICommand:

Public Member Functions

virtual void Execute ()=0
 Executes this command.
 
virtual void Undo ()=0
 Attempts to undo this command. May not be possible for a specific command.
 
virtual bool Combine (ICommand *&other)=0
 Combine this command with another command if they modify the same variable. WARNING: If combined, the other command is deleted and will be nullptr.
 
bool Undoable () const
 Returns whether the command is undoable.
 
bool Trackable () const
 Returns whether the command is trackable (ie. should be stored in ActionStack)
 
virtual std::string GetName () const =0
 Returns the name of this command.
 

Protected Attributes

bool mCanBeUndone = true
 
bool mTrackable = true
 

Detailed Description

Command interface. Allows executing the command and undoing it.

Member Function Documentation

◆ Combine()

virtual bool ICommand::Combine ( ICommand *&  other)
pure virtual

Combine this command with another command if they modify the same variable. WARNING: If combined, the other command is deleted and will be nullptr.

Parameters
otherOther command to combine with
Returns
Whether the commands were combined

Implemented in AddValueCommand< T >, ChangeValueCommand< T >, RedoCommand, RunFunctionCommand, RunToggleFunctionCommand, and UndoCommand.

◆ Execute()

virtual void ICommand::Execute ( )
pure virtual

◆ GetName()

virtual std::string ICommand::GetName ( ) const
pure virtual

Returns the name of this command.

Returns

Implemented in AddValueCommand< T >, ChangeValueCommand< T >, RedoCommand, RunFunctionCommand, RunToggleFunctionCommand, and UndoCommand.

◆ Trackable()

bool ICommand::Trackable ( ) const
inline

Returns whether the command is trackable (ie. should be stored in ActionStack)

Returns

◆ Undo()

virtual void ICommand::Undo ( )
pure virtual

Attempts to undo this command. May not be possible for a specific command.

Implemented in AddValueCommand< T >, ChangeValueCommand< T >, RedoCommand, RunFunctionCommand, RunToggleFunctionCommand, and UndoCommand.

◆ Undoable()

bool ICommand::Undoable ( ) const
inline

Returns whether the command is undoable.

Returns

Member Data Documentation

◆ mCanBeUndone

bool ICommand::mCanBeUndone = true
protected

◆ mTrackable

bool ICommand::mTrackable = true
protected