LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
package.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_PACKAGE_H
21 #define LIBREPCB_LIBRARY_PACKAGE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../libraryelement.h"
27 #include "footprint.h"
28 #include "packagepad.h"
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace library {
37 
38 /*******************************************************************************
39  * Class Package
40  ******************************************************************************/
41 
56 class Package final : public LibraryElement {
57  Q_OBJECT
58 
59 public:
60  // Constructors / Destructor
61  Package() = delete;
62  Package(const Package& other) = delete;
63  Package(const Uuid& uuid, const Version& version, const QString& author,
64  const ElementName& name_en_US, const QString& description_en_US,
65  const QString& keywords_en_US);
66  explicit Package(std::unique_ptr<TransactionalDirectory> directory);
67  ~Package() noexcept;
68 
69  // Getters
70  PackagePadList& getPads() noexcept { return mPads; }
71  const PackagePadList& getPads() const noexcept { return mPads; }
72  FootprintList& getFootprints() noexcept { return mFootprints; }
73  const FootprintList& getFootprints() const noexcept { return mFootprints; }
74 
75  // General Methods
76  virtual LibraryElementCheckMessageList runChecks() const override;
77 
78  // Operator Overloadings
79  Package& operator=(const Package& rhs) = delete;
80 
81  // Static Methods
82  static QString getShortElementName() noexcept {
83  return QStringLiteral("pkg");
84  }
85  static QString getLongElementName() noexcept {
86  return QStringLiteral("package");
87  }
88 
89 private: // Methods
91  void serialize(SExpression& root) const override;
92 
93 private: // Data
96 };
97 
98 /*******************************************************************************
99  * End of File
100  ******************************************************************************/
101 
102 } // namespace library
103 } // namespace librepcb
104 
105 #endif // LIBREPCB_LIBRARY_PACKAGE_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 LibraryElementCheckMessageList runChecks() const override
Definition: package.cpp:65
The Package class represents a package of a component (including footprint and 3D model) ...
Definition: package.h:56
FootprintList & getFootprints() noexcept
Definition: package.h:72
static QString getShortElementName() noexcept
Definition: package.h:82
~Package() noexcept
Definition: package.cpp:58
const PackagePadList & getPads() const noexcept
Definition: package.h:71
FootprintList mFootprints
minimum one footprint
Definition: package.h:95
static QString getLongElementName() noexcept
Definition: package.h:85
The LibraryElement class extends the LibraryBaseElement class with some attributes and methods which ...
Definition: libraryelement.h:45
PackagePadList mPads
empty list if the package has no pads
Definition: package.h:94
PackagePadList & getPads() noexcept
Definition: package.h:70
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: package.cpp:74
Package & operator=(const Package &rhs)=delete
The SExpression class.
Definition: sexpression.h:57
const FootprintList & getFootprints() const noexcept
Definition: package.h:73
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:92