Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::Cmd::Command Class Reference

Base command class. More...

#include <Command.h>

Inheritance diagram for TSE3::Cmd::Command:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~Command ()
void execute ()
void undo ()
const std::string & title () const
bool undoable () const
bool done () const

Protected Member Functions

 Command (const std::string &title, bool undoable=true)
virtual void executeImpl ()=0
virtual void undoImpl ()=0
void setTitle (const std::string &title)

Detailed Description

Base command class.

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.

Author:
Pete Goodliffe
Version:
3.00


Constructor & Destructor Documentation

virtual TSE3::Cmd::Command::~Command  )  [inline, virtual]
 

TSE3::Cmd::Command::Command const std::string &  title,
bool  undoable = true
[inline, 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:
title Name for Command
undoable Whether the Command is undoable


Member Function Documentation

void TSE3::Cmd::Command::execute  )  [inline]
 

Call this to execute the Command.

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

See also:
undo

void TSE3::Cmd::Command::undo  )  [inline]
 

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& TSE3::Cmd::Command::title  )  const [inline]
 

Returns a descriptive string for the command.

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

bool TSE3::Cmd::Command::undoable  )  const [inline]
 

Returns whether this Command is capable of being undone.

bool TSE3::Cmd::Command::done  )  const [inline]
 

Returns whether this command has been executed.

See also:
execute

undo

virtual void TSE3::Cmd::Command::executeImpl  )  [protected, pure virtual]
 

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

Implemented in TSE3::Cmd::VariableSetCommand< cls_type, arg_type, param_type, getmfn, setmfn >, TSE3::Cmd::CommandGroup, TSE3::Cmd::FlagTrack_Add, TSE3::Cmd::Part_SetInfo, TSE3::Cmd::Part_SetPhrase, TSE3::Cmd::Part_Move, TSE3::Cmd::Phrase_SetInfo, TSE3::Cmd::Phrase_Create, TSE3::Cmd::Phrase_Erase, TSE3::Cmd::Phrase_Replace, TSE3::Cmd::Song_SetInfo, TSE3::Cmd::Song_InsertTrack, TSE3::Cmd::Song_RemoveTrack, TSE3::Cmd::Song_SoloTrack, TSE3::Cmd::Track_SetInfo, TSE3::Cmd::Track_Snip, TSE3::Cmd::Track_Glue, TSE3::Cmd::Track_RemovePart, TSE3::Cmd::Track_Sort, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::copyright,&TSE3::Song::setCopyright >, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::date,&TSE3::Song::setDate >, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::title,&TSE3::Song::setTitle >, and TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::author,&TSE3::Song::setAuthor >.

virtual void TSE3::Cmd::Command::undoImpl  )  [protected, pure virtual]
 

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

Implemented in TSE3::Cmd::VariableSetCommand< cls_type, arg_type, param_type, getmfn, setmfn >, TSE3::Cmd::CommandGroup, TSE3::Cmd::FlagTrack_Add, TSE3::Cmd::Part_SetInfo, TSE3::Cmd::Part_SetPhrase, TSE3::Cmd::Part_Move, TSE3::Cmd::Phrase_SetInfo, TSE3::Cmd::Phrase_Create, TSE3::Cmd::Phrase_Erase, TSE3::Cmd::Phrase_Replace, TSE3::Cmd::Song_SetInfo, TSE3::Cmd::Song_InsertTrack, TSE3::Cmd::Song_RemoveTrack, TSE3::Cmd::Song_SoloTrack, TSE3::Cmd::Track_SetInfo, TSE3::Cmd::Track_Snip, TSE3::Cmd::Track_Glue, TSE3::Cmd::Track_RemovePart, TSE3::Cmd::Track_Sort, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::copyright,&TSE3::Song::setCopyright >, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::date,&TSE3::Song::setDate >, TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::title,&TSE3::Song::setTitle >, and TSE3::Cmd::VariableSetCommand< TSE3::Song, std::string, const std::string &,&TSE3::Song::author,&TSE3::Song::setAuthor >.

void TSE3::Cmd::Command::setTitle const std::string &  title  )  [inline, protected]
 

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


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:47:32 2005 for TSE3 by doxygen 1.3.2