LibrePCB Developers Documentation
packagepad.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_PACKAGEPAD_H
21#define LIBREPCB_CORE_PACKAGEPAD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../serialization/serializableobjectlist.h"
27#include "../../types/circuitidentifier.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36/*******************************************************************************
37 * Class PackagePad
38 ******************************************************************************/
39
47class PackagePad final {
48 Q_DECLARE_TR_FUNCTIONS(PackagePad)
49
50public:
51 // Signals
52 enum class Event {
53 UuidChanged,
54 NameChanged,
55 };
58
59 // Constructors / Destructor
60 PackagePad() = delete;
61 PackagePad(const PackagePad& other) noexcept;
62 PackagePad(const Uuid& uuid, const CircuitIdentifier& name) noexcept;
63 explicit PackagePad(const SExpression& node);
64 ~PackagePad() noexcept;
65
66 // Getters
67 const Uuid& getUuid() const noexcept { return mUuid; }
68 CircuitIdentifier getName() const noexcept { return mName; }
69
70 // Setters
71 bool setName(const CircuitIdentifier& name) noexcept;
72
73 // General Methods
74
80 void serialize(SExpression& root) const;
81
82 // Operator Overloadings
83 bool operator==(const PackagePad& rhs) const noexcept;
84 bool operator!=(const PackagePad& rhs) const noexcept {
85 return !(*this == rhs);
86 }
87 PackagePad& operator=(const PackagePad& rhs) noexcept;
88
89private: // Data
92};
93
94/*******************************************************************************
95 * Class PackagePadList
96 ******************************************************************************/
97
99 static constexpr const char* tagname = "pad";
100};
104
105/*******************************************************************************
106 * End of File
107 ******************************************************************************/
108
109} // namespace librepcb
110
111#endif
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:47
bool setName(const CircuitIdentifier &name) noexcept
Definition: packagepad.cpp:57
Slot< PackagePad, Event > OnEditedSlot
Definition: packagepad.h:57
Uuid mUuid
Definition: packagepad.h:90
Event
Definition: packagepad.h:52
CircuitIdentifier getName() const noexcept
Definition: packagepad.h:68
~PackagePad() noexcept
Definition: packagepad.cpp:50
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: packagepad.cpp:71
bool operator==(const PackagePad &rhs) const noexcept
Definition: packagepad.cpp:80
const Uuid & getUuid() const noexcept
Definition: packagepad.h:67
CircuitIdentifier mName
Definition: packagepad.h:91
Signal< PackagePad, Event > onEdited
Definition: packagepad.h:56
PackagePad & operator=(const PackagePad &rhs) noexcept
Definition: packagepad.cpp:86
bool operator!=(const PackagePad &rhs) const noexcept
Definition: packagepad.h:84
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< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96
Definition: packagepad.h:98
static constexpr const char * tagname
Definition: packagepad.h:99