LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
libraryelement.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_LIBRARY_LIBRARYELEMENT_H
21 #define LIBREPCB_LIBRARY_LIBRARYELEMENT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "librarybaseelement.h"
27 
28 #include <QtCore>
29 
30 /*******************************************************************************
31  * Namespace / Forward Declarations
32  ******************************************************************************/
33 namespace librepcb {
34 namespace library {
35 
36 /*******************************************************************************
37  * Class LibraryElement
38  ******************************************************************************/
39 
46  Q_OBJECT
47 
48 public:
49  // Constructors / Destructor
50  LibraryElement() = delete;
51  LibraryElement(const LibraryElement& other) = delete;
52  LibraryElement(const QString& shortElementName,
53  const QString& longElementName, const Uuid& uuid,
54  const Version& version, const QString& author,
55  const ElementName& name_en_US,
56  const QString& description_en_US,
57  const QString& keywords_en_US);
58  LibraryElement(std::unique_ptr<TransactionalDirectory> directory,
59  const QString& shortElementName,
60  const QString& longElementName);
61  virtual ~LibraryElement() noexcept;
62 
63  // Getters: Attributes
64  const QSet<Uuid>& getCategories() const noexcept { return mCategories; }
65 
66  // Setters: Attributes
67  void setCategories(const QSet<Uuid>& uuids) noexcept { mCategories = uuids; }
68 
69  // General Methods
70  virtual LibraryElementCheckMessageList runChecks() const override;
71 
72  // Operator Overloadings
73  LibraryElement& operator=(const LibraryElement& rhs) = delete;
74 
75 protected:
76  // Protected Methods
77 
79  virtual void serialize(SExpression& root) const override;
80 
81  // General Library Element Attributes
82  QSet<Uuid> mCategories;
83 };
84 
85 /*******************************************************************************
86  * End of File
87  ******************************************************************************/
88 
89 } // namespace library
90 } // namespace librepcb
91 
92 #endif // LIBREPCB_LIBRARY_LIBRARYELEMENT_H
The Version class represents a version number in the format "1.42.7".
Definition: version.h:60
QVector< std::shared_ptr< const LibraryElementCheckMessage > > LibraryElementCheckMessageList
Definition: libraryelementcheckmessage.h:96
virtual void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: libraryelement.cpp:80
QSet< Uuid > mCategories
Definition: libraryelement.h:82
virtual ~LibraryElement() noexcept
Definition: libraryelement.cpp:64
void setCategories(const QSet< Uuid > &uuids) noexcept
Definition: libraryelement.h:67
virtual LibraryElementCheckMessageList runChecks() const override
Definition: libraryelement.cpp:71
The LibraryBaseElement class.
Definition: librarybaseelement.h:52
const QSet< Uuid > & getCategories() const noexcept
Definition: libraryelement.h:64
The LibraryElement class extends the LibraryBaseElement class with some attributes and methods which ...
Definition: libraryelement.h:45
LibraryElement & operator=(const LibraryElement &rhs)=delete
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The SExpression class.
Definition: sexpression.h:57
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:92