LibrePCB Developers Documentation
padhole.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_PADHOLE_H
21#define LIBREPCB_CORE_PADHOLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../geometry/path.h"
27#include "../serialization/serializableobjectlist.h"
28#include "../types/length.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class PadHole
39 ******************************************************************************/
40
44class PadHole {
45 Q_DECLARE_TR_FUNCTIONS(PadHole)
46
47public:
48 // Signals
49 enum class Event {
50 UuidChanged,
51 DiameterChanged,
52 PathChanged,
53 };
56
57 // Constructors / Destructor
58 PadHole() = delete;
59 PadHole(const PadHole& other) noexcept;
60 PadHole(const Uuid& uuid, const PadHole& other) noexcept;
61 PadHole(const Uuid& uuid, const PositiveLength& diameter,
62 const NonEmptyPath& path) noexcept;
63 explicit PadHole(const SExpression& node);
64 virtual ~PadHole() noexcept;
65
66 // Getters
67 const Uuid& getUuid() const noexcept { return mUuid; }
68 const PositiveLength& getDiameter() const noexcept { return mDiameter; }
69 const NonEmptyPath& getPath() const noexcept { return mPath; }
70 bool isSlot() const noexcept;
71 bool isMultiSegmentSlot() const noexcept;
72 bool isCurvedSlot() const noexcept;
73
74 // Setters
75 bool setDiameter(const PositiveLength& diameter) noexcept;
76 bool setPath(const NonEmptyPath& path) noexcept;
77
78 // General Methods
79
85 virtual void serialize(SExpression& root) const;
86
87 // Operator Overloadings
88 bool operator==(const PadHole& rhs) const noexcept;
89 bool operator!=(const PadHole& rhs) const noexcept { return !(*this == rhs); }
90 PadHole& operator=(const PadHole& rhs) noexcept;
91
92protected: // Data
96};
97
98/*******************************************************************************
99 * Class PadHoleList
100 ******************************************************************************/
101
103 static constexpr const char* tagname = "hole";
104};
107
108/*******************************************************************************
109 * End of File
110 ******************************************************************************/
111
112} // namespace librepcb
113
114#endif
The PadHole class.
Definition: padhole.h:44
Signal< PadHole, Event > onEdited
Definition: padhole.h:54
bool isSlot() const noexcept
Definition: padhole.cpp:67
bool isMultiSegmentSlot() const noexcept
Definition: padhole.cpp:71
PadHole & operator=(const PadHole &rhs) noexcept
Definition: padhole.cpp:124
virtual ~PadHole() noexcept
Definition: padhole.cpp:60
Uuid mUuid
Definition: padhole.h:93
Event
Definition: padhole.h:49
Slot< PadHole, Event > OnEditedSlot
Definition: padhole.h:55
NonEmptyPath mPath
Definition: padhole.h:95
bool setPath(const NonEmptyPath &path) noexcept
Definition: padhole.cpp:93
const PositiveLength & getDiameter() const noexcept
Definition: padhole.h:68
virtual void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: padhole.cpp:107
const Uuid & getUuid() const noexcept
Definition: padhole.h:67
bool isCurvedSlot() const noexcept
Definition: padhole.cpp:75
PositiveLength mDiameter
Definition: padhole.h:94
bool setDiameter(const PositiveLength &diameter) noexcept
Definition: padhole.cpp:83
const NonEmptyPath & getPath() const noexcept
Definition: padhole.h:69
The SExpression class.
Definition: sexpression.h:69
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
The Slot class is used to receive signals from non-QObject derived classes.
Definition: signalslot.h:170
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:222
Definition: padhole.h:102
static constexpr const char * tagname
Definition: padhole.h:103