BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
RunFunctionCommand Class Reference
Inheritance diagram for RunFunctionCommand:
Collaboration diagram for RunFunctionCommand:

Public Member Functions

void Execute () override
 Executes this command.
 
void Undo () override
 Undoes the command if it is undoable.
 
bool Combine (ICommand *&other) override
 Does not combine the commands.
 
std::string GetName () const override
 Returns the name of this command.
 
 RunFunctionCommand (const std::string &name, std::function< void()> function, std::function< void()> reverseFunction=std::function< void()>(nullptr))
 Instantiates a command that runs the given function once the command is executed.
 
- Public Member Functions inherited from ICommand
bool Undoable () const
 Returns whether the command is undoable.
 
bool Trackable () const
 Returns whether the command is trackable (ie. should be stored in ActionStack)
 

Protected Attributes

std::function< void()> mFunction = nullptr
 
std::function< void()> mReverseFunction = nullptr
 
std::string mName = ""
 
- Protected Attributes inherited from ICommand
bool mCanBeUndone = true
 
bool mTrackable = true
 

Constructor & Destructor Documentation

◆ RunFunctionCommand()

RunFunctionCommand::RunFunctionCommand ( const std::string &  name,
std::function< void()>  function,
std::function< void()>  reverseFunction = std::function<void()>(nullptr) 
)
inlineexplicit

Instantiates a command that runs the given function once the command is executed.

Member Function Documentation

◆ Combine()

bool RunFunctionCommand::Combine ( ICommand *&  other)
inlineoverridevirtual

Does not combine the commands.

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

Implements ICommand.

◆ Execute()

void RunFunctionCommand::Execute ( )
inlineoverridevirtual

Executes this command.

Implements ICommand.

◆ GetName()

std::string RunFunctionCommand::GetName ( ) const
inlineoverridevirtual

Returns the name of this command.

Returns

Implements ICommand.

◆ Undo()

void RunFunctionCommand::Undo ( )
inlineoverridevirtual

Undoes the command if it is undoable.

Implements ICommand.

Member Data Documentation

◆ mFunction

std::function<void()> RunFunctionCommand::mFunction = nullptr
protected

◆ mName

std::string RunFunctionCommand::mName = ""
protected

◆ mReverseFunction

std::function<void()> RunFunctionCommand::mReverseFunction = nullptr
protected