LibrePCB Developers Documentation
Component Class Referencefinal

The Component class represents a "generic" device in the library. More...

#include <component.h>

+ Inheritance diagram for Component:
+ Collaboration diagram for Component:

Public Member Functions

 Component ()=delete
 
 Component (const Component &other)=delete
 
 Component (const Uuid &uuid, const Version &version, const QString &author, const ElementName &name_en_US, const QString &description_en_US, const QString &keywords_en_US)
 
 ~Component () noexcept
 
bool isSchematicOnly () const noexcept
 
void setIsSchematicOnly (bool schematicOnly) noexcept
 
AttributeListgetAttributes () noexcept
 
const AttributeListgetAttributes () const noexcept
 
const QString & getDefaultValue () const noexcept
 
void setDefaultValue (const QString &value) noexcept
 
const NormDependentPrefixMapgetPrefixes () const noexcept
 
void setPrefixes (const NormDependentPrefixMap &prefixes) noexcept
 
ComponentSignalListgetSignals () noexcept
 
const ComponentSignalListgetSignals () const noexcept
 
ComponentSymbolVariantListgetSymbolVariants () noexcept
 
const ComponentSymbolVariantListgetSymbolVariants () const noexcept
 
std::shared_ptr< ComponentSignalgetSignalOfPin (const Uuid &symbVar, const Uuid &item, const Uuid &pin)
 
std::shared_ptr< const ComponentSignalgetSignalOfPin (const Uuid &symbVar, const Uuid &item, const Uuid &pin) const
 
int getSymbolVariantIndexByNorm (const QStringList &normOrder) const noexcept
 
std::shared_ptr< ComponentSymbolVariantItemgetSymbVarItem (const Uuid &symbVar, const Uuid &item)
 
std::shared_ptr< const ComponentSymbolVariantItemgetSymbVarItem (const Uuid &symbVar, const Uuid &item) const
 
virtual RuleCheckMessageList runChecks () const override
 
Componentoperator= (const Component &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< Componentopen (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. More...
 
- Protected Member Functions inherited from LibraryBaseElement
void serializeMessageApprovals (SExpression &root) const
 
void removeObsoleteMessageApprovals ()
 

Private Member Functions

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

Static Private Member Functions

static QString cleanNorm (QString norm) noexcept
 

Private Attributes

bool mSchematicOnly
 
QString mDefaultValue
 
NormDependentPrefixMap mPrefixes
 
AttributeList mAttributes
 all attributes in a specific order More...
 
ComponentSignalList mSignals
 
ComponentSymbolVariantList mSymbolVariants
 

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. More...
 
QSet< UuidmCategories
 
ResourceList mResources
 
- Protected Attributes inherited from LibraryBaseElement
const QString mShortElementName
 e.g. "lib", "cmpcat" More...
 
const QString mLongElementName
 e.g. "library", "component_category" More...
 
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 Component class represents a "generic" device in the library.

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

  • UUID
  • Property "is schematic only"
  • All signal UUIDs (and their meaning)
  • Symbol variants (adding new variants is allowed, but removing not)
    • UUID
    • Symbol items (neither adding nor removing items is allowed)
      • UUID
      • Symbol UUID
      • Pin-signal-mapping

Constructor & Destructor Documentation

◆ Component() [1/4]

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

◆ Component() [2/4]

Component ( const Component other)
delete

◆ Component() [3/4]

Component ( const Uuid uuid,
const Version version,
const QString &  author,
const ElementName name_en_US,
const QString &  description_en_US,
const QString &  keywords_en_US 
)

◆ ~Component()

~Component ( )
noexcept

◆ Component() [4/4]

Component ( std::unique_ptr< TransactionalDirectory directory,
const SExpression root 
)
private

Member Function Documentation

◆ isSchematicOnly()

bool isSchematicOnly ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ setIsSchematicOnly()

void setIsSchematicOnly ( bool  schematicOnly)
inlinenoexcept
+ Here is the caller graph for this function:

◆ getAttributes() [1/2]

AttributeList& getAttributes ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getAttributes() [2/2]

const AttributeList& getAttributes ( ) const
inlinenoexcept

◆ getDefaultValue()

const QString& getDefaultValue ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ setDefaultValue()

void setDefaultValue ( const QString &  value)
inlinenoexcept
+ Here is the caller graph for this function:

◆ getPrefixes()

const NormDependentPrefixMap& getPrefixes ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ setPrefixes()

void setPrefixes ( const NormDependentPrefixMap prefixes)
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSignals() [1/2]

ComponentSignalList& getSignals ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSignals() [2/2]

const ComponentSignalList& getSignals ( ) const
inlinenoexcept

◆ getSymbolVariants() [1/2]

ComponentSymbolVariantList& getSymbolVariants ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSymbolVariants() [2/2]

const ComponentSymbolVariantList& getSymbolVariants ( ) const
inlinenoexcept

◆ getSignalOfPin() [1/2]

std::shared_ptr< ComponentSignal > getSignalOfPin ( const Uuid symbVar,
const Uuid item,
const Uuid pin 
)
+ Here is the call graph for this function:

◆ getSignalOfPin() [2/2]

std::shared_ptr< const ComponentSignal > getSignalOfPin ( const Uuid symbVar,
const Uuid item,
const Uuid pin 
) const
+ Here is the call graph for this function:

◆ getSymbolVariantIndexByNorm()

int getSymbolVariantIndexByNorm ( const QStringList &  normOrder) const
noexcept
+ Here is the call graph for this function:

◆ getSymbVarItem() [1/2]

std::shared_ptr< ComponentSymbolVariantItem > getSymbVarItem ( const Uuid symbVar,
const Uuid item 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSymbVarItem() [2/2]

std::shared_ptr< const ComponentSymbolVariantItem > getSymbVarItem ( const Uuid symbVar,
const Uuid item 
) const
+ Here is the call graph for this function:

◆ runChecks()

RuleCheckMessageList runChecks ( ) const
overridevirtual

Reimplemented from LibraryElement.

+ Here is the call graph for this function:

◆ operator=()

Component& operator= ( const Component rhs)
delete

◆ open()

std::unique_ptr< Component > 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 call graph for this function:
+ 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:

◆ cleanNorm()

QString cleanNorm ( QString  norm)
staticprivatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mSchematicOnly

bool mSchematicOnly
private

if true, this component is schematic-only (no package)

◆ mDefaultValue

QString mDefaultValue
private

◆ mPrefixes

NormDependentPrefixMap mPrefixes
private

◆ mAttributes

AttributeList mAttributes
private

all attributes in a specific order

◆ mSignals

ComponentSignalList mSignals
private

◆ mSymbolVariants

ComponentSymbolVariantList mSymbolVariants
private

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