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