Command.h header

#include <ew/core/Command.h>

Namespace ew::core

Command class

class ew::core::Command

A reversible mutation of the model. Every user edit is expressed as a Command so the CommandStack can apply and un-apply it to implement undo/redo.

Members

ew::core::Command::Command()=default

Defaulted.

virtual ew::core::Command::~Command()=default

Defaulted.

ew::core::Command::Command(const Command &)=delete

Commands are owned by the stack via pointer: non-copyable and non-movable.

ew::core::Command::Command(Command &&)=delete

Not movable.

Command & ew::core::Command::operator=(const Command &)=delete

Not copyable.

Command & ew::core::Command::operator=(Command &&)=delete

Not movable.

virtual void ew::core::Command::apply()=0

Applies the change; also used to re-apply the command on redo.

virtual void ew::core::Command::undo()=0

Reverses the change previously applied by apply().

virtual QString ew::core::Command::description() const =0

Short, human-readable description for the undo/redo UI (e.g. "Add character").