Web Analytics Made Easy - Statcounter
Skip to content

Class SBCUndoCommand#

ClassList > SBCUndoCommand

This class is the base class of all commands that can undergo undo and redo operations. More...

  • #include <SBCUndoCommand.hpp>

Inherited by the following classes: SBCUndoCommandGroup

Public Functions#

Type Name
virtual std::string getName () const
Returns the undo command's name.
SBCUndoCommand * getParent () const
Returns the undo command's parent.
virtual bool isCommand () const
Returns whether it is an undo command - returns true __
virtual bool isCommandGroup () const
Returns whether it is an undo command group - returns false __
bool isDone () const
Returns whether the undo command is done.
virtual void print (unsigned int offset=0) const
Prints debugging information.
virtual ~SBCUndoCommand ()
Destructs the undo command.

Protected Attributes#

Type Name
SBCUndoCommandData * dataPointer
A pointer to the private data.

Protected Functions#

Type Name
SBCUndoCommand ()
Protected constructor.
SBCUndoCommand (SBCUndoCommandData * dataPointer)
Protected constructor.
virtual void addChild (SBCUndoCommand * undoCommand)
Adds a child undo command to an undo command group, does nothing for an undo command.
virtual unsigned int getNumberOfCommands () const
Returns the number of undo commands in an undo command group or 1 for an undo command.
virtual void redo ()
Redo the operation.
virtual void undo ()
Undo the operation.

Detailed Description#

Short name: SBUndoCommand

Public Functions Documentation#

function getName#

Returns the undo command's name.

virtual std::string SBCUndoCommand::getName () const

Returns the name of this command.

Returns:

The name of the command as a string.


function getParent#

Returns the undo command's parent.

SBCUndoCommand * SBCUndoCommand::getParent () const

Returns the parent command of this command, or nullptr if none.

Returns:

Pointer to the parent SBCUndoCommand, or nullptr.


function isCommand#

Returns whether it is an undo command - returns true __

virtual bool SBCUndoCommand::isCommand () const

Indicates whether this object represents an undo command.

Returns:

true if it is an undo command.


function isCommandGroup#

Returns whether it is an undo command group - returns false __

virtual bool SBCUndoCommand::isCommandGroup () const

Indicates whether this command is a command group.

Returns:

true if it is a command group, false otherwise.


function isDone#

Returns whether the undo command is done.

bool SBCUndoCommand::isDone () const

Returns whether this command has been executed (done).

Returns:

true if the command is done, otherwise false.


function print#

Prints debugging information.

virtual void SBCUndoCommand::print (
    unsigned int offset=0
) const

Prints debugging information for this command with the given indentation offset.

Parameters:

  • offset Number of tabs to indent before printing.

function ~SBCUndoCommand#

Destructs the undo command.

virtual SBCUndoCommand::~SBCUndoCommand () 

Destroys the SBCUndoCommand object and releases its resources.


Protected Attributes Documentation#

variable dataPointer#

A pointer to the private data.

SBCUndoCommandData* SBCUndoCommand::dataPointer;


Protected Functions Documentation#

function SBCUndoCommand [1/2]#

Protected constructor.

SBCUndoCommand::SBCUndoCommand () 

Constructs a new SBCUndoCommand object.

Initializes the command and its private data.


function SBCUndoCommand [2/2]#

Protected constructor.

SBCUndoCommand::SBCUndoCommand (
    SBCUndoCommandData * dataPointer
) 

Constructs a new SBCUndoCommand object with the given private data pointer.

Parameters:

  • dataPointer Pointer to the private data structure for the command.

function addChild#

Adds a child undo command to an undo command group, does nothing for an undo command.

virtual void SBCUndoCommand::addChild (
    SBCUndoCommand * undoCommand
) 

Adds a child command to this command group.

Parameters:

  • undoCommand Pointer to the child command to add. Does nothing for a simple command.

function getNumberOfCommands#

Returns the number of undo commands in an undo command group or 1 for an undo command.

virtual unsigned int SBCUndoCommand::getNumberOfCommands () const

Returns the number of commands represented by this command.

Returns:

The number of commands. For a simple command this is 1.


function redo#

Redo the operation.

virtual void SBCUndoCommand::redo () 

Performs the redo operation of this command.


function undo#

Undo the operation.

virtual void SBCUndoCommand::undo () 

Performs the undo operation of this command.