LibrePCB Developers Documentation
Attribute Class Referencefinal

The Attribute class. More...

#include <attribute.h>

+ Inheritance diagram for Attribute:
+ Collaboration diagram for Attribute:

Public Types

enum  Event
 
typedef Slot< Attribute, EventOnEditedSlot
 

Public Member Functions

 Attribute ()=delete
 
 Attribute (const Attribute &other) noexcept
 
 Attribute (const SExpression &node)
 
 Attribute (const AttributeKey &key, const AttributeType &type, const QString &value, const AttributeUnit *unit)
 
 ~Attribute () noexcept
 
const AttributeKeygetKey () const noexcept
 
const QString & getName () const noexcept
 
const AttributeTypegetType () const noexcept
 
const AttributeUnitgetUnit () const noexcept
 
const QString & getValue () const noexcept
 
QString getValueTr (bool showUnit) const noexcept
 
bool setKey (const AttributeKey &key) noexcept
 
bool setTypeValueUnit (const AttributeType &type, const QString &value, const AttributeUnit *unit)
 
void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 
bool operator== (const Attribute &rhs) const noexcept
 
bool operator!= (const Attribute &rhs) const noexcept
 
Attributeoperator= (const Attribute &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...
 

Public Attributes

Signal< Attribute, EventonEdited
 

Private Member Functions

bool checkAttributesValidity () const noexcept
 

Private Attributes

AttributeKey mKey
 
const AttributeTypemType
 
QString mValue
 
const AttributeUnitmUnit
 

Additional Inherited Members

- 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)
 

Detailed Description

The Attribute class.

Member Typedef Documentation

◆ OnEditedSlot

Member Enumeration Documentation

◆ Event

enum Event
strong
Enumerator
KeyChanged 
TypeValueUnitChanged 

Constructor & Destructor Documentation

◆ Attribute() [1/4]

Attribute ( )
delete

◆ Attribute() [2/4]

Attribute ( const Attribute other)
noexcept

◆ Attribute() [3/4]

Attribute ( const SExpression node)
explicit
+ Here is the call graph for this function:

◆ Attribute() [4/4]

Attribute ( const AttributeKey key,
const AttributeType type,
const QString &  value,
const AttributeUnit unit 
)
+ Here is the call graph for this function:

◆ ~Attribute()

~Attribute ( )
noexcept

Member Function Documentation

◆ getKey()

const AttributeKey& getKey ( ) const
inlinenoexcept

◆ getName()

const QString& getName ( ) const
inlinenoexcept

◆ getType()

const AttributeType& getType ( ) const
inlinenoexcept

◆ getUnit()

const AttributeUnit* getUnit ( ) const
inlinenoexcept

◆ getValue()

const QString& getValue ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ getValueTr()

QString getValueTr ( bool  showUnit) const
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setKey()

bool setKey ( const AttributeKey key)
noexcept
+ Here is the caller graph for this function:

◆ setTypeValueUnit()

bool setTypeValueUnit ( const AttributeType type,
const QString &  value,
const AttributeUnit unit 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

void serialize ( SExpression root) const
overridevirtual

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.

Implements SerializableObject.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator==()

bool operator== ( const Attribute rhs) const
noexcept
+ Here is the caller graph for this function:

◆ operator!=()

bool operator!= ( const Attribute rhs) const
inlinenoexcept
+ Here is the call graph for this function:

◆ operator=()

Attribute& operator= ( const Attribute rhs)
delete
+ Here is the caller graph for this function:

◆ checkAttributesValidity()

bool checkAttributesValidity ( ) const
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ onEdited

Signal<Attribute, Event> onEdited

◆ mKey

AttributeKey mKey
private

◆ mType

const AttributeType* mType
private

◆ mValue

QString mValue
private

◆ mUnit

const AttributeUnit* mUnit
private

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