LibrePCB Developers Documentation
symbolcheckmessages.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_SYMBOLCHECKMESSAGES_H
21 #define LIBREPCB_CORE_SYMBOLCHECKMESSAGES_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../rulecheck/rulecheckmessage.h"
27 #include "../../types/length.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class Layer;
37 class SymbolPin;
38 class Text;
39 
40 /*******************************************************************************
41  * Class MsgDuplicatePinName
42  ******************************************************************************/
43 
47 class MsgDuplicatePinName final : public RuleCheckMessage {
48  Q_DECLARE_TR_FUNCTIONS(MsgDuplicatePinName)
49 
50 public:
51  // Constructors / Destructor
52  MsgDuplicatePinName() = delete;
53  explicit MsgDuplicatePinName(const SymbolPin& pin) noexcept;
55  : RuleCheckMessage(other) {}
56  virtual ~MsgDuplicatePinName() noexcept {}
57 };
58 
59 /*******************************************************************************
60  * Class MsgMissingSymbolName
61  ******************************************************************************/
62 
66 class MsgMissingSymbolName final : public RuleCheckMessage {
67  Q_DECLARE_TR_FUNCTIONS(MsgMissingSymbolName)
68 
69 public:
70  // Constructors / Destructor
71  MsgMissingSymbolName() noexcept;
73  : RuleCheckMessage(other) {}
74  virtual ~MsgMissingSymbolName() noexcept {}
75 };
76 
77 /*******************************************************************************
78  * Class MsgMissingSymbolValue
79  ******************************************************************************/
80 
85  Q_DECLARE_TR_FUNCTIONS(MsgMissingSymbolValue)
86 
87 public:
88  // Constructors / Destructor
89  MsgMissingSymbolValue() noexcept;
91  : RuleCheckMessage(other) {}
92  virtual ~MsgMissingSymbolValue() noexcept {}
93 };
94 
95 /*******************************************************************************
96  * Class MsgNonFunctionalSymbolPinInversionSign
97  ******************************************************************************/
98 
103  Q_DECLARE_TR_FUNCTIONS(MsgNonFunctionalSymbolPinInversionSign)
104 
105 public:
106  // Constructors / Destructor
109  std::shared_ptr<const SymbolPin> pin) noexcept;
111  const MsgNonFunctionalSymbolPinInversionSign& other) noexcept
112  : RuleCheckMessage(other), mPin(other.mPin) {}
114 
115  // Getters
116  const std::shared_ptr<const SymbolPin>& getPin() const noexcept {
117  return mPin;
118  }
119 
120 private:
121  std::shared_ptr<const SymbolPin> mPin;
122 };
123 
124 /*******************************************************************************
125  * Class MsgOverlappingSymbolPins
126  ******************************************************************************/
127 
132  Q_DECLARE_TR_FUNCTIONS(MsgOverlappingSymbolPins)
133 
134 public:
135  // Constructors / Destructor
136  MsgOverlappingSymbolPins() = delete;
138  QVector<std::shared_ptr<const SymbolPin>> pins) noexcept;
140  : RuleCheckMessage(other), mPins(other.mPins) {}
141  virtual ~MsgOverlappingSymbolPins() noexcept {}
142 
143  // Getters
144  const QVector<std::shared_ptr<const SymbolPin>>& getPins() const noexcept {
145  return mPins;
146  }
147 
148 private:
149  static QString buildMessage(
150  const QVector<std::shared_ptr<const SymbolPin>>& pins) noexcept;
151 
152 private: // Data
153  QVector<std::shared_ptr<const SymbolPin>> mPins;
154 };
155 
156 /*******************************************************************************
157  * Class MsgSymbolPinNotOnGrid
158  ******************************************************************************/
159 
164  Q_DECLARE_TR_FUNCTIONS(MsgSymbolPinNotOnGrid)
165 
166 public:
167  // Constructors / Destructor
168  MsgSymbolPinNotOnGrid() = delete;
169  MsgSymbolPinNotOnGrid(std::shared_ptr<const SymbolPin> pin,
170  const PositiveLength& gridInterval) noexcept;
172  : RuleCheckMessage(other),
173  mPin(other.mPin),
174  mGridInterval(other.mGridInterval) {}
175  virtual ~MsgSymbolPinNotOnGrid() noexcept {}
176 
177  // Getters
178  const std::shared_ptr<const SymbolPin>& getPin() const noexcept {
179  return mPin;
180  }
181  const PositiveLength& getGridInterval() const noexcept {
182  return mGridInterval;
183  }
184 
185 private:
186  std::shared_ptr<const SymbolPin> mPin;
188 };
189 
190 /*******************************************************************************
191  * Class MsgWrongSymbolTextLayer
192  ******************************************************************************/
193 
198  Q_DECLARE_TR_FUNCTIONS(MsgWrongSymbolTextLayer)
199 
200 public:
201  // Constructors / Destructor
202  MsgWrongSymbolTextLayer() = delete;
203  MsgWrongSymbolTextLayer(std::shared_ptr<const Text> text,
204  const Layer& expectedLayer) noexcept;
206  : RuleCheckMessage(other),
207  mText(other.mText),
208  mExpectedLayer(other.mExpectedLayer) {}
209  virtual ~MsgWrongSymbolTextLayer() noexcept {}
210 
211  // Getters
212  std::shared_ptr<const Text> getText() const noexcept { return mText; }
213  const Layer& getExpectedLayer() const noexcept { return *mExpectedLayer; }
214 
215 private:
216  std::shared_ptr<const Text> mText;
218 };
219 
220 /*******************************************************************************
221  * End of File
222  ******************************************************************************/
223 
224 } // namespace librepcb
225 
226 #endif
The MsgMissingSymbolName class.
Definition: symbolcheckmessages.h:66
The MsgSymbolPinNotOnGrid class.
Definition: symbolcheckmessages.h:163
MsgMissingSymbolValue(const MsgMissingSymbolValue &other) noexcept
Definition: symbolcheckmessages.h:90
The MsgMissingSymbolValue class.
Definition: symbolcheckmessages.h:84
std::shared_ptr< const SymbolPin > mPin
Definition: symbolcheckmessages.h:186
virtual ~MsgNonFunctionalSymbolPinInversionSign() noexcept
Definition: symbolcheckmessages.h:113
const std::shared_ptr< const SymbolPin > & getPin() const noexcept
Definition: symbolcheckmessages.h:116
Definition: occmodel.cpp:76
MsgOverlappingSymbolPins(const MsgOverlappingSymbolPins &other) noexcept
Definition: symbolcheckmessages.h:139
std::shared_ptr< const Text > mText
Definition: symbolcheckmessages.h:216
The Layer class provides all supported geometry layers.
Definition: layer.h:40
PositiveLength mGridInterval
Definition: symbolcheckmessages.h:187
virtual ~MsgSymbolPinNotOnGrid() noexcept
Definition: symbolcheckmessages.h:175
QVector< std::shared_ptr< const SymbolPin > > mPins
Definition: symbolcheckmessages.h:153
std::shared_ptr< const SymbolPin > mPin
Definition: symbolcheckmessages.h:121
std::shared_ptr< const Text > getText() const noexcept
Definition: symbolcheckmessages.h:212
virtual ~MsgOverlappingSymbolPins() noexcept
Definition: symbolcheckmessages.h:141
const QVector< std::shared_ptr< const SymbolPin > > & getPins() const noexcept
Definition: symbolcheckmessages.h:144
The MsgDuplicatePinName class.
Definition: symbolcheckmessages.h:47
The MsgNonFunctionalSymbolPinInversionSign class.
Definition: symbolcheckmessages.h:102
const Layer * mExpectedLayer
Definition: symbolcheckmessages.h:217
const PositiveLength & getGridInterval() const noexcept
Definition: symbolcheckmessages.h:181
MsgSymbolPinNotOnGrid(const MsgSymbolPinNotOnGrid &other) noexcept
Definition: symbolcheckmessages.h:171
MsgMissingSymbolName(const MsgMissingSymbolName &other) noexcept
Definition: symbolcheckmessages.h:72
MsgDuplicatePinName(const MsgDuplicatePinName &other) noexcept
Definition: symbolcheckmessages.h:54
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:51
The MsgWrongSymbolTextLayer class.
Definition: symbolcheckmessages.h:197
virtual ~MsgMissingSymbolValue() noexcept
Definition: symbolcheckmessages.h:92
virtual ~MsgMissingSymbolName() noexcept
Definition: symbolcheckmessages.h:74
MsgWrongSymbolTextLayer(const MsgWrongSymbolTextLayer &other) noexcept
Definition: symbolcheckmessages.h:205
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:785
const std::shared_ptr< const SymbolPin > & getPin() const noexcept
Definition: symbolcheckmessages.h:178
The RuleCheckMessage class.
Definition: rulecheckmessage.h:45
const Layer & getExpectedLayer() const noexcept
Definition: symbolcheckmessages.h:213
virtual ~MsgWrongSymbolTextLayer() noexcept
Definition: symbolcheckmessages.h:209
MsgNonFunctionalSymbolPinInversionSign(const MsgNonFunctionalSymbolPinInversionSign &other) noexcept
Definition: symbolcheckmessages.h:110
virtual ~MsgDuplicatePinName() noexcept
Definition: symbolcheckmessages.h:56
The MsgOverlappingSymbolPins class.
Definition: symbolcheckmessages.h:131