20#ifndef LIBREPCB_CORE_DEVICEPADSIGNALMAP_H
21#define LIBREPCB_CORE_DEVICEPADSIGNALMAP_H
26#include "../../serialization/serializableobjectlist.h"
56 const std::optional<Uuid>& signal)
noexcept;
84 return !(*
this == rhs);
99 static constexpr const char*
tagname =
"pad";
115 const Uuid& pad)
noexcept {
116 std::shared_ptr<const DevicePadSignalMapItem> item = map.find(pad);
117 return item ? item->getSignalUuid() : std::nullopt;
122 foreach (
const Uuid& pad, pads) {
123 map.
append(std::make_shared<DevicePadSignalMapItem>(pad, std::nullopt));
129 foreach (
const Uuid& pad, map.getUuidSet() - pads) {
132 foreach (
const Uuid& pad, pads - map.getUuidSet()) {
133 map.append(std::make_shared<DevicePadSignalMapItem>(pad, std::nullopt));
135 Q_ASSERT(map.getUuidSet() == pads);
Definition devicepadsignalmap.h:110
DevicePadSignalMapHelpers()=delete
static DevicePadSignalMap create(const QSet< Uuid > pads) noexcept
Definition devicepadsignalmap.h:120
static void setPads(DevicePadSignalMap &map, QSet< Uuid > pads) noexcept
Definition devicepadsignalmap.h:128
static std::optional< Uuid > tryGetSignalUuid(const DevicePadSignalMap &map, const Uuid &pad) noexcept
Definition devicepadsignalmap.h:114
The DevicePadSignalMapItem class.
Definition devicepadsignalmap.h:42
std::optional< Uuid > mSignalUuid
std::nullopt if not connected to a signal
Definition devicepadsignalmap.h:91
~DevicePadSignalMapItem() noexcept
Definition devicepadsignalmap.cpp:52
DevicePadSignalMapItem & operator=(const DevicePadSignalMapItem &rhs) noexcept
Definition devicepadsignalmap.cpp:90
Slot< DevicePadSignalMapItem, Event > OnEditedSlot
Definition devicepadsignalmap.h:50
Event
Definition devicepadsignalmap.h:45
DevicePadSignalMapItem()=delete
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition devicepadsignalmap.cpp:74
const Uuid & getUuid() const noexcept
Definition devicepadsignalmap.h:61
Signal< DevicePadSignalMapItem, Event > onEdited
Definition devicepadsignalmap.h:49
bool operator!=(const DevicePadSignalMapItem &rhs) const noexcept
Definition devicepadsignalmap.h:83
Uuid mPadUuid
must be valid
Definition devicepadsignalmap.h:89
bool operator==(const DevicePadSignalMapItem &rhs) const noexcept
Definition devicepadsignalmap.cpp:83
bool setSignalUuid(const std::optional< Uuid > &uuid) noexcept
Definition devicepadsignalmap.cpp:59
const Uuid & getPadUuid() const noexcept
Definition devicepadsignalmap.h:64
const std::optional< Uuid > & getSignalUuid() const noexcept
Definition devicepadsignalmap.h:65
The SExpression class.
Definition sexpression.h:69
int append(const std::shared_ptr< T > &obj) noexcept
Definition serializableobjectlist.h:342
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:76
Definition devicepadsignalmap.h:98
static constexpr const char * tagname
Definition devicepadsignalmap.h:99