Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::MacroCommand Class Reference

Class to combine multiples commands to execute then or undo them in batches. More...

#include <Command.h>

Inheritance diagram for Elevate::MacroCommand:
Elevate::Command

Public Member Functions

 MacroCommand (std::vector< std::unique_ptr< Command > > &&commands)
 
virtual void Execute () override
 
virtual void Undo () override
 
- Public Member Functions inherited from Elevate::Command
virtual ~Command ()=default
 
virtual bool IsUndoable () const
 

Detailed Description

Class to combine multiples commands to execute then or undo them in batches.

Definition at line 20 of file Command.h.

Constructor & Destructor Documentation

◆ MacroCommand()

Elevate::MacroCommand::MacroCommand ( std::vector< std::unique_ptr< Command > > &&  commands)
inline

Definition at line 23 of file Command.h.

23: m_commands(std::move(commands)) { }

Member Function Documentation

◆ Execute()

virtual void Elevate::MacroCommand::Execute ( )
inlineoverridevirtual

Implements Elevate::Command.

Definition at line 25 of file Command.h.

25 {
26 for (auto it = m_commands.begin(); it != m_commands.end(); ++it) {
27 (*it)->Execute();
28 }
29 }

◆ Undo()

virtual void Elevate::MacroCommand::Undo ( )
inlineoverridevirtual

Implements Elevate::Command.

Definition at line 30 of file Command.h.

30 {
31 for (auto it = m_commands.rbegin(); it != m_commands.rend(); ++it) {
32 (*it)->Undo();
33 }
34 }

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