LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmdassemblyvariantadd.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_CMDASSEMBLYVARIANTADD_H
21#define LIBREPCB_EDITOR_CMDASSEMBLYVARIANTADD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommand.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Circuit;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdAssemblyVariantAdd
43 ******************************************************************************/
44
48class CmdAssemblyVariantAdd final : public UndoCommand {
49public:
50 // Constructors / Destructor
53 CmdAssemblyVariantAdd(Circuit& circuit, std::shared_ptr<AssemblyVariant> av,
54 std::shared_ptr<AssemblyVariant> copyFromAv,
55 int index = -1) noexcept;
56 ~CmdAssemblyVariantAdd() noexcept;
57
58 // Operator Overloadings
59 CmdAssemblyVariantAdd& operator=(const CmdAssemblyVariantAdd& rhs) = delete;
60
61private: // Methods
63 bool performExecute() override;
64
66 void performUndo() override;
67
69 void performRedo() override;
70
71private: // Data
76 int mIndex;
77};
78
79/*******************************************************************************
80 * End of File
81 ******************************************************************************/
82
83} // namespace editor
84} // namespace librepcb
85
86#endif
The AssemblyVariant class.
Definition assemblyvariant.h:44
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition circuit.h:70
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The CmdAssemblyVariantAdd class.
Definition cmdassemblyvariantadd.h:48
void performRedo() override
Redo the command.
Definition cmdassemblyvariantadd.cpp:93
QList< std::pair< Uuid, int > > mComponentAssemblyOptions
Definition cmdassemblyvariantadd.h:75
Circuit & mCircuit
Definition cmdassemblyvariantadd.h:72
int mIndex
Definition cmdassemblyvariantadd.h:76
CmdAssemblyVariantAdd(const CmdAssemblyVariantAdd &other)=delete
void performUndo() override
Undo the command.
Definition cmdassemblyvariantadd.cpp:75
std::shared_ptr< AssemblyVariant > mAssemblyVariant
Definition cmdassemblyvariantadd.h:73
bool performExecute() override
Execute the command the first time.
Definition cmdassemblyvariantadd.cpp:59
std::shared_ptr< AssemblyVariant > mCopyFromAv
Definition cmdassemblyvariantadd.h:74
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
Definition occmodel.cpp:76
Definition uuid.h:186