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 
37 class SmartSExprFile;
38 
39 namespace project {
40 
41 class Project;
42 class ErcMsg;
43 
44 /*******************************************************************************
45  * Class ErcMsgList
46  ******************************************************************************/
47 
52 class ErcMsgList final : public QObject, public SerializableObject {
53  Q_OBJECT
54 
55 public:
56  // Constructors / Destructor
57  ErcMsgList() = delete;
58  ErcMsgList(const ErcMsgList& other) = delete;
59  explicit ErcMsgList(Project& project, bool restore, bool readOnly,
60  bool create);
61  ~ErcMsgList() noexcept;
62 
63  // Getters
64  const QList<ErcMsg*>& getItems() const noexcept { return mItems; }
65 
66  // General Methods
67  void add(ErcMsg* ercMsg) noexcept;
68  void remove(ErcMsg* ercMsg) noexcept;
69  void update(ErcMsg* ercMsg) noexcept;
70  void restoreIgnoreState();
71  bool save(bool toOriginal, QStringList& errors) noexcept;
72 
73  // Operator Overloadings
74  ErcMsgList& operator=(const ErcMsgList& rhs) = delete;
75 
76 signals:
77 
78  void ercMsgAdded(ErcMsg* ercMsg);
79  void ercMsgRemoved(ErcMsg* ercMsg);
80  void ercMsgChanged(ErcMsg* ercMsg);
81 
82 private: // Methods
84  void serialize(SExpression& root) const override;
85 
86  // General
88 
89  // File "circuit/erc.lp"
91  QScopedPointer<SmartSExprFile> mFile;
92 
93  // Misc
94  QList<ErcMsg*> mItems;
95 };
96 
97 /*******************************************************************************
98  * End of File
99  ******************************************************************************/
100 
101 } // namespace project
102 } // namespace librepcb
103 
104 #endif // LIBREPCB_PROJECT_ERCMSGLIST_H
~ErcMsgList() noexcept
Definition: ercmsglist.cpp:58
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:64
The ErcMsgList class contains a list of ERC messages which are visible for the user.
Definition: ercmsglist.h:52
QScopedPointer< SmartSExprFile > mFile
Definition: ercmsglist.h:91
The Project class represents a whole (opened) project with all its content.
Definition: project.h:84
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:46
QList< ErcMsg * > mItems
contains all visible ERC messages
Definition: ercmsglist.h:94
void ercMsgChanged(ErcMsg *ercMsg)
void restoreIgnoreState()
Definition: ercmsglist.cpp:89
FilePath mFilepath
Definition: ercmsglist.h:90
void ercMsgAdded(ErcMsg *ercMsg)
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: ercmsglist.cpp:130
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
bool save(bool toOriginal, QStringList &errors) noexcept
Definition: ercmsglist.cpp:111
void add(ErcMsg *ercMsg) noexcept
Definition: ercmsglist.cpp:66
void update(ErcMsg *ercMsg) noexcept
Definition: ercmsglist.cpp:82
Project & mProject
Definition: ercmsglist.h:87
ErcMsgList & operator=(const ErcMsgList &rhs)=delete
The SExpression class.
Definition: sexpression.h:60