![]() |
ufe 6.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
|
Composite command affecting a batch (selection) of items. For each item run-time, allow the run-time to wrap the execution of the composite commmand with arbitrary prelude and cleanup code. More...
#include <batchCompositeCommand.h>
Public Member Functions | |
BatchCompositeCommand (const BatchCompositeCommand &)=delete | |
const BatchCompositeCommand & | operator= (const BatchCompositeCommand &)=delete |
BatchCompositeCommand (const Selection &selection, const std::string &operationName) | |
Constructor. More... | |
const CodeWrapperContainer & | codeWrappers () const |
Retrieves the container of code-wrappers, one per run-time found in the selection. More... | |
void | execute () override |
Wraps execution of sub-command with the command wrappers. More... | |
void | undo () override |
Wraps undoing of sub-command with the command wrappers. More... | |
void | redo () override |
Wraps redoing of sub-command with the command wrappers. More... | |
![]() | |
CompositeUndoableCommand () | |
Constructors. More... | |
CompositeUndoableCommand (std::initializer_list< Ptr > undoableCommands) | |
CompositeUndoableCommand (const std::list< Ptr > &undoableCommands) | |
CompositeUndoableCommand (const Ptr &undoableCommand) | |
~CompositeUndoableCommand () override | |
Destructor. More... | |
void | execute () override |
Calls execute() on each command in the list, in forward order. More... | |
void | undo () override |
Calls undo() on each command in the list, in reverse order. More... | |
void | redo () override |
Calls redo() on each command in the list, in forward order. More... | |
void | append (const Ptr &cmd) |
Append the argument to the list of commands. More... | |
const CmdList & | cmdsList () const |
Returns the list of undoable commands. More... | |
![]() | |
virtual | ~UndoableCommand () |
Destructor. More... | |
virtual std::string | commandString () const |
Get a user friendly string representation of the command. More... | |
virtual void | execute () |
virtual void | undo ()=0 |
virtual void | redo ()=0 |
Static Public Member Functions | |
static std::shared_ptr< BatchCompositeCommand > | create (const Selection &selection, const std::string &operationName) |
Creates a BatchCompositeCommand. More... | |
![]() | |
static std::shared_ptr< CompositeUndoableCommand > | create (std::initializer_list< Ptr > undoableCommands) |
static std::shared_ptr< CompositeUndoableCommand > | create (const std::list< Ptr > &undoableCommands) |
static std::shared_ptr< CompositeUndoableCommand > | create (const Ptr &undoableCommand) |
Static Public Attributes | |
static const std::string | execSubOp |
The sub-operations for the code wrappers associated with the execute, undo and redo. More... | |
static const std::string | undoSubOp |
static const std::string | redoSubOp |
Private Attributes | |
CodeWrapperContainer | fWrappers |
Additional Inherited Members | |
![]() | |
typedef std::list< Ptr > | CmdList |
![]() | |
typedef std::shared_ptr< UndoableCommand > | Ptr |
![]() | |
UndoableCommand () | |
Constructor. More... | |
UndoableCommand (const UndoableCommand &)=delete | |
Deleting copy constructor. More... | |
Composite command affecting a batch (selection) of items. For each item run-time, allow the run-time to wrap the execution of the composite commmand with arbitrary prelude and cleanup code.
Intended usage of the class in this file and in codeWrapperContext:
BatchCompositeCommand Holds wrappers to do prelude and cleanup around the execution, undoing or redoing of a composite command.
CodeWrapperContext (from codeWrapperContext.h) Supports the prelude and cleanup when executing sub-commands before adding them to a composite command.
The necessity of two classes is to support the two coding patterns when creating a composite command:
- Creating all sub-commands and adding them to the composite without executing them, and then executing the whole composite command. - Creating all sub-commands and executing them immediately *before* adding them to the composite command and *not* executing the composite command.
So, if the sub-commands are all created but not executed and are added to the composite command, then the composite command will automatically do the prelude and cleanup and thus, with this coding pattern, the context class is not needed. In pseudo-code:
auto composite = new BatchCompositeCommand(selection, "op-name") for each sub-command: auto subCmd = new SomeOtherUfeCommand(); composite->append(subCmd); composite->execute()
In contrast, if the individual sub-commands are executed before adding them to the composite command, then the context class must be used in order for these individually-executed commands to be properly surrounded by the intended prelude and cleanup code. In pseudo-code, the pattern this supports is:
auto composite = new BatchCompositeCommand(selection, "op-name") CodeWrapperContext ctx(composite->codeWrappers(), BatchCompositeCommand::executeSubOperation); for each sub-command: auto subCmd = new SomeOtherUfeCommand(); subCmd->execute() composite->append(subCmd);
Definition at line 72 of file batchCompositeCommand.h.
|
delete |
Ufe::BatchCompositeCommand::BatchCompositeCommand | ( | const Selection & | selection, |
const std::string & | operationName | ||
) |
Constructor.
selection | the selection of items that is affected by the command. |
operationName | the name of the composite command. |
|
inline |
Retrieves the container of code-wrappers, one per run-time found in the selection.
Definition at line 93 of file batchCompositeCommand.h.
|
static |
Creates a BatchCompositeCommand.
selection | the selection of items that is affected by the command. |
operationName | the name of the composite command. |
|
overridevirtual |
Wraps execution of sub-command with the command wrappers.
Reimplemented from Ufe::UndoableCommand.
|
delete |
|
overridevirtual |
Wraps redoing of sub-command with the command wrappers.
Implements Ufe::UndoableCommand.
|
overridevirtual |
Wraps undoing of sub-command with the command wrappers.
Implements Ufe::UndoableCommand.
|
static |
The sub-operations for the code wrappers associated with the execute, undo and redo.
Definition at line 98 of file batchCompositeCommand.h.
|
private |
Definition at line 112 of file batchCompositeCommand.h.
|
static |
Definition at line 100 of file batchCompositeCommand.h.
|
static |
Definition at line 99 of file batchCompositeCommand.h.