LibrePCB Developers Documentation
Loading...
Searching...
No Matches
assemblyvariant.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_ASSEMBLYVARIANT_H
21#define LIBREPCB_CORE_ASSEMBLYVARIANT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../serialization/serializableobjectlist.h"
27#include "../../types/fileproofname.h"
28#include "../../types/uuid.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class AssemblyVariant
39 ******************************************************************************/
40
44class AssemblyVariant final {
45public:
46 // Signals
47 enum class Event {
50 };
53
54 // Constructors / Destructor
55 AssemblyVariant() = delete;
56 AssemblyVariant(const AssemblyVariant& other) noexcept;
57 explicit AssemblyVariant(const SExpression& node);
58 AssemblyVariant(const Uuid& uuid, const FileProofName& name,
59 const QString& description);
60 ~AssemblyVariant() noexcept;
61
62 // Getters
63 const Uuid& getUuid() const noexcept { return mUuid; }
64 const FileProofName& getName() const noexcept { return mName; }
65 const QString& getDescription() const noexcept { return mDescription; }
66 QString getDisplayText() const noexcept;
67
68 // Setters
69 void setName(const FileProofName& name) noexcept;
70 void setDescription(const QString& description) noexcept;
71
72 // General Methods
73
79 void serialize(SExpression& root) const;
80
81 // Operator Overloadings
82 AssemblyVariant& operator=(const AssemblyVariant& rhs) = delete;
83 bool operator==(const AssemblyVariant& rhs) = delete;
84
85private:
88 QString mDescription;
89};
90
91/*******************************************************************************
92 * Non-Member Functions
93 ******************************************************************************/
94
95inline std::size_t qHash(const std::shared_ptr<AssemblyVariant>& key,
96 std::size_t seed = 0) noexcept {
97 return ::qHash(key.get(), seed);
98}
99
100/*******************************************************************************
101 * Class AssemblyVariantList
102 ******************************************************************************/
103
105 static constexpr const char* tagname = "variant";
106};
110
111} // namespace librepcb
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117#endif
The AssemblyVariant class.
Definition assemblyvariant.h:44
QString mDescription
Definition assemblyvariant.h:88
Slot< AssemblyVariant, Event > OnEditedSlot
Definition assemblyvariant.h:52
Uuid mUuid
Definition assemblyvariant.h:86
const QString & getDescription() const noexcept
Definition assemblyvariant.h:65
Event
Definition assemblyvariant.h:47
FileProofName mName
Definition assemblyvariant.h:87
QString getDisplayText() const noexcept
Definition assemblyvariant.cpp:62
void setName(const FileProofName &name) noexcept
Definition assemblyvariant.cpp:74
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition assemblyvariant.cpp:92
const FileProofName & getName() const noexcept
Definition assemblyvariant.h:64
const Uuid & getUuid() const noexcept
Definition assemblyvariant.h:63
void setDescription(const QString &description) noexcept
Definition assemblyvariant.cpp:81
Signal< AssemblyVariant, Event > onEdited
Definition assemblyvariant.h:51
~AssemblyVariant() noexcept
Definition assemblyvariant.cpp:55
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:76
std::size_t qHash(const AttributeKey &key, std::size_t seed=0) noexcept
Definition attributekey.h:118
type_safe::constrained_type< QString, FileProofNameConstraint, FileProofNameVerifier > FileProofName
Definition fileproofname.h:88
Definition uuid.h:186
Definition assemblyvariant.h:104