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_LIBRARY_CMDFOOTPRINTEDIT_H
21 #define LIBREPCB_LIBRARY_CMDFOOTPRINTEDIT_H
22 
23 /*******************************************************************************
24  *  Includes
25  ******************************************************************************/
26 #include <librepcb/common/elementname.h>
27 #include <librepcb/common/undocommand.h>
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  *  Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 
37 class Footprint;
38 
39 /*******************************************************************************
40  *  Class CmdFootprintEdit
41  ******************************************************************************/
42 
43 /**
44  * @brief The CmdFootprintEdit class
45  */
46 class CmdFootprintEdit final : public UndoCommand {
47 public:
48   // Constructors / Destructor
49   CmdFootprintEdit() = delete;
50   CmdFootprintEdit(const CmdFootprintEdit& other) = delete;
51   explicit CmdFootprintEdit(Footprint& fpt) noexcept;
52   ~CmdFootprintEdit() noexcept;
53 
54   // Setters
55   void setName(const ElementName& name) noexcept;
56 
57   // Operator Overloadings
58   CmdFootprintEdit& operator=(const CmdFootprintEdit& rhs) = delete;
59 
60 private:
61   // Private Methods
62 
63   /// @copydoc UndoCommand::performExecute()
64   bool performExecute() override;
65 
66   /// @copydoc UndoCommand::performUndo()
67   void performUndo() override;
68 
69   /// @copydoc UndoCommand::performRedo()
70   void performRedo() override;
71 
72   // Private Member Variables
73 
74   // Attributes from the constructor
75   Footprint& mFootprint;
76 
77   // General Attributes
78   ElementName mOldName;
79   ElementName mNewName;
80 };
81 
82 /*******************************************************************************
83  *  End of File
84  ******************************************************************************/
85 
86 }  // namespace library
87 }  // namespace librepcb
88 
89 #endif  // LIBREPCB_LIBRARY_CMDFOOTPRINTEDIT_H
90