LibrePCB Developers Documentation
cmdpackagepadedit.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_EDITOR_CMDPACKAGEPADEDIT_H
21 #define LIBREPCB_EDITOR_CMDPACKAGEPADEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../cmd/cmdlistelementinsert.h"
27 #include "../../cmd/cmdlistelementremove.h"
28 #include "../../cmd/cmdlistelementsswap.h"
29 #include "../../undocommand.h"
30 
32 
33 #include <QtCore>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 namespace editor {
40 
41 /*******************************************************************************
42  * Class CmdPackagePadEdit
43  ******************************************************************************/
44 
48 class CmdPackagePadEdit final : public UndoCommand {
49 public:
50  // Constructors / Destructor
51  CmdPackagePadEdit() = delete;
52  CmdPackagePadEdit(const CmdPackagePadEdit& other) = delete;
53  explicit CmdPackagePadEdit(PackagePad& pad) noexcept;
54  ~CmdPackagePadEdit() noexcept;
55 
56  // Setters
57  void setName(const CircuitIdentifier& name) noexcept;
58 
59  // Operator Overloadings
60  CmdPackagePadEdit& operator=(const CmdPackagePadEdit& rhs) = delete;
61 
62 private:
63  // Private Methods
64 
66  bool performExecute() override;
67 
69  void performUndo() override;
70 
72  void performRedo() override;
73 
74  // Private Member Variables
75 
76  // Attributes from the constructor
78 
79  // General Attributes
82 };
83 
84 /*******************************************************************************
85  * Undo Commands
86  ******************************************************************************/
87 
88 using CmdPackagePadInsert =
91 using CmdPackagePadRemove =
92  CmdListElementRemove<PackagePad, PackagePadListNameProvider,
94 using CmdPackagePadsSwap =
95  CmdListElementsSwap<PackagePad, PackagePadListNameProvider,
97 
98 /*******************************************************************************
99  * End of File
100  ******************************************************************************/
101 
102 } // namespace editor
103 } // namespace librepcb
104 
105 #endif
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:47
Event
Definition: packagepad.h:52
Definition: occmodel.cpp:77
PackagePad & mPad
Definition: cmdpackagepadedit.h:77
The CmdPackagePadEdit class.
Definition: cmdpackagepadedit.h:48
~CmdPackagePadEdit() noexcept
Definition: cmdpackagepadedit.cpp:44
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: packagepad.h:98
CmdPackagePadEdit & operator=(const CmdPackagePadEdit &rhs)=delete
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96
bool performExecute() override
Execute the command the first time.
Definition: cmdpackagepadedit.cpp:60
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
void performRedo() override
Redo the command.
Definition: cmdpackagepadedit.cpp:71
void setName(const CircuitIdentifier &name) noexcept
Definition: cmdpackagepadedit.cpp:51
CircuitIdentifier mNewName
Definition: cmdpackagepadedit.h:81
CircuitIdentifier mOldName
Definition: cmdpackagepadedit.h:80
void performUndo() override
Undo the command.
Definition: cmdpackagepadedit.cpp:67