Class: TCommandBinding

Declaration: BasicDocumentCommand.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TAbstractDocumentComponentCommandBinding TToolCommandBinding

Purpose:

Provides an abstract base class for binding commands to targets. Command bindings bind an instance of a command to an instance of a target. Command bindings may be captured for histories, collaboration, etc.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Derive from TCommandBinding to create concrete command binding classes that bind commands to specific types of targets. Derived classes must override the pure virtual functions: Do, DoBegin, DoIncrement, DoEnd, Undo, Redo, GetUndoType, CanDo, CanUndo, CanRedo, and Commit. These member functions should delegate to the corresponding member function of TCommnandOn<ATarget>, passing the appropriate target.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Invariants:

None.

Member Function: TCommandBinding::~TCommandBinding

virtual ~ TCommandBinding ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TCommandBinding::Do

virtual void Do ()

Interface Category:

API.

Purpose:

Do a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::DoBegin

virtual void DoBegin ()

Interface Category:

API.

Purpose:

DoBegin a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::DoIncrement

virtual void DoIncrement ()

Interface Category:

API.

Purpose:

DoIncrement a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::DoEnd

virtual void DoEnd ()

Interface Category:

API.

Purpose:

DoEnd on the command previously begin with a bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::Undo

virtual void Undo ()

Interface Category:

API.

Purpose:

Undo a command passing a bound target.

Calling Context:

Call this function directly after a command has been done.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::Redo

virtual void Redo ()

Interface Category:

API.

Purpose:

Redo a command on the bound target.

Calling Context:

Call this function directly after a command has been undone.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::GetUndoType

virtual TCommonCommand::UndoType GetUndoType() const

Interface Category:

API.

Purpose:

Returns a copy of the undo type of the command. The undo type is immutable

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a copy of the undo type of the command.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::CanDo

virtual bool CanDo () const

Interface Category:

API.

Purpose:

Calls CanDo on a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the bound command returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::CanUndo

virtual bool CanUndo () const

Interface Category:

API.

Purpose:

Calls CanUndo on a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the bound command returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::CanRedo

virtual bool CanRedo () const

Interface Category:

API.

Purpose:

Calls CanRedo on a command passing the bound target.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the bound command returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::Commit

virtual void Commit ()

Interface Category:

API.

Purpose:

Commits the command passing the bound target.

Calling Context:

Call this function directly after a command has been, done, undone, redone.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TCommandBinding.

Member Function: TCommandBinding::TCommandBinding

  1. TCommandBinding ()
  2. TCommandBinding (const TCommandBinding &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators only.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

TCommandBinding is an abstract base class--all the constructors are protected. Do not instantiate this class.

Member Function: TCommandBinding::operator=

TCommandBinding & operator =(const TCommandBinding &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

Returns a const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

TCommandBinding is an abstract base class--all the constructors are protected. Do not instantiate this class.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.