CFx SDK Documentation  2023 SP0
Public Types | Public Member Functions | List of all members
OdEdCommandStack Class Referenceabstract

#include <EdCommandStack.h>

Inheritance diagram for OdEdCommandStack:
OdRxObject

Public Types

enum  LookupFlags {
  kGlobal = 0x01 , kLocal = 0x02 , kSpecifedGroup = 0x04 , kUndefed = 0x08 ,
  kThrowUnknown = 0x10
}
 

Public Member Functions

 ODRX_DECLARE_MEMBERS (OdEdCommandStack)
 
virtual void addReactor (OdEdCommandStackReactor *pReactor)=0
 
virtual void removeReactor (OdEdCommandStackReactor *pReactor)=0
 
virtual OdEdCommandStackReactorArray getCommandStackReactors () const =0
 
virtual void addCommand (OdEdCommand *pCommand)=0
 
virtual OdEdCommandaddCommand (const OdString &sGroupName, const OdString &sGlobalName, const OdString &sLocalName, OdUInt32 commandFlags, OdEdCommandFunction *pFunction, OdRxModule *pModule=0)
 
virtual OdRxIteratorPtr newIterator ()=0
 
virtual OdRxIteratorPtr newIterator (const OdString &groupName)=0
 
virtual OdRxIteratorPtr newGroupIterator ()=0
 
virtual OdEdCommandPtr lookupCmd (const OdString &commandName, int lookupFlags=kGlobal|kLocal, const OdString &groupName=OdString::kEmpty)=0
 
virtual void executeCommand (OdEdCommand *pCmd, OdEdCommandContext *pCmdCtx)=0
 
virtual void executeCommand (const OdString &cmdName, OdEdCommandContext *pCmdCtx, int lookupFlags=kGlobal|kLocal, const OdString &groupName=OdString::kEmpty)=0
 
virtual void removeCmd (const OdString &groupName, const OdString &globalName)=0
 
virtual void removeCmd (const OdEdCommand *pCommand)=0
 
virtual void removeGroup (const OdString &groupName)=0
 
virtual OdResult popGroupToTop (const OdString &cmdGroupName)=0
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Additional Inherited Members

- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Detailed Description

This class implements and manages the global command stack.

Remarks
The command stack consists of groups which contain their respective commands. Adding a command adds it to its group. If the group does not exist, the group is first created and pushed onto the top of the stack.

The lookupCommand and executeCommand functions search for command names in the group order on the stack.

In the case of duplicate command names, the most recent one added to the stack is the command that is returned or executed.

The group order may be changed with popGroupToTop function.

Corresponding C++ library: TD_Root

<group OdEd_Classes>

Definition at line 306 of file EdCommandStack.h.

Member Enumeration Documentation

◆ LookupFlags

Enumerator
kGlobal 
kLocal 
kSpecifedGroup 
kUndefed 
kThrowUnknown 

Definition at line 393 of file EdCommandStack.h.

Member Function Documentation

◆ addCommand() [1/2]

virtual OdEdCommand* OdEdCommandStack::addCommand ( const OdString sGroupName,
const OdString sGlobalName,
const OdString sLocalName,
OdUInt32  commandFlags,
OdEdCommandFunction pFunction,
OdRxModule pModule = 0 
)
virtual

Adds the specified command object to this Stack object.

Parameters
pCommand[in] Pointer to the command object.
Remarks
If the group associated with the command does not exist, the group is first created and pushed onto the top of the stack.

The globalName and localName must be unique within the groupName of this command object.

◆ addCommand() [2/2]

virtual void OdEdCommandStack::addCommand ( OdEdCommand pCommand)
pure virtual

Adds the specified command object to this Stack object.

Parameters
pCommand[in] Pointer to the command object.
Remarks
If the group associated with the command does not exist, the group is first created and pushed onto the top of the stack.

The globalName and localName must be unique within the groupName of this command object.

◆ addReactor()

virtual void OdEdCommandStack::addReactor ( OdEdCommandStackReactor pReactor)
pure virtual

Adds the specified reactor to this object's reactor list.

Parameters
pReactor[in] Pointer to the reactor object.

◆ executeCommand() [1/2]

virtual void OdEdCommandStack::executeCommand ( const OdString cmdName,
OdEdCommandContext pCmdCtx,
int  lookupFlags = kGlobal|kLocal,
const OdString groupName = OdString::kEmpty 
)
pure virtual

Executes the specified command in this Stack object.

Parameters
cmdName[in] Name of the command to find.
pCmdCtx[in] Pointer to the command context.
lookupFlags[in] Specified where command lookup is to look.
groupName[in] Group name.
Remarks
Lookups a command object registred in this Stack object by a cpecified cmdName, lookupFlags and groupName and executes it. If command was not found then method fires OdEdCommandStackReactor::unknownCommand() event that may provide back a command object for the given name. So if a command object was provided by one of the reactors then implementation of this method executs it. If one was provided by neither of the reactors and kThrowUnknown flag was specified in lookupFlags then OdEdUnknownCommand would be thrown. If kThrowUnknown flag was not specified the method just exits.

If groupName is specified, only that group will be searched.

lookupFlags must be a combination of one or more of the following:

Value Description kGlobal 0x01 Search global (untranslated) names. kLocal 0x02 Search local (translated) names. kSpecifedGroup 0x04 Search in specified group only. kUndefed 0x08 Indicates whether or not to return commands that are currently marked as undefined. kThrowUnknown 0x10 Throw OdEdUnknownCommand exception if command was not found.


See also
OdEdCommandStack::lookupCmd, OdEdCommandStackReactor::unknownCommand, OdEdCommand::execute.

◆ executeCommand() [2/2]

virtual void OdEdCommandStack::executeCommand ( OdEdCommand pCmd,
OdEdCommandContext pCmdCtx 
)
pure virtual

Executes the specified command in this Stack object.

Remarks
OdEdCommandStackReactor objects in the reactor list of this Stack object will be notified.
Parameters
pCommand[in] Pointer to the command object to execute.
pCmdCtx[in] Pointer to the command context.
Remarks
The specified command context object is used to interact with the calling application as part of an interactive command.

This function searches for both global and local command names in the group order on the stack.

See also
OdEdCommand::execute.

◆ getCommandStackReactors()

virtual OdEdCommandStackReactorArray OdEdCommandStack::getCommandStackReactors ( ) const
pure virtual

Returns this object's transient reactors.

◆ lookupCmd()

virtual OdEdCommandPtr OdEdCommandStack::lookupCmd ( const OdString commandName,
int  lookupFlags = kGlobal|kLocal,
const OdString groupName = OdString::kEmpty 
)
pure virtual

Returns the OdEdCommand object with the specified name in this Stack object.

Parameters
commandName[in] Name of the command to find.
lookupFlags[in] Specified where command lookup is to look.
groupName[in] Group name.
Returns
Returns a SmartPointer to the OdEdCommand object if successful, otherwise a null SmartPointer.
Remarks
This function searches for command names in the group order on the stack.

If groupName is specified, only that group will be searched.

lookupFlags must be a combination of one or more of the following:

Value Description kGlobal 0x01 Search global (untranslated) names. kLocal 0x02 Search local (translated) names. kSpecifedGroup 0x04 Search in specified group only. kUndefed 0x08 Indicates whether or not to return commands that are currently marked as undefined.

◆ newGroupIterator()

virtual OdRxIteratorPtr OdEdCommandStack::newGroupIterator ( )
pure virtual

Returns an Iterator object that can be used to traverse the group objects in this Stack object.

Remarks
Each group is an OdRxDictionary object.

◆ newIterator() [1/2]

virtual OdRxIteratorPtr OdEdCommandStack::newIterator ( )
pure virtual

Returns an Iterator object that can be used to traverse the OdEdCommand objects in this Stack object.

Remarks
The traversal is by global name in group order.

◆ newIterator() [2/2]

virtual OdRxIteratorPtr OdEdCommandStack::newIterator ( const OdString groupName)
pure virtual

Returns an Iterator object that can be used to traverse the OdEdCommand objects in this Stack object.

Parameters
groupName[in] Group name.
Remarks
If groupName is specified, only OdEdCommand objects in the specified group will be traversed.

◆ ODRX_DECLARE_MEMBERS()

OdEdCommandStack::ODRX_DECLARE_MEMBERS ( OdEdCommandStack  )

◆ popGroupToTop()

virtual OdResult OdEdCommandStack::popGroupToTop ( const OdString cmdGroupName)
pure virtual

This function pops the cmdGroupName command group to the top of the command stack making it the first group to be searched when resolving application defined command names.

Parameters
cmdGroupName[in] Name of the command group to pop to the top of the command stack.
Remarks
If the specified group is not found, this function returns eKeyNotFound.

◆ removeCmd() [1/2]

virtual void OdEdCommandStack::removeCmd ( const OdEdCommand pCommand)
pure virtual

◆ removeCmd() [2/2]

virtual void OdEdCommandStack::removeCmd ( const OdString groupName,
const OdString globalName 
)
pure virtual

Removes the command with the specified group and global names from this Stack object.

Parameters
groupName[in] Group name.
globalName[in] Global (untranslated) name.
Remarks
If a group is emptied, it is removed from this Stack object.

If the specified command is not found, this function does nothing but return.

◆ removeGroup()

virtual void OdEdCommandStack::removeGroup ( const OdString groupName)
pure virtual

Removes the specified group and its commands from this Stack object.

Parameters
groupName[in] Group name.
Remarks
If the specified group is not found, this function does nothing but return.

◆ removeReactor()

virtual void OdEdCommandStack::removeReactor ( OdEdCommandStackReactor pReactor)
pure virtual

Removes the specified transient reactor from this object's reactor list.

Parameters
pReactor[in] Pointer to the reactor object.

The documentation for this class was generated from the following file: