GenericCommand is a Command that can be constructed directly using lambdas, without having to create a subclass. More...

#include <Command.h>

Inheritance diagram for GenericCommand:
Inheritance graph
Collaboration diagram for GenericCommand:
Collaboration graph

Public Member Functions

 GenericCommand (QString name, std::function< void()> execute, std::function< void()> unexecute)
 
 GenericCommand (QString name, std::function< void()> execute, std::function< void()> unexecute, std::function< void()> onDelete)
 
virtual ~GenericCommand ()
 
QString getName () const override
 
void execute () override
 
void unexecute () override
 

Private Attributes

QString m_name
 
std::function< void()> m_execute
 
std::function< void()> m_unexecute
 
std::function< void()> m_onDelete
 

Detailed Description

GenericCommand is a Command that can be constructed directly using lambdas, without having to create a subclass.

Best for commands invoked only in a single place, and where little state is involved.

Definition at line 41 of file Command.h.

Constructor & Destructor Documentation

GenericCommand::GenericCommand ( QString  name,
std::function< void()>  execute,
std::function< void()>  unexecute 
)
inline

Definition at line 44 of file Command.h.

GenericCommand::GenericCommand ( QString  name,
std::function< void()>  execute,
std::function< void()>  unexecute,
std::function< void()>  onDelete 
)
inline

Definition at line 53 of file Command.h.

virtual GenericCommand::~GenericCommand ( )
inlinevirtual

Definition at line 63 of file Command.h.

Member Function Documentation

QString GenericCommand::getName ( ) const
inlineoverridevirtual

Implements Command.

Definition at line 67 of file Command.h.

void GenericCommand::execute ( )
inlineoverridevirtual

Implements Command.

Definition at line 71 of file Command.h.

void GenericCommand::unexecute ( )
inlineoverridevirtual

Implements Command.

Definition at line 75 of file Command.h.

Member Data Documentation

QString GenericCommand::m_name
private

Definition at line 80 of file Command.h.

std::function<void()> GenericCommand::m_execute
private

Definition at line 81 of file Command.h.

std::function<void()> GenericCommand::m_unexecute
private

Definition at line 82 of file Command.h.

std::function<void()> GenericCommand::m_onDelete
private

Definition at line 83 of file Command.h.


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