The AttributeProvider class defines an interface for classes which provides some attributes which can be used as variables in texts (like "{{NAME}}")
More...
#include <attributeprovider.h>
The AttributeProvider class defines an interface for classes which provides some attributes which can be used as variables in texts (like "{{NAME}}")
For example library symbols can contain text elements which contains variables, for example the most importants texts "{{NAME}}" and "{{VALUE}}". All these variables will be parsed and replaced with their values when such a text is displayed in a schematic of a project.
Please read the documentation about the Attributes System to get an idea how the Attributes System works in detail.
To get the values from the attributes of an object, their class must inherit from librepcb::AttributeProvider and override at least one of the methods getUserDefinedAttributeValue(), getBuiltInAttributeValue() and getAttributeProviderParents(), depending on what kind of attributes it provides.
- See also
- librepcb::AttributeSubstitutor
-
Attributes System
◆ AttributeProvider() [1/2]
◆ AttributeProvider() [2/2]
◆ ~AttributeProvider()
◆ operator=()
◆ getAttributeValue() [1/2]
QString getAttributeValue |
( |
const QString & |
key | ) |
const |
|
noexcept |
Get the value of an attribute which can be used in texts (like "{{NAME}}")
- Parameters
-
key | The attribute key name (e.g. "NAME" in "{{NAME}}"). |
- Returns
- The value of the specified attribute (empty if attribute not found)
◆ getUserDefinedAttributeValue()
virtual QString getUserDefinedAttributeValue |
( |
const QString & |
key | ) |
const |
|
inlinevirtualnoexcept |
Get the value of a user defined attribute (if available)
- Parameters
-
key | The attribute name (e.g. "NAME" for "{{NAME}}") |
- Returns
- The value of the attribute (empty string if not found)
Reimplemented in Project, ComponentInstance, and BI_Device.
◆ getBuiltInAttributeValue()
virtual QString getBuiltInAttributeValue |
( |
const QString & |
key | ) |
const |
|
inlinevirtualnoexcept |
◆ getAttributeProviderParents()
◆ attributesChanged
virtual void attributesChanged |
( |
| ) |
|
|
pure virtualsignal |
This signal is emitted when the value of attributes has changed.
All derived classes must emit this signal when some attributes have changed their values (only attributes which can be fetched with getAttributeValue(), inclusive all attributes from all "parent" classes).
◆ getAttributeValue() [2/2]
QString getAttributeValue |
( |
const QString & |
key, |
|
|
QVector< const AttributeProvider *> & |
backtrace |
|
) |
| const |
|
privatenoexcept |
The documentation for this class was generated from the following files: