LibrePCB Developers Documentation
Loading...
Searching...
No Matches
electricalrulecheckmessages.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_CORE_ELECTRICALRULECHECKMESSAGES_H
21#define LIBREPCB_CORE_ELECTRICALRULECHECKMESSAGES_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../rulecheck/rulecheckmessage.h"
27#include "../../types/uuid.h"
28
29#include <QtCore>
30
31#include <optional>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Bus;
39class ComponentInstance;
40class ComponentSignalInstance;
41class ComponentSymbolVariantItem;
42class NetClass;
43class NetSignal;
44class SI_BusJunction;
45class SI_NetLine;
46class SI_NetPoint;
47class SI_NetSegment;
48class SI_Symbol;
49class SI_SymbolPin;
50
51/*******************************************************************************
52 * Class ErcMsgBase
53 ******************************************************************************/
54
63 Q_DECLARE_TR_FUNCTIONS(ErcMsgBase)
64
65public:
66 // Constructors / Destructor
67 ErcMsgBase() = delete;
68 explicit ErcMsgBase(Severity severity, const QString& msg,
69 const QString& description,
70 const QString& approvalName) noexcept
71 : RuleCheckMessage(severity, msg, description, approvalName),
72 mSchematic() {}
73 ErcMsgBase(const ErcMsgBase& other) noexcept
74 : RuleCheckMessage(other), mSchematic(other.mSchematic) {}
75 virtual ~ErcMsgBase() noexcept {}
76
77 // Getters
78 const std::optional<Uuid>& getSchematic() const noexcept {
79 return mSchematic;
80 }
81
82protected:
83 bool setLocation(const NetSignal& net) noexcept;
84 bool setLocation(const ComponentInstance& component) noexcept;
85 bool setLocation(const ComponentSignalInstance& signal) noexcept;
86 void setLocation(const SI_Symbol& symbol) noexcept;
87 void setLocation(const SI_SymbolPin& pin) noexcept;
88 bool setLocation(const SI_NetSegment& segment) noexcept;
89 void setLocation(const SI_NetPoint& netPoint) noexcept;
90 void setLocation(const SI_NetLine& netLine) noexcept;
91 void setLocation(const SI_BusJunction& junction) noexcept;
92
93 std::optional<Uuid> mSchematic;
94};
95
96/*******************************************************************************
97 * Class ErcMsgUnusedNetClass
98 ******************************************************************************/
99
103class ErcMsgUnusedNetClass final : public ErcMsgBase {
104 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnusedNetClass)
105
106public:
107 // Constructors / Destructor
109 explicit ErcMsgUnusedNetClass(const NetClass& netClass) noexcept;
111 : ErcMsgBase(other) {}
112 virtual ~ErcMsgUnusedNetClass() noexcept {}
113};
114
115/*******************************************************************************
116 * Class ErcMsgUnusedBus
117 ******************************************************************************/
118
122class ErcMsgUnusedBus final : public ErcMsgBase {
123 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnusedBus)
124
125public:
126 // Constructors / Destructor
127 ErcMsgUnusedBus() = delete;
128 explicit ErcMsgUnusedBus(const Bus& bus) noexcept;
129 ErcMsgUnusedBus(const ErcMsgUnusedBus& other) noexcept : ErcMsgBase(other) {}
130 virtual ~ErcMsgUnusedBus() noexcept {}
131};
132
133/*******************************************************************************
134 * Class ErcMsgOpenNet
135 ******************************************************************************/
136
140class ErcMsgOpenNet final : public ErcMsgBase {
141 Q_DECLARE_TR_FUNCTIONS(ErcMsgOpenNet)
142
143public:
144 // Constructors / Destructor
145 ErcMsgOpenNet() = delete;
146 explicit ErcMsgOpenNet(const NetSignal& net) noexcept;
147 ErcMsgOpenNet(const ErcMsgOpenNet& other) noexcept : ErcMsgBase(other) {}
148 virtual ~ErcMsgOpenNet() noexcept {}
149};
150
151/*******************************************************************************
152 * Class ErcMsgOpenNetInBus
153 ******************************************************************************/
154
158class ErcMsgOpenNetInBus final : public ErcMsgBase {
159 Q_DECLARE_TR_FUNCTIONS(ErcMsgOpenNetInBus)
160
161public:
162 // Constructors / Destructor
164 explicit ErcMsgOpenNetInBus(const Bus& bus,
165 const SI_NetSegment& netSegment) noexcept;
167 : ErcMsgBase(other) {}
168 virtual ~ErcMsgOpenNetInBus() noexcept {}
169};
170
171/*******************************************************************************
172 * Class ErcMsgUnnamedNetInBus
173 ******************************************************************************/
174
178class ErcMsgUnnamedNetInBus final : public ErcMsgBase {
179 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnnamedNetInBus)
180
181public:
182 // Constructors / Destructor
184 explicit ErcMsgUnnamedNetInBus(const Bus& bus,
185 const SI_NetSegment& netSegment) noexcept;
187 : ErcMsgBase(other) {}
188 virtual ~ErcMsgUnnamedNetInBus() noexcept {}
189};
190
191/*******************************************************************************
192 * Class ErcMsgOpenWireInSegment
193 ******************************************************************************/
194
199 Q_DECLARE_TR_FUNCTIONS(ErcMsgOpenWireInSegment)
200
201public:
202 // Constructors / Destructor
204 explicit ErcMsgOpenWireInSegment(const SI_NetSegment& segment,
205 const SI_NetLine& openWire) noexcept;
207 : ErcMsgBase(other) {}
208 virtual ~ErcMsgOpenWireInSegment() noexcept {}
209};
210
211/*******************************************************************************
212 * Class ErcMsgUnconnectedRequiredSignal
213 ******************************************************************************/
214
219 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnconnectedRequiredSignal)
220
221public:
222 // Constructors / Destructor
225 const ComponentSignalInstance& signal) noexcept;
230};
231
232/*******************************************************************************
233 * Class ErcMsgForcedNetSignalNameConflict
234 ******************************************************************************/
235
240 Q_DECLARE_TR_FUNCTIONS(ErcMsgForcedNetSignalNameConflict)
241
242public:
243 // Constructors / Destructor
246 const ComponentSignalInstance& signal) noexcept;
251
252private:
253 static QString getSignalNet(const ComponentSignalInstance& signal) noexcept;
254};
255
256/*******************************************************************************
257 * Class ErcMsgUnplacedRequiredGate
258 ******************************************************************************/
259
264 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnplacedRequiredSymbol)
265
266public:
267 // Constructors / Destructor
270 const ComponentInstance& component,
271 const ComponentSymbolVariantItem& gate) noexcept;
274 virtual ~ErcMsgUnplacedRequiredGate() noexcept {}
275};
276
277/*******************************************************************************
278 * Class ErcMsgUnplacedOptionalGate
279 ******************************************************************************/
280
285 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnplacedOptionalSymbol)
286
287public:
288 // Constructors / Destructor
291 const ComponentInstance& component,
292 const ComponentSymbolVariantItem& gate) noexcept;
295 virtual ~ErcMsgUnplacedOptionalGate() noexcept {}
296};
297
298/*******************************************************************************
299 * Class ErcMsgConnectedPinWithoutWire
300 ******************************************************************************/
301
306 Q_DECLARE_TR_FUNCTIONS(ErcMsgConnectedPinWithoutWire)
307
308public:
309 // Constructors / Destructor
311 explicit ErcMsgConnectedPinWithoutWire(const SI_SymbolPin& pin) noexcept;
313 const ErcMsgConnectedPinWithoutWire& other) noexcept
314 : ErcMsgBase(other) {}
315 virtual ~ErcMsgConnectedPinWithoutWire() noexcept {}
316};
317
318/*******************************************************************************
319 * Class ErcMsgUnconnectedJunction
320 ******************************************************************************/
321
326 Q_DECLARE_TR_FUNCTIONS(ErcMsgUnconnectedJunction)
327
328public:
329 // Constructors / Destructor
331 explicit ErcMsgUnconnectedJunction(const SI_NetPoint& netPoint) noexcept;
332 explicit ErcMsgUnconnectedJunction(const SI_BusJunction& junction) noexcept;
334 : ErcMsgBase(other) {}
335 virtual ~ErcMsgUnconnectedJunction() noexcept {}
336};
337
338/*******************************************************************************
339 * End of File
340 ******************************************************************************/
341
342} // namespace librepcb
343
344#endif
The Bus class.
Definition bus.h:50
The ComponentInstance class.
Definition componentinstance.h:54
The ComponentSignalInstance class.
Definition componentsignalinstance.h:49
The ComponentSymbolVariantItem class represents one symbol of a component symbol variant.
Definition componentsymbolvariantitem.h:54
Base class for all ERC messages.
Definition electricalrulecheckmessages.h:62
std::optional< Uuid > mSchematic
Definition electricalrulecheckmessages.h:93
const std::optional< Uuid > & getSchematic() const noexcept
Definition electricalrulecheckmessages.h:78
virtual ~ErcMsgBase() noexcept
Definition electricalrulecheckmessages.h:75
bool setLocation(const NetSignal &net) noexcept
Definition electricalrulecheckmessages.cpp:50
ErcMsgBase(const ErcMsgBase &other) noexcept
Definition electricalrulecheckmessages.h:73
ErcMsgBase(Severity severity, const QString &msg, const QString &description, const QString &approvalName) noexcept
Definition electricalrulecheckmessages.h:68
The ErcMsgConnectedPinWithoutWire class.
Definition electricalrulecheckmessages.h:305
ErcMsgConnectedPinWithoutWire(const ErcMsgConnectedPinWithoutWire &other) noexcept
Definition electricalrulecheckmessages.h:312
virtual ~ErcMsgConnectedPinWithoutWire() noexcept
Definition electricalrulecheckmessages.h:315
The ErcMsgForcedNetSignalNameConflict class.
Definition electricalrulecheckmessages.h:239
virtual ~ErcMsgForcedNetSignalNameConflict() noexcept
Definition electricalrulecheckmessages.h:250
ErcMsgForcedNetSignalNameConflict(const ErcMsgForcedNetSignalNameConflict &other) noexcept
Definition electricalrulecheckmessages.h:247
static QString getSignalNet(const ComponentSignalInstance &signal) noexcept
Definition electricalrulecheckmessages.cpp:279
The ErcMsgOpenNet class.
Definition electricalrulecheckmessages.h:140
ErcMsgOpenNet(const ErcMsgOpenNet &other) noexcept
Definition electricalrulecheckmessages.h:147
virtual ~ErcMsgOpenNet() noexcept
Definition electricalrulecheckmessages.h:148
The ErcMsgOpenNetInBus class.
Definition electricalrulecheckmessages.h:158
ErcMsgOpenNetInBus(const ErcMsgOpenNetInBus &other) noexcept
Definition electricalrulecheckmessages.h:166
virtual ~ErcMsgOpenNetInBus() noexcept
Definition electricalrulecheckmessages.h:168
The ErcMsgOpenWireInSegment class.
Definition electricalrulecheckmessages.h:198
virtual ~ErcMsgOpenWireInSegment() noexcept
Definition electricalrulecheckmessages.h:208
ErcMsgOpenWireInSegment(const ErcMsgOpenWireInSegment &other) noexcept
Definition electricalrulecheckmessages.h:206
The ErcMsgUnconnectedJunction class.
Definition electricalrulecheckmessages.h:325
ErcMsgUnconnectedJunction(const ErcMsgUnconnectedJunction &other) noexcept
Definition electricalrulecheckmessages.h:333
virtual ~ErcMsgUnconnectedJunction() noexcept
Definition electricalrulecheckmessages.h:335
The ErcMsgUnconnectedRequiredSignal class.
Definition electricalrulecheckmessages.h:218
ErcMsgUnconnectedRequiredSignal(const ErcMsgUnconnectedRequiredSignal &other) noexcept
Definition electricalrulecheckmessages.h:226
virtual ~ErcMsgUnconnectedRequiredSignal() noexcept
Definition electricalrulecheckmessages.h:229
The ErcMsgUnnamedNetInBus class.
Definition electricalrulecheckmessages.h:178
ErcMsgUnnamedNetInBus(const ErcMsgUnnamedNetInBus &other) noexcept
Definition electricalrulecheckmessages.h:186
virtual ~ErcMsgUnnamedNetInBus() noexcept
Definition electricalrulecheckmessages.h:188
The ErcMsgUnplacedOptionalGate class.
Definition electricalrulecheckmessages.h:284
virtual ~ErcMsgUnplacedOptionalGate() noexcept
Definition electricalrulecheckmessages.h:295
ErcMsgUnplacedOptionalGate(const ErcMsgUnplacedOptionalGate &other) noexcept
Definition electricalrulecheckmessages.h:293
The ErcMsgUnplacedRequiredGate class.
Definition electricalrulecheckmessages.h:263
virtual ~ErcMsgUnplacedRequiredGate() noexcept
Definition electricalrulecheckmessages.h:274
ErcMsgUnplacedRequiredGate(const ErcMsgUnplacedRequiredGate &other) noexcept
Definition electricalrulecheckmessages.h:272
The ErcMsgUnusedBus class.
Definition electricalrulecheckmessages.h:122
virtual ~ErcMsgUnusedBus() noexcept
Definition electricalrulecheckmessages.h:130
ErcMsgUnusedBus(const ErcMsgUnusedBus &other) noexcept
Definition electricalrulecheckmessages.h:129
The ErcMsgUnusedNetClass class.
Definition electricalrulecheckmessages.h:103
ErcMsgUnusedNetClass(const ErcMsgUnusedNetClass &other) noexcept
Definition electricalrulecheckmessages.h:110
virtual ~ErcMsgUnusedNetClass() noexcept
Definition electricalrulecheckmessages.h:112
The NetClass class.
Definition netclass.h:47
The NetSignal class.
Definition netsignal.h:50
The RuleCheckMessage class.
Definition rulecheckmessage.h:45
Severity
Message severity type (higher number = higher severity)
Definition rulecheckmessage.h:50
The SI_BusJunction class.
Definition si_busjunction.h:45
The SI_NetLine class.
Definition si_netline.h:64
The SI_NetPoint class.
Definition si_netpoint.h:44
The SI_NetSegment class.
Definition si_netsegment.h:55
The SI_Symbol class.
Definition si_symbol.h:54
The SI_SymbolPin class.
Definition si_symbolpin.h:53
Definition occmodel.cpp:77