LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ercmsglist.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_ERCMSGLIST_H
21 #define LIBREPCB_PROJECT_ERCMSGLIST_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace project {
37 
38 class Project;
39 class ErcMsg;
40 
41 /*******************************************************************************
42  * Class ErcMsgList
43  ******************************************************************************/
44 
49 class ErcMsgList final : public QObject, public SerializableObject {
50  Q_OBJECT
51 
52 public:
53  // Constructors / Destructor
54  ErcMsgList() = delete;
55  ErcMsgList(const ErcMsgList& other) = delete;
56  explicit ErcMsgList(Project& project);
57  ~ErcMsgList() noexcept;
58 
59  // Getters
60  const QList<ErcMsg*>& getItems() const noexcept { return mItems; }
61 
62  // General Methods
63  void add(ErcMsg* ercMsg) noexcept;
64  void remove(ErcMsg* ercMsg) noexcept;
65  void update(ErcMsg* ercMsg) noexcept;
66  void restoreIgnoreState();
67  void save();
68 
69  // Operator Overloadings
70  ErcMsgList& operator=(const ErcMsgList& rhs) = delete;
71 
72 signals:
73 
74  void ercMsgAdded(ErcMsg* ercMsg);
75  void ercMsgRemoved(ErcMsg* ercMsg);
76  void ercMsgChanged(ErcMsg* ercMsg);
77 
78 private: // Methods
80  void serialize(SExpression& root) const override;
81 
82  // General
84 
85  // Misc
86  QList<ErcMsg*> mItems;
87 };
88 
89 /*******************************************************************************
90  * End of File
91  ******************************************************************************/
92 
93 } // namespace project
94 } // namespace librepcb
95 
96 #endif // LIBREPCB_PROJECT_ERCMSGLIST_H
~ErcMsgList() noexcept
Definition: ercmsglist.cpp:47
The ErcMsg class represents a message in the ERC (Electrical Rule Check) list.
Definition: ercmsg.h:46
void ercMsgRemoved(ErcMsg *ercMsg)
const QList< ErcMsg * > & getItems() const noexcept
Definition: ercmsglist.h:60
The ErcMsgList class contains a list of ERC messages which are visible for the user.
Definition: ercmsglist.h:49
The Project class represents a whole (opened) project with all its content.
Definition: project.h:79
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:43
QList< ErcMsg * > mItems
contains all visible ERC messages
Definition: ercmsglist.h:86
void ercMsgChanged(ErcMsg *ercMsg)
void restoreIgnoreState()
Definition: ercmsglist.cpp:78
void ercMsgAdded(ErcMsg *ercMsg)
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: ercmsglist.cpp:114
void add(ErcMsg *ercMsg) noexcept
Definition: ercmsglist.cpp:55
void update(ErcMsg *ercMsg) noexcept
Definition: ercmsglist.cpp:71
void save()
Definition: ercmsglist.cpp:104
Project & mProject
Definition: ercmsglist.h:83
ErcMsgList & operator=(const ErcMsgList &rhs)=delete
The SExpression class.
Definition: sexpression.h:57