BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
ChangeValueCommand< T > Class Template Reference
Inheritance diagram for ChangeValueCommand< T >:
Collaboration diagram for ChangeValueCommand< T >:

Public Member Functions

void Execute () override
 Executes this command.
 
void Undo () override
 Undoes this command.
 
bool Combine (ICommand *&other) override
 Combine this command with another command if they modify the same variable. WARNING: If combined, the other command is deleted and will be nullptr.
 
std::string GetName () const override
 Returns the name of this command.
 
 ChangeValueCommand (T *valueRef, const T &newValue, std::function< void()> setCallback=std::function< void()>(nullptr))
 Instantiates a command that changes the value of the given reference to the given value 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)
 

Additional Inherited Members

- Protected Attributes inherited from ICommand
bool mCanBeUndone = true
 
bool mTrackable = true
 

Constructor & Destructor Documentation

◆ ChangeValueCommand()

template<typename T >
ChangeValueCommand< T >::ChangeValueCommand ( T *  valueRef,
const T &  newValue,
std::function< void()>  setCallback = std::function<void()>(nullptr) 
)
inlineexplicit

Instantiates a command that changes the value of the given reference to the given value once the command is executed.

Parameters
valueRefReference to the variable to change
newValueValue to change the variable to

Member Function Documentation

◆ Combine()

template<typename T >
bool ChangeValueCommand< T >::Combine ( ICommand *&  other)
inlineoverridevirtual

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

Implements ICommand.

◆ Execute()

template<typename T >
void ChangeValueCommand< T >::Execute ( )
inlineoverridevirtual

Executes this command.

Implements ICommand.

◆ GetName()

template<typename T >
std::string ChangeValueCommand< T >::GetName ( ) const
inlineoverridevirtual

Returns the name of this command.

Returns

Implements ICommand.

◆ Undo()

template<typename T >
void ChangeValueCommand< T >::Undo ( )
inlineoverridevirtual

Undoes this command.

Implements ICommand.