LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentsymbolvariant.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_COMPONENTSYMBOLVARIANT_H
21#define LIBREPCB_CORE_COMPONENTSYMBOLVARIANT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../serialization/serializablekeyvaluemap.h"
27#include "../../serialization/serializableobjectlist.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class ComponentSymbolVariant
39 ******************************************************************************/
40
54public:
55 // Signals
65
66 // Constructors / Destructor
69 ComponentSymbolVariant(const Uuid& uuid, const QString& norm,
70 const ElementName& name_en_US,
71 const QString& desc_en_US) noexcept;
72 explicit ComponentSymbolVariant(const SExpression& node);
73 ~ComponentSymbolVariant() noexcept;
74
75 // Getters: Attributes
76 const Uuid& getUuid() const noexcept { return mUuid; }
77 const QString& getNorm() const noexcept { return mNorm; }
78 const ElementName& getName() const noexcept {
79 return mNames.getDefaultValue(); // Used for SerializableObjectList
80 }
81 const LocalizedNameMap& getNames() const noexcept { return mNames; }
82 const LocalizedDescriptionMap& getDescriptions() const noexcept {
83 return mDescriptions;
84 }
85
86 // Setters
87 bool setNorm(const QString& norm) noexcept;
88 bool setName(const QString& locale, const ElementName& name) noexcept;
89 bool setDescription(const QString& locale, const QString& desc) noexcept;
90 bool setNames(const LocalizedNameMap& names) noexcept;
91 bool setDescriptions(const LocalizedDescriptionMap& descriptions) noexcept;
92
93 // Symbol Item Methods
98 return mSymbolItems;
99 }
104
105 // General Methods
106
112 void serialize(SExpression& root) const;
113
114 // Operator Overloadings
115 bool operator==(const ComponentSymbolVariant& rhs) const noexcept;
116 bool operator!=(const ComponentSymbolVariant& rhs) const noexcept {
117 return !(*this == rhs);
118 }
120
121private: // Methods
122 void itemsEdited(
123 const ComponentSymbolVariantItemList& list, int index,
124 const std::shared_ptr<const ComponentSymbolVariantItem>& item,
126
127private: // Data
129 QString mNorm;
133
134 // Slots
136};
137
138/*******************************************************************************
139 * Class ComponentSymbolVariantList
140 ******************************************************************************/
141
143 static constexpr const char* tagname = "variant";
144};
149
150/*******************************************************************************
151 * End of File
152 ******************************************************************************/
153
154} // namespace librepcb
155
156#endif
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition componentsymbolvariant.h:53
const QString & getNorm() const noexcept
Definition componentsymbolvariant.h:77
const LocalizedNameMap & getNames() const noexcept
Definition componentsymbolvariant.h:81
ComponentSymbolVariantItemList & getSymbolItems() noexcept
Definition componentsymbolvariant.h:94
ComponentSymbolVariant & operator=(const ComponentSymbolVariant &rhs) noexcept
Definition componentsymbolvariant.cpp:164
const ComponentSymbolVariantItemList & getSymbolItems() const noexcept
Definition componentsymbolvariant.h:97
Signal< ComponentSymbolVariant, Event > onEdited
Definition componentsymbolvariant.h:63
const ElementName & getName() const noexcept
Definition componentsymbolvariant.h:78
Uuid mUuid
Definition componentsymbolvariant.h:128
bool setDescriptions(const LocalizedDescriptionMap &descriptions) noexcept
Definition componentsymbolvariant.cpp:123
bool setDescription(const QString &locale, const QString &desc) noexcept
Definition componentsymbolvariant.cpp:102
Event
Definition componentsymbolvariant.h:56
Slot< ComponentSymbolVariant, Event > OnEditedSlot
Definition componentsymbolvariant.h:64
~ComponentSymbolVariant() noexcept
Definition componentsymbolvariant.cpp:74
LocalizedDescriptionMap mDescriptions
Definition componentsymbolvariant.h:131
ComponentSymbolVariantItemList mSymbolItems
Definition componentsymbolvariant.h:132
bool operator!=(const ComponentSymbolVariant &rhs) const noexcept
Definition componentsymbolvariant.h:116
QSet< Uuid > getAllSymbolUuids() const noexcept
Definition componentsymbolvariant.h:100
bool setNorm(const QString &norm) noexcept
Definition componentsymbolvariant.cpp:81
bool setName(const QString &locale, const ElementName &name) noexcept
Definition componentsymbolvariant.cpp:91
void itemsEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItemList::Event event) noexcept
Definition componentsymbolvariant.cpp:181
LocalizedNameMap mNames
Definition componentsymbolvariant.h:130
QString mNorm
Definition componentsymbolvariant.h:129
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition componentsymbolvariant.cpp:138
const LocalizedDescriptionMap & getDescriptions() const noexcept
Definition componentsymbolvariant.h:82
const Uuid & getUuid() const noexcept
Definition componentsymbolvariant.h:76
ComponentSymbolVariantItemList::OnEditedSlot mOnItemsEditedSlot
Definition componentsymbolvariant.h:135
bool setNames(const LocalizedNameMap &names) noexcept
Definition componentsymbolvariant.cpp:113
bool operator==(const ComponentSymbolVariant &rhs) const noexcept
Definition componentsymbolvariant.cpp:154
static QSet< Uuid > getAllSymbolUuids(const ComponentSymbolVariantItemList &list) noexcept
Definition componentsymbolvariantitem.h:160
The SExpression class.
Definition sexpression.h:69
const T::ValueType & getDefaultValue() const noexcept
Definition serializablekeyvaluemap.h:105
Slot< SerializableObjectList< ComponentSymbolVariantItem, ComponentSymbolVariantItemListNameProvider, OnEditedArgs... >, int, const std::shared_ptr< const ComponentSymbolVariantItem > &, Event > OnEditedSlot
Definition serializableobjectlist.h:136
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
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition elementname.h:84
Definition componentsymbolvariant.h:142
static constexpr const char * tagname
Definition componentsymbolvariant.h:143