LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdnetsignaladd.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_PROJECT_CMDNETSIGNALADD_H
21 #define LIBREPCB_PROJECT_CMDNETSIGNALADD_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 #include <optional/tl/optional.hpp>
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace project {
37 
38 class Circuit;
39 class NetClass;
40 class NetSignal;
41 
42 /*******************************************************************************
43  * Class CmdNetSignalAdd
44  ******************************************************************************/
45 
49 class CmdNetSignalAdd final : public UndoCommand {
50 public:
51  // Constructors / Destructor
53  Circuit& circuit, NetClass& netclass,
54  const tl::optional<CircuitIdentifier>& name = tl::nullopt) noexcept;
55  ~CmdNetSignalAdd() noexcept;
56 
57  // Getters
58  NetSignal* getNetSignal() const noexcept { return mNetSignal; }
59 
60 private:
61  // Private Methods
62 
64  bool performExecute() override;
65 
67  void performUndo() override;
68 
70  void performRedo() override;
71 
72  // Private Member Variables
73 
76  tl::optional<CircuitIdentifier> mName;
78 };
79 
80 /*******************************************************************************
81  * End of File
82  ******************************************************************************/
83 
84 } // namespace project
85 } // namespace librepcb
86 
87 #endif // LIBREPCB_PROJECT_CMDNETSIGNALADD_H
The Circuit class represents all electrical connections in a project (drawed in the schematics) ...
Definition: circuit.h:72
NetClass & mNetClass
Definition: cmdnetsignaladd.h:75
~CmdNetSignalAdd() noexcept
Definition: cmdnetsignaladd.cpp:50
The CmdNetSignalAdd class.
Definition: cmdnetsignaladd.h:49
tl::optional< CircuitIdentifier > mName
Definition: cmdnetsignaladd.h:76
bool performExecute() override
Execute the command the first time.
Definition: cmdnetsignaladd.cpp:57
void performRedo() override
Redo the command.
Definition: cmdnetsignaladd.cpp:76
The NetClass class.
Definition: netclass.h:52
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:47
NetSignal * getNetSignal() const noexcept
Definition: cmdnetsignaladd.h:58
void performUndo() override
Undo the command.
Definition: cmdnetsignaladd.cpp:72
The NetSignal class.
Definition: netsignal.h:56
NetSignal * mNetSignal
Definition: cmdnetsignaladd.h:77
CmdNetSignalAdd(Circuit &circuit, NetClass &netclass, const tl::optional< CircuitIdentifier > &name=tl::nullopt) noexcept
Definition: cmdnetsignaladd.cpp:40
Circuit & mCircuit
Definition: cmdnetsignaladd.h:74