LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdcomponentedit.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_LIBRARY_CMDCOMPONENTEDIT_H
21 #define LIBREPCB_LIBRARY_CMDCOMPONENTEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../cmd/cmdlibraryelementedit.h"
27 #include "../component.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 
37 /*******************************************************************************
38  * Class CmdComponentEdit
39  ******************************************************************************/
40 
45 public:
46  // Constructors / Destructor
47  CmdComponentEdit() = delete;
48  CmdComponentEdit(const CmdComponentEdit& other) = delete;
49  explicit CmdComponentEdit(Component& component) noexcept;
50  virtual ~CmdComponentEdit() noexcept;
51 
52  // Setters
53  void setIsSchematicOnly(bool schematicOnly) noexcept;
54  void setDefaultValue(const QString& value) noexcept;
55  void setPrefix(const QString& norm, const ComponentPrefix& prefix) noexcept;
56  void setPrefixes(const NormDependentPrefixMap& prefixes) noexcept;
57  void setAttributes(const AttributeList& attributes) noexcept;
58 
59  // Operator Overloadings
60  CmdComponentEdit& operator=(const CmdComponentEdit& rhs) = delete;
61 
62 protected: // Methods
64  virtual bool performExecute() override;
65 
67  virtual void performUndo() override;
68 
70  virtual void performRedo() override;
71 
72 private: // Data
74 
83 };
84 
85 /*******************************************************************************
86  * End of File
87  ******************************************************************************/
88 
89 } // namespace library
90 } // namespace librepcb
91 
92 #endif // LIBREPCB_LIBRARY_CMDCOMPONENTEDIT_H
void setAttributes(const AttributeList &attributes) noexcept
Definition: cmdcomponentedit.cpp:79
CmdComponentEdit & operator=(const CmdComponentEdit &rhs)=delete
NormDependentPrefixMap mOldPrefixes
Definition: cmdcomponentedit.h:79
virtual ~CmdComponentEdit() noexcept
Definition: cmdcomponentedit.cpp:50
The CmdComponentEdit class.
Definition: cmdcomponentedit.h:44
virtual void performRedo() override
Redo the command.
Definition: cmdcomponentedit.cpp:105
void setIsSchematicOnly(bool schematicOnly) noexcept
Definition: cmdcomponentedit.cpp:57
virtual void performUndo() override
Undo the command.
Definition: cmdcomponentedit.cpp:97
QString mNewDefaultValue
Definition: cmdcomponentedit.h:78
QString mOldDefaultValue
Definition: cmdcomponentedit.h:77
void setPrefixes(const NormDependentPrefixMap &prefixes) noexcept
Definition: cmdcomponentedit.cpp:73
The CmdLibraryElementEdit class.
Definition: cmdlibraryelementedit.h:44
bool mOldSchematicOnly
Definition: cmdcomponentedit.h:75
void setPrefix(const QString &norm, const ComponentPrefix &prefix) noexcept
Definition: cmdcomponentedit.cpp:67
type_safe::constrained_type< QString, ComponentPrefixConstraint, ComponentPrefixVerifier > ComponentPrefix
Definition: componentprefix.h:77
NormDependentPrefixMap mNewPrefixes
Definition: cmdcomponentedit.h:80
AttributeList mOldAttributes
Definition: cmdcomponentedit.h:81
Component & mComponent
Definition: cmdcomponentedit.h:73
bool mNewSchematicOnly
Definition: cmdcomponentedit.h:76
The Component class represents a "generic" device in the library.
Definition: component.h:73
AttributeList mNewAttributes
Definition: cmdcomponentedit.h:82
void setDefaultValue(const QString &value) noexcept
Definition: cmdcomponentedit.cpp:62
virtual bool performExecute() override
Execute the command the first time.
Definition: cmdcomponentedit.cpp:88