LibrePCB Developers Documentation
Loading...
Searching...
No Matches
devicepadsignalmap.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_DEVICEPADSIGNALMAP_H
21#define LIBREPCB_CORE_DEVICEPADSIGNALMAP_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../serialization/serializableobjectlist.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35/*******************************************************************************
36 * Class DevicePadSignalMapItem
37 ******************************************************************************/
38
43public:
44 // Signals
52
53 // Constructors / Destructor
56 DevicePadSignalMapItem(const Uuid& pad, const std::optional<Uuid>& signal,
57 bool optional = false) noexcept;
58 explicit DevicePadSignalMapItem(const SExpression& node);
59 ~DevicePadSignalMapItem() noexcept;
60
61 // Getters
62 const Uuid& getUuid() const noexcept { // used for UuidObjectMap
63 return mPadUuid;
64 }
65 const Uuid& getPadUuid() const noexcept { return mPadUuid; }
66 const std::optional<Uuid>& getSignalUuid() const noexcept {
67 return mSignalUuid;
68 }
69 bool isOptional() const noexcept { return mIsOptional; }
70
71 // Setters
72 bool setSignalUuid(const std::optional<Uuid>& uuid) noexcept;
73 bool setOptional(bool optional) noexcept;
74
75 // General Methods
76
82 void serialize(SExpression& root) const;
83
84 // Operator Overloadings
85 bool operator==(const DevicePadSignalMapItem& rhs) const noexcept;
86 bool operator!=(const DevicePadSignalMapItem& rhs) const noexcept {
87 return !(*this == rhs);
88 }
90
91private: // Data
93 std::optional<Uuid> mSignalUuid;
95};
96
97/*******************************************************************************
98 * Class DevicePadSignalMap
99 ******************************************************************************/
100
102 static constexpr const char* tagname = "pad";
103};
108
109/*******************************************************************************
110 * End of File
111 ******************************************************************************/
112
113} // namespace librepcb
114
115#endif
The DevicePadSignalMapItem class.
Definition devicepadsignalmap.h:42
bool mIsOptional
set to true if another pad can be used instead
Definition devicepadsignalmap.h:94
std::optional< Uuid > mSignalUuid
std::nullopt if not connected to signal
Definition devicepadsignalmap.h:93
DevicePadSignalMapItem & operator=(const DevicePadSignalMapItem &rhs) noexcept
Definition devicepadsignalmap.cpp:114
bool isOptional() const noexcept
Definition devicepadsignalmap.h:69
Slot< DevicePadSignalMapItem, Event > OnEditedSlot
Definition devicepadsignalmap.h:51
Event
Definition devicepadsignalmap.h:45
bool setOptional(bool optional) noexcept
Definition devicepadsignalmap.cpp:80
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition devicepadsignalmap.cpp:94
const Uuid & getUuid() const noexcept
Definition devicepadsignalmap.h:62
Signal< DevicePadSignalMapItem, Event > onEdited
Definition devicepadsignalmap.h:50
bool operator!=(const DevicePadSignalMapItem &rhs) const noexcept
Definition devicepadsignalmap.h:86
Uuid mPadUuid
must be valid
Definition devicepadsignalmap.h:92
bool operator==(const DevicePadSignalMapItem &rhs) const noexcept
Definition devicepadsignalmap.cpp:106
bool setSignalUuid(const std::optional< Uuid > &uuid) noexcept
Definition devicepadsignalmap.cpp:69
const Uuid & getPadUuid() const noexcept
Definition devicepadsignalmap.h:65
const std::optional< Uuid > & getSignalUuid() const noexcept
Definition devicepadsignalmap.h:66
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:56
Definition occmodel.cpp:77
Definition devicepadsignalmap.h:101
static constexpr const char * tagname
Definition devicepadsignalmap.h:102