LibrePCB Developers Documentation
pickplacedata.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_PICKPLACEDATA_H
21 #define LIBREPCB_PICKPLACEDATA_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../units/all_length_units.h"
27 
28 #include <QtCore>
29 
30 /*******************************************************************************
31  * Namespace / Forward Declarations
32  ******************************************************************************/
33 namespace librepcb {
34 
35 /*******************************************************************************
36  * Class PickPlaceDataItem
37  ******************************************************************************/
38 
45 class PickPlaceDataItem final {
46  Q_DECLARE_TR_FUNCTIONS(PickPlaceDataItem)
47 
48 public:
49  enum class BoardSide {
50  TOP,
51  BOTTOM,
52  };
53 
54  // Constructors / Destructor
55  PickPlaceDataItem() = delete;
56  PickPlaceDataItem(const QString& designator, const QString& value,
57  const QString& deviceName, const QString& packageName,
58  const Point& position, const Angle& rotation,
59  BoardSide boardSide) noexcept
60  : mDesignator(designator),
61  mValue(value),
62  mDeviceName(deviceName),
63  mPackageName(packageName),
64  mPosition(position),
65  mRotation(rotation),
66  mBoardSide(boardSide) {}
67  PickPlaceDataItem(const PickPlaceDataItem& other) noexcept
68  : mDesignator(other.mDesignator),
69  mValue(other.mValue),
70  mDeviceName(other.mDeviceName),
71  mPackageName(other.mPackageName),
72  mPosition(other.mPosition),
73  mRotation(other.mRotation),
74  mBoardSide(other.mBoardSide) {}
75  ~PickPlaceDataItem() noexcept {}
76 
77  // Getters
78  const QString& getDesignator() const noexcept { return mDesignator; }
79  const QString& getValue() const noexcept { return mValue; }
80  const QString& getDeviceName() const noexcept { return mDeviceName; }
81  const QString& getPackageName() const noexcept { return mPackageName; }
82  const Point& getPosition() const noexcept { return mPosition; }
83  const Angle& getRotation() const noexcept { return mRotation; }
84  BoardSide getBoardSide() const noexcept { return mBoardSide; }
85 
86  // Operator Overloadings
88  mDesignator = rhs.mDesignator;
89  mValue = rhs.mValue;
90  mDeviceName = rhs.mDeviceName;
91  mPackageName = rhs.mPackageName;
92  mPosition = rhs.mPosition;
93  mRotation = rhs.mRotation;
94  mBoardSide = rhs.mBoardSide;
95  return *this;
96  }
97 
98 private:
99  QString mDesignator;
100  QString mValue;
101  QString mDeviceName;
102  QString mPackageName;
106 };
107 
108 /*******************************************************************************
109  * Class PickPlaceData
110  ******************************************************************************/
111 
116 class PickPlaceData final {
117  Q_DECLARE_TR_FUNCTIONS(PickPlaceData)
118 
119 public:
120  // Constructors / Destructor
121  PickPlaceData() = delete;
122  PickPlaceData(const PickPlaceData& other) noexcept = delete;
123  PickPlaceData(const QString& projectName, const QString& projectVersion,
124  const QString& boardName) noexcept;
125  ~PickPlaceData() noexcept;
126 
127  // Getters
128  const QString& getProjectName() const noexcept { return mProjectName; }
129  const QString& getProjectVersion() const noexcept { return mProjectVersion; }
130  const QString& getBoardName() const noexcept { return mBoardName; }
131  const QList<PickPlaceDataItem>& getItems() const noexcept { return mItems; }
132 
133  // General Methods
134  void addItem(const PickPlaceDataItem& item) noexcept;
135 
136  // Operator Overloadings
137  PickPlaceData& operator=(const PickPlaceData& rhs) noexcept = delete;
138 
139 private:
140  QString mProjectName;
142  QString mBoardName;
143  QList<PickPlaceDataItem> mItems;
144 };
145 
146 /*******************************************************************************
147  * End of File
148  ******************************************************************************/
149 
150 } // namespace librepcb
151 
152 #endif // LIBREPCB_PICKPLACEDATA_H
~PickPlaceDataItem() noexcept
Definition: pickplacedata.h:75
const QString & getBoardName() const noexcept
Definition: pickplacedata.h:130
QString mDeviceName
Definition: pickplacedata.h:101
QString mBoardName
Definition: pickplacedata.h:142
Definition: airwiresbuilder.cpp:32
BoardSide mBoardSide
Definition: pickplacedata.h:105
The librepcb::PickPlaceDataItem class represents one item of a pick&place file.
Definition: pickplacedata.h:45
QString mValue
Definition: pickplacedata.h:100
PickPlaceDataItem(const QString &designator, const QString &value, const QString &deviceName, const QString &packageName, const Point &position, const Angle &rotation, BoardSide boardSide) noexcept
Definition: pickplacedata.h:56
QList< PickPlaceDataItem > mItems
Definition: pickplacedata.h:143
const Point & getPosition() const noexcept
Definition: pickplacedata.h:82
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
Angle mRotation
Definition: pickplacedata.h:104
BoardSide getBoardSide() const noexcept
Definition: pickplacedata.h:84
QString mPackageName
Definition: pickplacedata.h:102
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
QString mProjectVersion
Definition: pickplacedata.h:141
Point mPosition
Definition: pickplacedata.h:103
The librepcb::PickPlaceData class represents the content of a pick&place file.
Definition: pickplacedata.h:116
QString mProjectName
Definition: pickplacedata.h:140
const QString & getPackageName() const noexcept
Definition: pickplacedata.h:81
const QString & getProjectVersion() const noexcept
Definition: pickplacedata.h:129
const QString & getValue() const noexcept
Definition: pickplacedata.h:79
const QString & getDeviceName() const noexcept
Definition: pickplacedata.h:80
BoardSide
Definition: pickplacedata.h:49
PickPlaceDataItem(const PickPlaceDataItem &other) noexcept
Definition: pickplacedata.h:67
QString mDesignator
Definition: pickplacedata.h:99
const QList< PickPlaceDataItem > & getItems() const noexcept
Definition: pickplacedata.h:131
const QString & getDesignator() const noexcept
Definition: pickplacedata.h:78
const Angle & getRotation() const noexcept
Definition: pickplacedata.h:83
const QString & getProjectName() const noexcept
Definition: pickplacedata.h:128
PickPlaceDataItem & operator=(const PickPlaceDataItem &rhs) noexcept
Definition: pickplacedata.h:87