ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
undoableCommand.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/include/undoableCommand.h"
2#ifndef UFE_UNDOABLECOMMAND_H
3#define UFE_UNDOABLECOMMAND_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14
15#include "sceneItem.h"
16
17#include <memory>
18#include <list>
19#include <initializer_list>
20#include <string>
21
23
24// Forward declarations
25class Connection;
26
28
38{
39public:
40 typedef std::shared_ptr<UndoableCommand> Ptr;
41
44
48 virtual std::string commandString() const { return ""; }
49
52 virtual void execute();
53
54 virtual void undo() = 0;
55 virtual void redo() = 0;
56
57protected:
62};
63
65
75{
76public:
77 typedef std::list<Ptr> CmdList;
78
82 static std::shared_ptr<CompositeUndoableCommand> create(
83 std::initializer_list<Ptr> undoableCommands
84 );
85 static std::shared_ptr<CompositeUndoableCommand> create(
86 const std::list<Ptr>& undoableCommands
87 );
88 static std::shared_ptr<CompositeUndoableCommand> create(
89 const Ptr& undoableCommand
90 );
92
96 CompositeUndoableCommand(std::initializer_list<Ptr> undoableCommands);
97 CompositeUndoableCommand(const std::list<Ptr>& undoableCommands);
98 CompositeUndoableCommand(const Ptr& undoableCommand);
102
104 void execute() override;
105
107 void undo() override;
108
110 void redo() override;
111
113 void append(const Ptr& cmd);
114
116 const CmdList& cmdsList() const;
117
118private:
121
123};
124
126
132{
133public:
134 typedef std::shared_ptr<InsertChildCommand> Ptr;
135
138
141
143 virtual SceneItem::Ptr insertedChild() const = 0;
144};
145
156{
157public:
158 typedef std::shared_ptr<SceneItemResultUndoableCommand> Ptr;
159
162
165
167 virtual SceneItem::Ptr sceneItem() const = 0;
168};
169
178{
179public:
180 typedef std::shared_ptr<ConnectionResultUndoableCommand> Ptr;
181
184
187
189 virtual std::shared_ptr<Connection> connection() const = 0;
190};
191
193
203{
204public:
205 typedef std::shared_ptr<SelectionUndoableCommand> Ptr;
206
210
213
221 virtual SceneItem::Ptr targetItem(const Path& sourcePath) const = 0;
222};
223
224}
225
226#endif /* UFE_UNDOABLECOMMAND_H */
Composite undoable command.
CompositeUndoableCommand(const CompositeUndoableCommand &)=delete
Deleting copy constructor.
CompositeUndoableCommand(const Ptr &undoableCommand)
static std::shared_ptr< CompositeUndoableCommand > create(const Ptr &undoableCommand)
void redo() override
Calls redo() on each command in the list, in forward order.
static std::shared_ptr< CompositeUndoableCommand > create(const std::list< Ptr > &undoableCommands)
void undo() override
Calls undo() on each command in the list, in reverse order.
CompositeUndoableCommand(const std::list< Ptr > &undoableCommands)
const CmdList & cmdsList() const
Returns the list of undoable commands.
static std::shared_ptr< CompositeUndoableCommand > create(std::initializer_list< Ptr > undoableCommands)
void execute() override
Calls execute() on each command in the list, in forward order.
CompositeUndoableCommand(std::initializer_list< Ptr > undoableCommands)
void append(const Ptr &cmd)
Append the argument to the list of commands.
Command that modifies the data model and produces either a new or modified Connection.
~ConnectionResultUndoableCommand() override
Destructor.
std::shared_ptr< ConnectionResultUndoableCommand > Ptr
virtual std::shared_ptr< Connection > connection() const =0
Pure virtual method to retrieve the resulting scene item.
ConnectionResultUndoableCommand()=default
Default constructor.
Command to change the parent of a scene item.
std::shared_ptr< InsertChildCommand > Ptr
InsertChildCommand()=default
Default constructor.
virtual SceneItem::Ptr insertedChild() const =0
Pure virtual method to retrieve the reparented scene item.
~InsertChildCommand() override
Destructor.
Identify an object or 3D path in the scene.
Definition: path.h:40
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:45
Command that modifies the data model and produces either a new or modified SceneItem.
~SceneItemResultUndoableCommand() override
Destructor.
SceneItemResultUndoableCommand()=default
Default constructor.
std::shared_ptr< SceneItemResultUndoableCommand > Ptr
virtual SceneItem::Ptr sceneItem() const =0
Pure virtual method to retrieve the resulting scene item.
Command that handles a selection.
std::shared_ptr< SelectionUndoableCommand > Ptr
virtual SceneItem::Ptr targetItem(const Path &sourcePath) const =0
~SelectionUndoableCommand() override
Destructor.
Abstract base class for undoable commands.
virtual void undo()=0
virtual std::string commandString() const
Get a user friendly string representation of the command.
UndoableCommand()
Constructor.
std::shared_ptr< UndoableCommand > Ptr
virtual void execute()
UndoableCommand(const UndoableCommand &)=delete
Deleting copy constructor.
virtual ~UndoableCommand()
Destructor.
virtual void redo()=0
std::string string(const Path &path)
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35