LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boarddesignrulechecksettings.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_BOARDDESIGNRULECHECKSETTINGS_H
21#define LIBREPCB_CORE_BOARDDESIGNRULECHECKSETTINGS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../types/elementname.h"
27#include "../../../types/length.h"
28#include "../../../types/uuid.h"
29#include "../../../types/version.h"
30
31#include <unordered_set>
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class PcbColor;
41class SExpression;
42
43/*******************************************************************************
44 * Class BoardDesignRuleCheckSettings
45 ******************************************************************************/
46
51public:
52 // Types
64 struct SourceSetCmp {
65 std::size_t operator()(const Source& s) const noexcept {
66 return ::qHash(std::make_pair(s.organizationUuid, s.pcbDesignRulesUuid));
67 }
68 bool operator()(const Source& lhs, const Source& rhs) const noexcept {
69 return (lhs.organizationUuid == rhs.organizationUuid) &&
70 (lhs.pcbDesignRulesUuid == rhs.pcbDesignRulesUuid);
71 }
72 };
73 typedef std::unordered_set<Source, SourceSetCmp, SourceSetCmp> SourceSet;
74 enum class AllowedSlots : int {
75 None = 0,
78 Any = 3,
79 };
80
81 // Constructors / Destructor
84 const BoardDesignRuleCheckSettings& other) noexcept;
85 explicit BoardDesignRuleCheckSettings(const SExpression& node);
87
88 // Getters
89 const SourceSet& getSources() const noexcept { return mSources; }
90 const std::pair<UnsignedLength, UnsignedLength>& getMinBoardSize()
91 const noexcept {
92 return mMinBoardSize;
93 }
94 const std::pair<UnsignedLength, UnsignedLength>& getMaxBoardSizeDoubleSided()
95 const noexcept {
97 }
98 const std::pair<UnsignedLength, UnsignedLength>& getMaxBoardSizeMultiLayer()
99 const noexcept {
101 }
102 const QSet<PositiveLength>& getPcbThickness() const noexcept {
103 return mPcbThickness;
104 }
105 uint getMaxLayerCount() const noexcept { return mMaxLayerCount; }
106 const QSet<const PcbColor*>& getSolderResist() const noexcept {
107 return mSolderResist;
108 }
109 const QSet<const PcbColor*>& getSilkscreen() const noexcept {
110 return mSilkscreen;
111 }
114 }
117 }
120 }
123 }
126 }
130 const UnsignedLength& getMinCopperWidth() const noexcept {
131 return mMinCopperWidth;
132 }
133 const UnsignedLength& getMinPthAnnularRing() const noexcept {
134 return mMinPthAnnularRing;
135 }
136 const UnsignedLength& getMinNpthDrillDiameter() const noexcept {
138 }
139 const UnsignedLength& getMinPthDrillDiameter() const noexcept {
141 }
142 const UnsignedLength& getMinNpthSlotWidth() const noexcept {
143 return mMinNpthSlotWidth;
144 }
145 const UnsignedLength& getMinPthSlotWidth() const noexcept {
146 return mMinPthSlotWidth;
147 }
150 }
151 const UnsignedLength& getMinSilkscreenWidth() const noexcept {
152 return mMinSilkscreenWidth;
153 }
156 }
159 }
160 bool getBlindViasAllowed() const noexcept { return mBlindViasAllowed; }
161 bool getBuriedViasAllowed() const noexcept { return mBuriedViasAllowed; }
163 return mAllowedNpthSlots;
164 }
166 const QMap<QString, QList<SExpression>>& getOptions() const noexcept {
167 return mOptions;
168 }
169
170 // Setters
171 void setSources(const SourceSet& value) noexcept { mSources = value; }
173 const std::pair<UnsignedLength, UnsignedLength>& value) noexcept {
174 mMinBoardSize = value;
175 }
177 const std::pair<UnsignedLength, UnsignedLength>& value) noexcept {
179 }
181 const std::pair<UnsignedLength, UnsignedLength>& value) noexcept {
183 }
184 void setPcbThickness(const QSet<PositiveLength>& value) noexcept {
185 mPcbThickness = value;
186 }
187 void setMaxLayerCount(uint value) noexcept { mMaxLayerCount = value; }
188 void setSolderResist(const QSet<const PcbColor*>& value) noexcept {
189 mSolderResist = value;
190 }
191 void setSilkscreen(const QSet<const PcbColor*>& value) noexcept {
192 mSilkscreen = value;
193 }
194 void setMinCopperCopperClearance(const UnsignedLength& value) noexcept {
196 }
197 void setMinCopperBoardClearance(const UnsignedLength& value) noexcept {
199 }
200 void setMinCopperNpthClearance(const UnsignedLength& value) noexcept {
202 }
203 void setMinDrillDrillClearance(const UnsignedLength& value) noexcept {
205 }
206 void setMinDrillBoardClearance(const UnsignedLength& value) noexcept {
208 }
212 void setMinCopperWidth(const UnsignedLength& value) noexcept {
213 mMinCopperWidth = value;
214 }
215 void setMinPthAnnularRing(const UnsignedLength& value) noexcept {
216 mMinPthAnnularRing = value;
217 }
218 void setMinNpthDrillDiameter(const UnsignedLength& value) noexcept {
219 mMinNpthDrillDiameter = value;
220 }
221 void setMinPthDrillDiameter(const UnsignedLength& value) noexcept {
222 mMinPthDrillDiameter = value;
223 }
224 void setMinNpthSlotWidth(const UnsignedLength& value) noexcept {
225 mMinNpthSlotWidth = value;
226 }
227 void setMinPthSlotWidth(const UnsignedLength& value) noexcept {
228 mMinPthSlotWidth = value;
229 }
230 void setMaxTentedViaDrillDiameter(const UnsignedLength& value) noexcept {
232 }
233 void setMinSilkscreenWidth(const UnsignedLength& value) noexcept {
234 mMinSilkscreenWidth = value;
235 }
236 void setMinSilkscreenTextHeight(const UnsignedLength& value) noexcept {
238 }
239 void setMinOutlineToolDiameter(const UnsignedLength& value) noexcept {
241 }
242 void setBlindViasAllowed(bool value) noexcept { mBlindViasAllowed = value; }
243 void setBuriedViasAllowed(bool value) noexcept { mBuriedViasAllowed = value; }
244 void setAllowedNpthSlots(AllowedSlots value) noexcept {
245 mAllowedNpthSlots = value;
246 }
247 void setAllowedPthSlots(AllowedSlots value) noexcept {
248 mAllowedPthSlots = value;
249 }
250 void setOptions(const QMap<QString, QList<SExpression>>& value) noexcept {
251 mOptions = value;
252 }
253
254 // General Methods
255
261 void serialize(SExpression& root) const;
262
263 // Operator Overloadings
265 const BoardDesignRuleCheckSettings& rhs) noexcept;
266 bool operator==(const BoardDesignRuleCheckSettings& rhs) const noexcept;
267 bool operator!=(const BoardDesignRuleCheckSettings& rhs) const noexcept {
268 return !(*this == rhs);
269 }
270
271private: // Data
272 // Internal data
274
275 // General PCB manufacturer capabilities
276 std::pair<UnsignedLength, UnsignedLength> mMinBoardSize;
277 std::pair<UnsignedLength, UnsignedLength> mMaxBoardSizeDoubleSided;
278 std::pair<UnsignedLength, UnsignedLength> mMaxBoardSizeMultiLayer;
279 QSet<PositiveLength> mPcbThickness;
281 QSet<const PcbColor*> mSolderResist;
282 QSet<const PcbColor*> mSilkscreen;
283
284 // Clearances
291
292 // Minimum/maximum sizes
303
304 // Allowed features
309
310 // Arbitrary options for forward compatibility in case we really need to
311 // add new settings in a minor release.
312 QMap<QString, QList<SExpression>> mOptions;
313};
314
315/*******************************************************************************
316 * End of File
317 ******************************************************************************/
318
319} // namespace librepcb
320
322
323#endif
The BoardDesignRuleCheckSettings class.
Definition boarddesignrulechecksettings.h:50
const std::pair< UnsignedLength, UnsignedLength > & getMaxBoardSizeMultiLayer() const noexcept
Definition boarddesignrulechecksettings.h:98
void setMinSilkscreenWidth(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:233
UnsignedLength mMinCopperBoardClearance
Definition boarddesignrulechecksettings.h:286
bool operator!=(const BoardDesignRuleCheckSettings &rhs) const noexcept
Definition boarddesignrulechecksettings.h:267
UnsignedLength mMinDrillDrillClearance
Definition boarddesignrulechecksettings.h:288
void setAllowedNpthSlots(AllowedSlots value) noexcept
Definition boarddesignrulechecksettings.h:244
void setMinNpthDrillDiameter(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:218
UnsignedLength mMinNpthDrillDiameter
Definition boarddesignrulechecksettings.h:295
QSet< const PcbColor * > mSilkscreen
Empty=any/unknown. nullptr=none.
Definition boarddesignrulechecksettings.h:282
void setMinNpthSlotWidth(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:224
bool mBlindViasAllowed
Definition boarddesignrulechecksettings.h:305
const UnsignedLength & getMinPthSlotWidth() const noexcept
Definition boarddesignrulechecksettings.h:145
void setMaxLayerCount(uint value) noexcept
Definition boarddesignrulechecksettings.h:187
void setMinDrillDrillClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:203
const UnsignedLength & getMinSilkscreenStopmaskClearance() const noexcept
Definition boarddesignrulechecksettings.h:127
std::unordered_set< Source, SourceSetCmp, SourceSetCmp > SourceSet
Definition boarddesignrulechecksettings.h:73
void setMaxBoardSizeDoubleSided(const std::pair< UnsignedLength, UnsignedLength > &value) noexcept
Definition boarddesignrulechecksettings.h:176
const UnsignedLength & getMinCopperWidth() const noexcept
Definition boarddesignrulechecksettings.h:130
const UnsignedLength & getMinDrillBoardClearance() const noexcept
Definition boarddesignrulechecksettings.h:124
UnsignedLength mMinDrillBoardClearance
Definition boarddesignrulechecksettings.h:289
void setBuriedViasAllowed(bool value) noexcept
Definition boarddesignrulechecksettings.h:243
void setMinBoardSize(const std::pair< UnsignedLength, UnsignedLength > &value) noexcept
Definition boarddesignrulechecksettings.h:172
QMap< QString, QList< SExpression > > mOptions
Definition boarddesignrulechecksettings.h:312
const UnsignedLength & getMinSilkscreenWidth() const noexcept
Definition boarddesignrulechecksettings.h:151
std::pair< UnsignedLength, UnsignedLength > mMinBoardSize
Definition boarddesignrulechecksettings.h:276
void setMinCopperNpthClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:200
SourceSet mSources
Definition boarddesignrulechecksettings.h:273
void setMinCopperWidth(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:212
AllowedSlots getAllowedPthSlots() const noexcept
Definition boarddesignrulechecksettings.h:165
uint mMaxLayerCount
0 = Check disabled
Definition boarddesignrulechecksettings.h:280
void setSolderResist(const QSet< const PcbColor * > &value) noexcept
Definition boarddesignrulechecksettings.h:188
const SourceSet & getSources() const noexcept
Definition boarddesignrulechecksettings.h:89
bool operator==(const BoardDesignRuleCheckSettings &rhs) const noexcept
Definition boarddesignrulechecksettings.cpp:372
UnsignedLength mMinSilkscreenWidth
Definition boarddesignrulechecksettings.h:300
const std::pair< UnsignedLength, UnsignedLength > & getMaxBoardSizeDoubleSided() const noexcept
Definition boarddesignrulechecksettings.h:94
bool getBuriedViasAllowed() const noexcept
Definition boarddesignrulechecksettings.h:161
const QSet< const PcbColor * > & getSilkscreen() const noexcept
Definition boarddesignrulechecksettings.h:109
AllowedSlots mAllowedNpthSlots
Definition boarddesignrulechecksettings.h:307
UnsignedLength mMinCopperNpthClearance
Definition boarddesignrulechecksettings.h:287
AllowedSlots mAllowedPthSlots
Definition boarddesignrulechecksettings.h:308
QSet< const PcbColor * > mSolderResist
Empty=any/unknown. nullptr=none.
Definition boarddesignrulechecksettings.h:281
void setMinSilkscreenTextHeight(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:236
std::pair< UnsignedLength, UnsignedLength > mMaxBoardSizeMultiLayer
Definition boarddesignrulechecksettings.h:278
AllowedSlots getAllowedNpthSlots() const noexcept
Definition boarddesignrulechecksettings.h:162
UnsignedLength mMinOutlineToolDiameter
Definition boarddesignrulechecksettings.h:302
void setMinPthSlotWidth(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:227
UnsignedLength mMinSilkscreenStopmaskClearance
Definition boarddesignrulechecksettings.h:290
const UnsignedLength & getMinNpthSlotWidth() const noexcept
Definition boarddesignrulechecksettings.h:142
void setBlindViasAllowed(bool value) noexcept
Definition boarddesignrulechecksettings.h:242
const UnsignedLength & getMinPthAnnularRing() const noexcept
Definition boarddesignrulechecksettings.h:133
UnsignedLength mMinCopperWidth
Definition boarddesignrulechecksettings.h:293
void setAllowedPthSlots(AllowedSlots value) noexcept
Definition boarddesignrulechecksettings.h:247
const UnsignedLength & getMinCopperNpthClearance() const noexcept
Definition boarddesignrulechecksettings.h:118
void setSources(const SourceSet &value) noexcept
Definition boarddesignrulechecksettings.h:171
void setMinDrillBoardClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:206
const std::pair< UnsignedLength, UnsignedLength > & getMinBoardSize() const noexcept
Definition boarddesignrulechecksettings.h:90
UnsignedLength mMinSilkscreenTextHeight
Definition boarddesignrulechecksettings.h:301
const UnsignedLength & getMinNpthDrillDiameter() const noexcept
Definition boarddesignrulechecksettings.h:136
UnsignedLength mMinNpthSlotWidth
Definition boarddesignrulechecksettings.h:297
UnsignedLength mMinPthAnnularRing
Definition boarddesignrulechecksettings.h:294
const UnsignedLength & getMaxTentedViaDrillDiameter() const noexcept
Definition boarddesignrulechecksettings.h:148
const UnsignedLength & getMinOutlineToolDiameter() const noexcept
Definition boarddesignrulechecksettings.h:157
const QSet< PositiveLength > & getPcbThickness() const noexcept
Definition boarddesignrulechecksettings.h:102
void setMinOutlineToolDiameter(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:239
AllowedSlots
Definition boarddesignrulechecksettings.h:74
@ SingleSegmentStraight
Straight single-segment slots are allowed.
@ MultiSegmentStraight
Straight multi-segment slots are allowed.
@ Any
Any kind of slot is allowed (including curves).
bool getBlindViasAllowed() const noexcept
Definition boarddesignrulechecksettings.h:160
UnsignedLength mMinPthDrillDiameter
Definition boarddesignrulechecksettings.h:296
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition boarddesignrulechecksettings.cpp:231
const QMap< QString, QList< SExpression > > & getOptions() const noexcept
Definition boarddesignrulechecksettings.h:166
const UnsignedLength & getMinCopperBoardClearance() const noexcept
Definition boarddesignrulechecksettings.h:115
void setSilkscreen(const QSet< const PcbColor * > &value) noexcept
Definition boarddesignrulechecksettings.h:191
BoardDesignRuleCheckSettings & operator=(const BoardDesignRuleCheckSettings &rhs) noexcept
Definition boarddesignrulechecksettings.cpp:338
uint getMaxLayerCount() const noexcept
Definition boarddesignrulechecksettings.h:105
BoardDesignRuleCheckSettings() noexcept
Definition boarddesignrulechecksettings.cpp:106
void setMaxTentedViaDrillDiameter(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:230
void setMinPthAnnularRing(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:215
const QSet< const PcbColor * > & getSolderResist() const noexcept
Definition boarddesignrulechecksettings.h:106
void setMinSilkscreenStopmaskClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:209
const UnsignedLength & getMinPthDrillDiameter() const noexcept
Definition boarddesignrulechecksettings.h:139
bool mBuriedViasAllowed
Definition boarddesignrulechecksettings.h:306
UnsignedLength mMinCopperCopperClearance
Definition boarddesignrulechecksettings.h:285
UnsignedLength mMinPthSlotWidth
Definition boarddesignrulechecksettings.h:298
void setMaxBoardSizeMultiLayer(const std::pair< UnsignedLength, UnsignedLength > &value) noexcept
Definition boarddesignrulechecksettings.h:180
void setMinPthDrillDiameter(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:221
const UnsignedLength & getMinDrillDrillClearance() const noexcept
Definition boarddesignrulechecksettings.h:121
void setPcbThickness(const QSet< PositiveLength > &value) noexcept
Definition boarddesignrulechecksettings.h:184
const UnsignedLength & getMinCopperCopperClearance() const noexcept
Definition boarddesignrulechecksettings.h:112
std::pair< UnsignedLength, UnsignedLength > mMaxBoardSizeDoubleSided
Definition boarddesignrulechecksettings.h:277
const UnsignedLength & getMinSilkscreenTextHeight() const noexcept
Definition boarddesignrulechecksettings.h:154
void setMinCopperBoardClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:197
UnsignedLength mMaxTentedViaDrillDiameter
Definition boarddesignrulechecksettings.h:299
void setMinCopperCopperClearance(const UnsignedLength &value) noexcept
Definition boarddesignrulechecksettings.h:194
void setOptions(const QMap< QString, QList< SExpression > > &value) noexcept
Definition boarddesignrulechecksettings.h:250
QSet< PositiveLength > mPcbThickness
No restrictions if empty.
Definition boarddesignrulechecksettings.h:279
The SExpression class.
Definition sexpression.h:69
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The Version class represents a version number in the format "1.42.7".
Definition version.h:58
Definition occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition elementname.h:84
Definition boarddesignrulechecksettings.h:53
Uuid organizationUuid
Definition boarddesignrulechecksettings.h:54
static Source load(const SExpression &node)
Definition boarddesignrulechecksettings.cpp:78
Uuid pcbDesignRulesUuid
Definition boarddesignrulechecksettings.h:57
ElementName pcbDesignRulesName
Definition boarddesignrulechecksettings.h:58
void serialize(SExpression &root) const
Definition boarddesignrulechecksettings.cpp:89
Version organizationVersion
Definition boarddesignrulechecksettings.h:56
bool operator==(const Source &rhs) const noexcept=default
ElementName organizationName
Definition boarddesignrulechecksettings.h:55
Definition boarddesignrulechecksettings.h:64
bool operator()(const Source &lhs, const Source &rhs) const noexcept
Definition boarddesignrulechecksettings.h:68
std::size_t operator()(const Source &s) const noexcept
Definition boarddesignrulechecksettings.h:65