LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 (const FilePath &elementDirectory, bool readOnly)
 
 ~Component () noexcept
 
bool isSchematicOnly () const noexcept
 
void setIsSchematicOnly (bool schematicOnly) noexcept
 
const AttributeListgetAttributes () const noexcept
 
void setAttributes (const AttributeList &attributes) 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
ComponentSignal
getSignalOfPin (const Uuid &symbVar, const Uuid &item, const Uuid &pin) const
 
std::shared_ptr
< ComponentSymbolVariantItem
getSymbVarItem (const Uuid &symbVar, const Uuid &item)
 
std::shared_ptr< const
ComponentSymbolVariantItem
getSymbVarItem (const Uuid &symbVar, const Uuid &item) const
 
virtual
LibraryElementCheckMessageList 
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 FilePath &elementDirectory, const QString &shortElementName, const QString &longElementName, bool readOnly)
 
virtual ~LibraryElement () noexcept
 
const QSet< Uuid > & getCategories () const noexcept
 
void setCategories (const QSet< Uuid > &uuids) noexcept
 
LibraryElementoperator= (const LibraryElement &rhs)=delete
 
- Public Member Functions inherited from LibraryBaseElement
 LibraryBaseElement ()=delete
 
 LibraryBaseElement (const LibraryBaseElement &other)=delete
 
 LibraryBaseElement (bool dirnameMustBeUuid, 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 FilePath &elementDirectory, bool dirnameMustBeUuid, const QString &shortElementName, const QString &longElementName, bool readOnly)
 
virtual ~LibraryBaseElement () noexcept
 
const FilePathgetFilePath () const noexcept
 
const QString & getShortElementName () const noexcept
 
const QString & getLongElementName () const noexcept
 
bool isOpenedReadOnly () const 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
 
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
 
virtual void save ()
 
virtual void saveTo (const FilePath &destination)
 
virtual void saveIntoParentDirectory (const FilePath &parentDir)
 
virtual void moveTo (const FilePath &destination)
 
virtual void moveIntoParentDirectory (const FilePath &parentDir)
 
LibraryBaseElementoperator= (const LibraryBaseElement &rhs)=delete
 
- Public Member Functions inherited from SerializableObject
 SerializableObject () noexcept
 
virtual ~SerializableObject () noexcept
 
SExpression serializeToDomElement (const QString &name) const
 Serialize the object to a new S-Expression node. More...
 

Static Public Member Functions

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
 
- Static Public Member Functions inherited from SerializableObject
template<typename T >
static void serializeObjectContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName)
 

Private Member Functions

void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from LibraryBaseElement
virtual void cleanupAfterLoadingElementFromFile () noexcept
 
virtual void copyTo (const FilePath &destination, bool removeSource)
 
- Protected Attributes inherited from LibraryElement
QSet< UuidmCategories
 
- Protected Attributes inherited from LibraryBaseElement
FilePath mDirectory
 
bool mDirectoryIsTemporary
 
bool mOpenedReadOnly
 
bool mDirectoryNameMustBeUuid
 
QString mShortElementName
 e.g. "lib", "cmpcat", "sym" More...
 
QString mLongElementName
 e.g. "library", "component_category", "symbol" More...
 
SExpression mLoadingFileDocument
 
Uuid mUuid
 
Version mVersion
 
QString mAuthor
 
QDateTime mCreated
 
bool mIsDeprecated
 
LocalizedNameMap mNames
 
LocalizedDescriptionMap mDescriptions
 
LocalizedKeywordsMap mKeywords
 

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 ( )
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 ( const FilePath elementDirectory,
bool  readOnly 
)

+ Here is the call graph for this function:

~Component ( )
noexcept

Member Function Documentation

bool isSchematicOnly ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void setIsSchematicOnly ( bool  schematicOnly)
inlinenoexcept

+ Here is the caller graph for this function:

const AttributeList& getAttributes ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void setAttributes ( const AttributeList attributes)
inlinenoexcept

+ Here is the caller graph for this function:

const QString& getDefaultValue ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void setDefaultValue ( const QString &  value)
inlinenoexcept

+ Here is the caller graph for this function:

const NormDependentPrefixMap& getPrefixes ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void setPrefixes ( const NormDependentPrefixMap prefixes)
inlinenoexcept

+ Here is the caller graph for this function:

ComponentSignalList& getSignals ( )
inlinenoexcept

+ Here is the caller graph for this function:

const ComponentSignalList& getSignals ( ) const
inlinenoexcept
ComponentSymbolVariantList& getSymbolVariants ( )
inlinenoexcept

+ Here is the caller graph for this function:

const ComponentSymbolVariantList& getSymbolVariants ( ) const
inlinenoexcept
std::shared_ptr< ComponentSignal > getSignalOfPin ( const Uuid symbVar,
const Uuid item,
const Uuid pin 
)

+ Here is the call graph for this function:

std::shared_ptr< const ComponentSignal > getSignalOfPin ( const Uuid symbVar,
const Uuid item,
const Uuid pin 
) const

+ Here is the call graph for this function:

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:

std::shared_ptr< const ComponentSymbolVariantItem > getSymbVarItem ( const Uuid symbVar,
const Uuid item 
) const

+ Here is the call graph for this function:

LibraryElementCheckMessageList runChecks ( ) const
overridevirtual

Reimplemented from LibraryElement.

+ Here is the call graph for this function:

Component& operator= ( const Component rhs)
delete
static QString getShortElementName ( )
inlinestaticnoexcept
static QString getLongElementName ( )
inlinestaticnoexcept
void serialize ( SExpression root) const
overrideprivatevirtual

Serialize the object into an existing S-Expression node.

This method inserts/appends all attributes and childs of the object to an existing S-Expression node. The content which already exists in the given S-Expression node will not be removed.

Note
The generated S-Expression node has always the format of the application's major version (it's not possible to generate DOMs of older versions).
Parameters
rootThe target DOM root node
Exceptions
ExceptionThis method throws an exception if an error occurs.

Reimplemented from LibraryElement.

+ Here is the call graph for this function:

Member Data Documentation

bool mSchematicOnly
private

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

QString mDefaultValue
private
NormDependentPrefixMap mPrefixes
private
AttributeList mAttributes
private

all attributes in a specific order

ComponentSignalList mSignals
private
ComponentSymbolVariantList mSymbolVariants
private

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