LibrePCB Developers Documentation
CmdReplaceDevice Class Referencefinal

The CmdReplaceDevice class. More...

#include <cmdreplacedevice.h>

+ Inheritance diagram for CmdReplaceDevice:
+ Collaboration diagram for CmdReplaceDevice:

Public Member Functions

 CmdReplaceDevice (Workspace &workspace, Board &board, BI_Device &device, const Uuid &newDeviceUuid, const tl::optional< Uuid > &newFootprintUuid) noexcept
 
 ~CmdReplaceDevice () noexcept
 
- Public Member Functions inherited from UndoCommandGroup
 UndoCommandGroup ()=delete
 
 UndoCommandGroup (const UndoCommandGroup &other)=delete
 
 UndoCommandGroup (const QString &text) noexcept
 
virtual ~UndoCommandGroup () noexcept
 
int getChildCount () const noexcept
 
bool appendChild (UndoCommand *cmd)
 Append a new command to the list of child commands. More...
 
UndoCommandGroupoperator= (const UndoCommandGroup &rhs)=delete
 
- Public Member Functions inherited from UndoCommand
 UndoCommand ()=delete
 
 UndoCommand (const UndoCommand &other)=delete
 
 UndoCommand (const QString &text) noexcept
 
virtual ~UndoCommand () noexcept
 
const QString & getText () const noexcept
 
bool wasEverExecuted () const noexcept
 This method shows whether that command was ever executed (execute() called successfully) More...
 
bool wasEverReverted () const noexcept
 This method shows whether that command was ever reverted (undo() called at least one time) More...
 
bool isCurrentlyExecuted () const noexcept
 This method shows whether that command is currently executed (redo() called one time more than undo()) More...
 
virtual bool execute () final
 Execute the command (must only be called once) More...
 
virtual void undo () final
 Undo the command. More...
 
virtual void redo () final
 Redo the command. More...
 
UndoCommandoperator= (const UndoCommand &rhs)=delete
 

Private Member Functions

bool performExecute () override
 Execute the command the first time. More...
 

Private Attributes

WorkspacemWorkspace
 
BoardmBoard
 
BI_DevicemDeviceInstance
 
Uuid mNewDeviceUuid
 
tl::optional< UuidmNewFootprintUuid
 

Additional Inherited Members

- Protected Member Functions inherited from UndoCommandGroup
virtual bool performExecute () override
 Execute the command the first time. More...
 
virtual void performUndo () override
 Undo the command. More...
 
virtual void performRedo () override
 Redo the command. More...
 
virtual void performPostExecution () noexcept
 Perform custom actions after modifying the undo stack state. More...
 
void execNewChildCmd (UndoCommand *cmd)
 Helper method for derived classes to execute and add new child commands. More...
 
virtual bool performExecute ()=0
 Execute the command the first time. More...
 
virtual void performUndo ()=0
 Undo the command. More...
 
virtual void performRedo ()=0
 Redo the command. More...
 

Detailed Description

The CmdReplaceDevice class.

Constructor & Destructor Documentation

◆ CmdReplaceDevice()

CmdReplaceDevice ( Workspace workspace,
Board board,
BI_Device device,
const Uuid newDeviceUuid,
const tl::optional< Uuid > &  newFootprintUuid 
)
noexcept

◆ ~CmdReplaceDevice()

~CmdReplaceDevice ( )
noexcept

Member Function Documentation

◆ performExecute()

bool performExecute ( )
overrideprivatevirtual

Execute the command the first time.

Note
This method must be implemented in all derived classes. If the first time execution is exactly identical to an "redo" action, you can simple call librepcb::editor::UndoCommand::performRedo() in the implementation of this method.
Return values
trueIf the command has done some changes
falseIf the command has done nothing (the command can be deleted)

Reimplemented from UndoCommandGroup.

+ Here is the call graph for this function:

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mBoard

Board& mBoard
private

◆ mDeviceInstance

BI_Device& mDeviceInstance
private

◆ mNewDeviceUuid

Uuid mNewDeviceUuid
private

◆ mNewFootprintUuid

tl::optional<Uuid> mNewFootprintUuid
private

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