LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardholedata.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_BOARDHOLEDATA_H
21#define LIBREPCB_CORE_BOARDHOLEDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../geometry/path.h"
27#include "../../types/length.h"
28#include "../../types/maskconfig.h"
29#include "../../types/uuid.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38/*******************************************************************************
39 * Class BoardHoleData
40 ******************************************************************************/
41
45class BoardHoleData final {
46public:
47 // Constructors / Destructor
48 BoardHoleData() = delete;
49 BoardHoleData(const BoardHoleData& other) noexcept;
50 BoardHoleData(const Uuid& uuid, const BoardHoleData& other) noexcept;
51 BoardHoleData(const Uuid& uuid, const PositiveLength& diameter,
52 const NonEmptyPath& path, const MaskConfig& stopMaskConfig,
53 bool locked);
54 explicit BoardHoleData(const SExpression& node);
55 ~BoardHoleData() noexcept;
56
57 // Getters
58 const Uuid& getUuid() const noexcept { return mUuid; }
59 const PositiveLength& getDiameter() const noexcept { return mDiameter; }
60 const NonEmptyPath& getPath() const noexcept { return mPath; }
61 const MaskConfig& getStopMaskConfig() const noexcept {
62 return mStopMaskConfig;
63 }
64 bool isLocked() const noexcept { return mLocked; }
65 bool isSlot() const noexcept { return mPath->getVertices().count() > 1; }
66 bool isMultiSegmentSlot() const noexcept {
67 return mPath->getVertices().count() > 2;
68 }
69 bool isCurvedSlot() const noexcept { return mPath->isCurved(); }
70
71 // Setters
72 bool setUuid(const Uuid& uuid) noexcept;
73 bool setDiameter(const PositiveLength& diameter) noexcept;
74 bool setPath(const NonEmptyPath& path) noexcept;
75 bool setStopMaskConfig(const MaskConfig& config) noexcept;
76 bool setLocked(bool locked) noexcept;
77
78 // General Methods
79
85 void serialize(SExpression& root) const;
86
87 // Operator Overloadings
88 bool operator==(const BoardHoleData& rhs) const noexcept;
89 bool operator!=(const BoardHoleData& rhs) const noexcept {
90 return !(*this == rhs);
91 }
92 BoardHoleData& operator=(const BoardHoleData& rhs) = default;
93
94private: // Data
99 bool mLocked;
100};
101
102/*******************************************************************************
103 * End of File
104 ******************************************************************************/
105
106} // namespace librepcb
107
108#endif
The BoardHoleData class.
Definition boardholedata.h:45
bool mLocked
Definition boardholedata.h:99
bool isSlot() const noexcept
Definition boardholedata.h:65
bool isMultiSegmentSlot() const noexcept
Definition boardholedata.h:66
const MaskConfig & getStopMaskConfig() const noexcept
Definition boardholedata.h:61
bool setStopMaskConfig(const MaskConfig &config) noexcept
Definition boardholedata.cpp:107
BoardHoleData & operator=(const BoardHoleData &rhs)=default
bool operator==(const BoardHoleData &rhs) const noexcept
Definition boardholedata.cpp:143
Uuid mUuid
Definition boardholedata.h:95
NonEmptyPath mPath
Definition boardholedata.h:97
bool setPath(const NonEmptyPath &path) noexcept
Definition boardholedata.cpp:98
bool isLocked() const noexcept
Definition boardholedata.h:64
const PositiveLength & getDiameter() const noexcept
Definition boardholedata.h:59
MaskConfig mStopMaskConfig
Definition boardholedata.h:98
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition boardholedata.cpp:129
const Uuid & getUuid() const noexcept
Definition boardholedata.h:58
bool isCurvedSlot() const noexcept
Definition boardholedata.h:69
bool operator!=(const BoardHoleData &rhs) const noexcept
Definition boardholedata.h:89
PositiveLength mDiameter
Definition boardholedata.h:96
bool setLocked(bool locked) noexcept
Definition boardholedata.cpp:116
bool setDiameter(const PositiveLength &diameter) noexcept
Definition boardholedata.cpp:89
const NonEmptyPath & getPath() const noexcept
Definition boardholedata.h:60
bool setUuid(const Uuid &uuid) noexcept
Definition boardholedata.cpp:80
~BoardHoleData() noexcept
Definition boardholedata.cpp:73
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition maskconfig.h:45
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
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition path.h:231