LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ercmsg.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_ERCMSG_H
21 #define LIBREPCB_PROJECT_ERCMSG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <QtCore>
27 
28 /*******************************************************************************
29  * Namespace / Forward Declarations
30  ******************************************************************************/
31 namespace librepcb {
32 namespace project {
33 
34 class IF_ErcMsgProvider;
35 class ErcMsgList;
36 class Project;
37 
38 /*******************************************************************************
39  * Class ErcMsg
40  ******************************************************************************/
41 
46 class ErcMsg {
47 public:
49  enum class ErcMsgType_t {
50  CircuitError = 0,
54  BoardError,
55  BoardWarning,
56  _Count
57  };
58 
59  // Constructors / Destructor
60  explicit ErcMsg(Project& project, const IF_ErcMsgProvider& owner,
61  const QString& ownerKey, const QString& msgKey,
62  ErcMsg::ErcMsgType_t msgType, const QString& msg = QString());
63  virtual ~ErcMsg() noexcept;
64 
65  // Getters
66  const IF_ErcMsgProvider& getOwner() const noexcept { return mOwner; }
67  const QString& getOwnerKey() const noexcept { return mOwnerKey; }
68  const QString& getMsgKey() const noexcept { return mMsgKey; }
69  ErcMsgType_t getMsgType() const noexcept { return mMsgType; }
70  const QString& getMsg() const noexcept { return mMsg; }
71  bool isVisible() const noexcept { return mIsVisible; }
72  bool isIgnored() const noexcept { return mIsIgnored; }
73 
74  // Setters
75  void setMsg(const QString& msg) noexcept;
76  void setVisible(bool visible) noexcept;
77  void setIgnored(bool ignored) noexcept;
78 
79 private:
80  // make some methods inaccessible...
81  ErcMsg();
82  ErcMsg(const ErcMsg& other);
83  ErcMsg& operator=(const ErcMsg& rhs);
84 
85  // General
88 
89  // Attributes
91  QString mOwnerKey;
92  QString mMsgKey;
94  QString mMsg;
95 
96  // Misc
97  bool mIsVisible;
98  bool mIsIgnored;
99 };
100 
101 /*******************************************************************************
102  * End of File
103  ******************************************************************************/
104 
105 } // namespace project
106 } // namespace librepcb
107 
108 #endif // LIBREPCB_PROJECT_ERCMSG_H
ErcMsgType_t
ERC message types.
Definition: ercmsg.h:49
The ErcMsg class represents a message in the ERC (Electrical Rule Check) list.
Definition: ercmsg.h:46
bool mIsVisible
Definition: ercmsg.h:97
virtual ~ErcMsg() noexcept
Definition: ercmsg.cpp:54
QString mOwnerKey
Definition: ercmsg.h:91
example: two output pins in the same net
The ErcMsgList class contains a list of ERC messages which are visible for the user.
Definition: ercmsglist.h:49
void setMsg(const QString &msg) noexcept
Definition: ercmsg.cpp:62
The IF_ErcMsgProvider class.
Definition: if_ercmsgprovider.h:59
The Project class represents a whole (opened) project with all its content.
Definition: project.h:79
const IF_ErcMsgProvider & getOwner() const noexcept
Definition: ercmsg.h:66
const IF_ErcMsgProvider & mOwner
Definition: ercmsg.h:90
bool mIsIgnored
Definition: ercmsg.h:98
ErcMsgType_t mMsgType
Definition: ercmsg.h:93
ErcMsgList & mErcMsgList
Definition: ercmsg.h:87
Project & mProject
Definition: ercmsg.h:86
QString mMsg
Definition: ercmsg.h:94
const QString & getMsgKey() const noexcept
Definition: ercmsg.h:68
void setVisible(bool visible) noexcept
Definition: ercmsg.cpp:68
void setIgnored(bool ignored) noexcept
Definition: ercmsg.cpp:80
QString mMsgKey
Definition: ercmsg.h:92
bool isIgnored() const noexcept
Definition: ercmsg.h:72
bool isVisible() const noexcept
Definition: ercmsg.h:71
ErcMsgType_t getMsgType() const noexcept
Definition: ercmsg.h:69
ErcMsg & operator=(const ErcMsg &rhs)
const QString & getOwnerKey() const noexcept
Definition: ercmsg.h:67
const QString & getMsg() const noexcept
Definition: ercmsg.h:70