LibrePCB Developers Documentation
d356netlistgenerator.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_D356NETLISTGENERATOR_H
21#define LIBREPCB_CORE_D356NETLISTGENERATOR_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/angle.h"
27#include "../types/point.h"
28
29#include <optional/tl/optional.hpp>
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38/*******************************************************************************
39 * Class D356NetlistGenerator
40 ******************************************************************************/
41
50 Q_DECLARE_TR_FUNCTIONS(D356NetlistGenerator)
51
52public:
53 // Constructors / Destructor
56 D356NetlistGenerator(const QString& projName, const QString& projRevision,
57 const QString& brdName,
58 const QDateTime& generationDate) noexcept;
59 ~D356NetlistGenerator() noexcept;
60
61 // General Methods
62 void smtPad(const QString& netName, const QString& cmpName,
63 const QString& padName, const Point& position,
64 const PositiveLength& width, const PositiveLength& height,
65 const Angle& rotation, int layer);
66 void thtPad(const QString& netName, const QString& cmpName,
67 const QString& padName, const Point& position,
68 const PositiveLength& width, const PositiveLength& height,
69 const Angle& rotation, const PositiveLength& drillDiameter);
70 void throughVia(const QString& netName, const Point& position,
71 const PositiveLength& width, const PositiveLength& height,
72 const Angle& rotation, const PositiveLength& drillDiameter,
73 bool solderMaskCovered);
74 void blindVia(const QString& netName, const Point& position,
75 const PositiveLength& width, const PositiveLength& height,
76 const Angle& rotation, const PositiveLength& drillDiameter,
77 int startLayer, int endLayer, bool solderMaskCovered);
78 void buriedVia(const QString& netName, const Point& position,
79 const PositiveLength& drillDiameter, int startLayer,
80 int endLayer);
81 QByteArray generate() const;
82
83 // Operator Overloadings
84 D356NetlistGenerator& operator=(const D356NetlistGenerator& rhs) = delete;
85
86private: // Methods
87 static QString cleanString(QString str) noexcept;
88 static QString checkedComponentName(const QString& name) noexcept;
89 static QString formatLength(const Length& value, bool isSigned,
90 int digits) noexcept;
91
92private: // Data
93 enum class OperationCode : int {
94 Continuation = 27,
95 BlindOrBuriedVia = 307,
96 ThroughHole = 317,
97 SurfaceMount = 327,
98 };
99
100 enum class SolderMask : int {
101 None = 0,
102 PrimarySide = 1,
103 SecondarySide = 2,
104 BothSides = 3,
105 };
106
107 struct Record {
109 tl::optional<QString> signalName;
111 QString padName;
113 tl::optional<std::pair<PositiveLength, bool>> hole;
114 tl::optional<int> accessCode;
116 tl::optional<PositiveLength> width;
117 tl::optional<PositiveLength> height;
118 tl::optional<Angle> rotation;
119 tl::optional<SolderMask> solderMask;
120 tl::optional<int> startLayer;
121 tl::optional<int> endLayer;
122 };
123
124 QStringList mComments;
125 QList<Record> mRecords;
126};
127
128/*******************************************************************************
129 * End of File
130 ******************************************************************************/
131
132} // namespace librepcb
133
134#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The D356NetlistGenerator class.
Definition: d356netlistgenerator.h:49
~D356NetlistGenerator() noexcept
Definition: d356netlistgenerator.cpp:66
SolderMask
Definition: d356netlistgenerator.h:100
void smtPad(const QString &netName, const QString &cmpName, const QString &padName, const Point &position, const PositiveLength &width, const PositiveLength &height, const Angle &rotation, int layer)
Definition: d356netlistgenerator.cpp:73
void throughVia(const QString &netName, const Point &position, const PositiveLength &width, const PositiveLength &height, const Angle &rotation, const PositiveLength &drillDiameter, bool solderMaskCovered)
Definition: d356netlistgenerator.cpp:99
QByteArray generate() const
Definition: d356netlistgenerator.cpp:140
static QString cleanString(QString str) noexcept
Definition: d356netlistgenerator.cpp:243
OperationCode
Definition: d356netlistgenerator.h:93
void thtPad(const QString &netName, const QString &cmpName, const QString &padName, const Point &position, const PositiveLength &width, const PositiveLength &height, const Angle &rotation, const PositiveLength &drillDiameter)
Definition: d356netlistgenerator.cpp:86
void buriedVia(const QString &netName, const Point &position, const PositiveLength &drillDiameter, int startLayer, int endLayer)
Definition: d356netlistgenerator.cpp:130
QStringList mComments
Definition: d356netlistgenerator.h:124
void blindVia(const QString &netName, const Point &position, const PositiveLength &width, const PositiveLength &height, const Angle &rotation, const PositiveLength &drillDiameter, int startLayer, int endLayer, bool solderMaskCovered)
Definition: d356netlistgenerator.cpp:110
static QString formatLength(const Length &value, bool isSigned, int digits) noexcept
Definition: d356netlistgenerator.cpp:269
QList< Record > mRecords
Definition: d356netlistgenerator.h:125
D356NetlistGenerator(const D356NetlistGenerator &other)=delete
static QString checkedComponentName(const QString &name) noexcept
Definition: d356netlistgenerator.cpp:260
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
Definition: d356netlistgenerator.h:107
bool midPoint
Definition: d356netlistgenerator.h:112
tl::optional< int > endLayer
Definition: d356netlistgenerator.h:121
tl::optional< PositiveLength > width
Definition: d356netlistgenerator.h:116
tl::optional< std::pair< PositiveLength, bool > > hole
Definition: d356netlistgenerator.h:113
QString padName
Definition: d356netlistgenerator.h:111
OperationCode code
Definition: d356netlistgenerator.h:108
QString componentName
Definition: d356netlistgenerator.h:110
tl::optional< PositiveLength > height
Definition: d356netlistgenerator.h:117
tl::optional< QString > signalName
Definition: d356netlistgenerator.h:109
tl::optional< int > accessCode
Definition: d356netlistgenerator.h:114
tl::optional< Angle > rotation
Definition: d356netlistgenerator.h:118
Point position
Definition: d356netlistgenerator.h:115
tl::optional< SolderMask > solderMask
Definition: d356netlistgenerator.h:119
tl::optional< int > startLayer
Definition: d356netlistgenerator.h:120