LibrePCB Developers Documentation
Loading...
Searching...
No Matches
Package Class Referencefinal

The Package class represents a package of a component (including footprint and 3D model) More...

#include <package.h>

+ Inheritance diagram for Package:
+ Collaboration diagram for Package:

Classes

struct  AlternativeName
 

Public Types

enum class  AssemblyType
 

Public Member Functions

 Package ()=delete
 
 Package (const Package &other)=delete
 
 Package (const Uuid &uuid, const Version &version, const QString &author, const ElementName &name_en_US, const QString &description_en_US, const QString &keywords_en_US, AssemblyType assemblyType)
 
 ~Package () noexcept
 
const QList< AlternativeName > & getAlternativeNames () const noexcept
 
AssemblyType getAssemblyType (bool resolveAuto) const noexcept
 
AssemblyType guessAssemblyType () const noexcept
 
PackagePadListgetPads () noexcept
 
const PackagePadListgetPads () const noexcept
 
PackageModelListgetModels () noexcept
 
const PackageModelListgetModels () const noexcept
 
QVector< std::shared_ptr< const PackageModel > > getModelsForFootprint (const Uuid &fpt) const noexcept
 
FootprintListgetFootprints () noexcept
 
const FootprintListgetFootprints () const noexcept
 
void setAssemblyType (AssemblyType type) noexcept
 
virtual RuleCheckMessageList runChecks () const override
 
Packageoperator= (const Package &rhs)=delete
 
- Public Member Functions inherited from LibraryElement
 LibraryElement ()=delete
 
 LibraryElement (const LibraryElement &other)=delete
 
 LibraryElement (const QString &shortElementName, const QString &longElementName, const Uuid &uuid, const Version &version, const QString &author, const ElementName &name_en_US, const QString &description_en_US, const QString &keywords_en_US)
 
 LibraryElement (const QString &shortElementName, const QString &longElementName, bool dirnameMustBeUuid, std::unique_ptr< TransactionalDirectory > directory, const SExpression &root)
 
virtual ~LibraryElement () noexcept
 
const QString & getGeneratedBy () const noexcept
 
const QSet< Uuid > & getCategories () const noexcept
 
const ResourceListgetResources () const noexcept
 
void setGeneratedBy (const QString &gen) noexcept
 
void setCategories (const QSet< Uuid > &uuids) noexcept
 
void setResources (const ResourceList &resources) noexcept
 
LibraryElementoperator= (const LibraryElement &rhs)=delete
 
- Public Member Functions inherited from LibraryBaseElement
 LibraryBaseElement ()=delete
 
 LibraryBaseElement (const LibraryBaseElement &other)=delete
 
 LibraryBaseElement (const QString &shortElementName, const QString &longElementName, const Uuid &uuid, const Version &version, const QString &author, const ElementName &name_en_US, const QString &description_en_US, const QString &keywords_en_US)
 
 LibraryBaseElement (const QString &shortElementName, const QString &longElementName, bool dirnameMustBeUuid, std::unique_ptr< TransactionalDirectory > directory, const SExpression &root)
 
virtual ~LibraryBaseElement () noexcept
 
const TransactionalDirectorygetDirectory () const noexcept
 
TransactionalDirectorygetDirectory () noexcept
 
const UuidgetUuid () const noexcept
 
const VersiongetVersion () const noexcept
 
const QString & getAuthor () const noexcept
 
const QDateTime & getCreated () const noexcept
 
bool isDeprecated () const noexcept
 
const LocalizedNameMapgetNames () const noexcept
 
const LocalizedDescriptionMapgetDescriptions () const noexcept
 
const LocalizedKeywordsMapgetKeywords () const noexcept
 
QStringList getAllAvailableLocales () const noexcept
 
const QSet< SExpression > & getMessageApprovals () const noexcept
 
void setVersion (const Version &version) noexcept
 
void setAuthor (const QString &author) noexcept
 
void setDeprecated (bool deprecated) noexcept
 
void setNames (const LocalizedNameMap &names) noexcept
 
void setDescriptions (const LocalizedDescriptionMap &descriptions) noexcept
 
void setKeywords (const LocalizedKeywordsMap &keywords) noexcept
 
void setMessageApprovals (const QSet< SExpression > &approvals) noexcept
 
virtual void save ()
 
virtual void saveTo (TransactionalDirectory &dest)
 
virtual void moveTo (TransactionalDirectory &dest)
 
virtual void saveIntoParentDirectory (TransactionalDirectory &dest)
 
virtual void moveIntoParentDirectory (TransactionalDirectory &dest)
 
LibraryBaseElementoperator= (const LibraryBaseElement &rhs)=delete
 

Static Public Member Functions

static std::unique_ptr< Packageopen (std::unique_ptr< TransactionalDirectory > directory, bool abortBeforeMigration=false)
 
static QString getShortElementName () noexcept
 
static QString getLongElementName () noexcept
 
- Static Public Member Functions inherited from LibraryBaseElement
template<typename ElementType >
static bool isValidElementDirectory (const FilePath &dir) noexcept
 
template<typename ElementType >
static bool isValidElementDirectory (const TransactionalDirectory &dir, const QString &path) noexcept
 

Protected Member Functions

virtual void serialize (SExpression &root) const override
 Serialize into librepcb::SExpression node.
 
- Protected Member Functions inherited from LibraryBaseElement
void serializeMessageApprovals (SExpression &root) const
 
void removeObsoleteMessageApprovals ()
 

Private Member Functions

 Package (std::unique_ptr< TransactionalDirectory > directory, const SExpression &root)
 

Private Attributes

QList< AlternativeNamemAlternativeNames
 Optional.
 
AssemblyType mAssemblyType
 Package assembly type (metadata)
 
PackagePadList mPads
 empty list if the package has no pads
 
PackageModelList mModels
 3D models (optional)
 
FootprintList mFootprints
 minimum one footprint
 

Additional Inherited Members

- Static Protected Member Functions inherited from LibraryBaseElement
static Version readFileFormat (const TransactionalDirectory &directory, const QString &fileName)
 
- Protected Attributes inherited from LibraryElement
QString mGeneratedBy
 If not empty, the element is generated.
 
QSet< UuidmCategories
 
ResourceList mResources
 
- Protected Attributes inherited from LibraryBaseElement
const QString mShortElementName
 e.g. "lib", "cmpcat"
 
const QString mLongElementName
 e.g. "library", "component_category"
 
std::unique_ptr< TransactionalDirectorymDirectory
 
Uuid mUuid
 
Version mVersion
 
QString mAuthor
 
QDateTime mCreated
 
bool mIsDeprecated
 
LocalizedNameMap mNames
 
LocalizedDescriptionMap mDescriptions
 
LocalizedKeywordsMap mKeywords
 
QSet< SExpressionmMessageApprovals
 

Detailed Description

The Package class represents a package of a component (including footprint and 3D model)

Following information is considered as the "interface" of a package and must therefore never be changed:

  • UUID
  • Package pads (neither adding nor removing pads is allowed)
    • UUID
  • Footprints (adding new footprints is allowed, but removing not)
    • UUID
    • Footprint pads (neither adding nor removing pads is allowed)
      • UUID

Member Enumeration Documentation

◆ AssemblyType

enum class AssemblyType
strong
Enumerator
None 

Nothing to mount (i.e. not a package, just a footprint)

Tht 

Pure THT package.

Smt 

Pure SMT package.

Mixed 

Mixed THT/SMT package.

Other 

Anything special, e.g. mechanical parts.

Auto 

Auto detection (deprecated, only for file format migration!)

Constructor & Destructor Documentation

◆ Package() [1/4]

Package ( )
delete
+ Here is the caller graph for this function:

◆ Package() [2/4]

Package ( const Package other)
delete

◆ Package() [3/4]

Package ( const Uuid uuid,
const Version version,
const QString &  author,
const ElementName name_en_US,
const QString &  description_en_US,
const QString &  keywords_en_US,
AssemblyType  assemblyType 
)

◆ ~Package()

~Package ( )
noexcept

◆ Package() [4/4]

Package ( std::unique_ptr< TransactionalDirectory directory,
const SExpression root 
)
private
+ Here is the call graph for this function:

Member Function Documentation

◆ getAlternativeNames()

const QList< AlternativeName > & getAlternativeNames ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getAssemblyType()

Package::AssemblyType getAssemblyType ( bool  resolveAuto) const
noexcept
+ Here is the caller graph for this function:

◆ guessAssemblyType()

Package::AssemblyType guessAssemblyType ( ) const
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPads() [1/2]

PackagePadList & getPads ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getPads() [2/2]

const PackagePadList & getPads ( ) const
inlinenoexcept

◆ getModels() [1/2]

PackageModelList & getModels ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getModels() [2/2]

const PackageModelList & getModels ( ) const
inlinenoexcept

◆ getModelsForFootprint()

QVector< std::shared_ptr< const PackageModel > > getModelsForFootprint ( const Uuid fpt) const
noexcept
+ Here is the caller graph for this function:

◆ getFootprints() [1/2]

FootprintList & getFootprints ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getFootprints() [2/2]

const FootprintList & getFootprints ( ) const
inlinenoexcept

◆ setAssemblyType()

void setAssemblyType ( AssemblyType  type)
inlinenoexcept
+ Here is the caller graph for this function:

◆ runChecks()

RuleCheckMessageList runChecks ( ) const
overridevirtual

Reimplemented from LibraryElement.

+ Here is the call graph for this function:

◆ operator=()

Package & operator= ( const Package rhs)
delete

◆ open()

std::unique_ptr< Package > open ( std::unique_ptr< TransactionalDirectory directory,
bool  abortBeforeMigration = false 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShortElementName()

static QString getShortElementName ( )
inlinestaticnoexcept
+ Here is the caller graph for this function:

◆ getLongElementName()

static QString getLongElementName ( )
inlinestaticnoexcept
+ Here is the caller graph for this function:

◆ serialize()

void serialize ( SExpression root) const
overrideprotectedvirtual

Serialize into librepcb::SExpression node.

Parameters
rootRoot node to serialize into.

Reimplemented from LibraryElement.

+ Here is the call graph for this function:

Member Data Documentation

◆ mAlternativeNames

QList<AlternativeName> mAlternativeNames
private

Optional.

◆ mAssemblyType

AssemblyType mAssemblyType
private

Package assembly type (metadata)

◆ mPads

PackagePadList mPads
private

empty list if the package has no pads

◆ mModels

PackageModelList mModels
private

3D models (optional)

◆ mFootprints

FootprintList mFootprints
private

minimum one footprint


The documentation for this class was generated from the following files: