class Command

Base command class. More...

Contains pure virtuals
Full nameTSE3::Cmd::Command
Definition#include <Command.h>
Inherited byCommandGroup, FlagTrack_Add, Part_Move, Part_SetInfo, Part_SetPhrase, Phrase_Create, Phrase_Erase, Phrase_Replace, Phrase_SetInfo, Song_InsertTrack, Song_RemoveTrack, Song_SetAuthor, Song_SetCopyright, Song_SetDate, Song_SetInfo, Song_SetTitle, Song_SoloTrack, Track_Glue, Track_RemovePart, Track_SetInfo, Track_Snip, Track_Sort, VariableSetCommand
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods


Detailed Description

A base class for implementing the 'Command' design pattern [Gof]

If you are implementing a new Command then inherit publicly from this class, implement the executeImpl() and undoImpl() methods and ensure that your constructor calls the Command protected constructor.

 ~Command ()

~Command

[virtual]

void  execute ()

execute

Call this to execute the Command.

If the Command has already been executed, nothing will happen.

See also: undo

void  undo ()

undo

Call this to undo the Command.

If the Command can't be undone, or it has already been undone, then nothing will happen.

const std::string & title ()

title

[const]

Returns a descriptive string for the command.

The string begins with a lower case letter and is capable of following "Undo " or "Redo ".

bool  undoable ()

undoable

[const]

Returns whether this Command is capable of being undone.

bool  done ()

done

[const]

Returns whether this command has been executed.

See also: execute, undo

 Command (const std::string &title, bool undoable = true)

Command

[protected]

Create a Command with a descriptive string. This must begin with a lower case letter and be capable of following "Undo " or "Redo ".

Parameters:
titleName for Command
undoableWhether the Command is undoable

void  executeImpl ()

executeImpl

[protected pure virtual]

Implementations of Command override this method to implement the execute action.

void  undoImpl ()

undoImpl

[protected pure virtual]

Implementations of Command override this method to implement to undo action.

void  setTitle (const std::string &title)

setTitle

[protected]

Sets the Command title. Normally you will do this in the ctor and never use this.