LibrePCB Developers Documentation
AttributeType Class Referenceabstract

The AttributeType class. More...

#include <attributetype.h>

+ Inheritance diagram for AttributeType:
+ Collaboration diagram for AttributeType:

Public Types

enum  Type_t
 Available Attribute Types. More...
 

Public Member Functions

 AttributeType (Type_t type, const QString &typeName, const QString &typeNameTr) noexcept
 
virtual ~AttributeType () noexcept
 
Type_t getType () const noexcept
 
const QString & getName () const noexcept
 
const QString & getNameTr () const noexcept
 
const QList< const AttributeUnit * > & getAvailableUnits () const noexcept
 
const AttributeUnitgetUnitFromString (const QString &unit) const
 
const AttributeUnitgetDefaultUnit () const noexcept
 
bool isUnitAvailable (const AttributeUnit *unit) const noexcept
 
const AttributeUnittryExtractUnitFromValue (QString &value) const noexcept
 
virtual bool isValueValid (const QString &value) const noexcept=0
 
virtual QString valueFromTr (const QString &value) const noexcept=0
 
virtual QString printableValueTr (const QString &value, const AttributeUnit *unit=nullptr) const noexcept=0
 

Static Public Member Functions

static QList< const AttributeType * > getAllTypes () noexcept
 
static const AttributeTypefromString (const QString &type)
 

Protected Member Functions

 AttributeType ()=delete
 
 AttributeType (const AttributeType &other)=delete
 
AttributeTypeoperator= (const AttributeType &rhs)=delete
 

Protected Attributes

Type_t mType
 
QString mTypeName
 
QString mTypeNameTr
 
QList< const AttributeUnit * > mAvailableUnits
 
const AttributeUnitmDefaultUnit
 

Detailed Description

The AttributeType class.

Member Enumeration Documentation

◆ Type_t

enum Type_t
strong

Available Attribute Types.

Enumerator
String 
See also
class librepcb::AttrTypeString
Resistance 
See also
class librepcb::AttrTypeResistance
Capacitance 
See also
class librepcb::AttrTypeCapacitance
Inductance 
See also
class librepcb::AttrTypeInductance
Voltage 
See also
class librepcb::AttrTypeVoltage
Current 
See also
class librepcb::AttrTypeCurrent
Power 
See also
class librepcb::AttrTypePower
Frequency 
See also
class librepcb::AttrTypeFrequency
_COUNT 

Constructor & Destructor Documentation

◆ AttributeType() [1/3]

AttributeType ( Type_t  type,
const QString &  typeName,
const QString &  typeNameTr 
)
noexcept

◆ ~AttributeType()

~AttributeType ( )
virtualnoexcept

◆ AttributeType() [2/3]

AttributeType ( )
protecteddelete
+ Here is the caller graph for this function:

◆ AttributeType() [3/3]

AttributeType ( const AttributeType other)
protecteddelete

Member Function Documentation

◆ getType()

Type_t getType ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getName()

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

◆ getNameTr()

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

◆ getAvailableUnits()

const QList<const AttributeUnit*>& getAvailableUnits ( ) const
inlinenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUnitFromString()

const AttributeUnit * getUnitFromString ( const QString &  unit) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultUnit()

const AttributeUnit* getDefaultUnit ( ) const
inlinenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUnitAvailable()

bool isUnitAvailable ( const AttributeUnit unit) const
noexcept
+ Here is the caller graph for this function:

◆ tryExtractUnitFromValue()

const AttributeUnit * tryExtractUnitFromValue ( QString &  value) const
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValueValid()

virtual bool isValueValid ( const QString &  value) const
pure virtualnoexcept

Implemented in AttrTypeCapacitance, AttrTypeCurrent, AttrTypeFrequency, AttrTypeInductance, AttrTypePower, AttrTypeResistance, AttrTypeString, and AttrTypeVoltage.

+ Here is the caller graph for this function:

◆ valueFromTr()

virtual QString valueFromTr ( const QString &  value) const
pure virtualnoexcept

Implemented in AttrTypeCapacitance, AttrTypeCurrent, AttrTypeFrequency, AttrTypeInductance, AttrTypePower, AttrTypeResistance, AttrTypeString, and AttrTypeVoltage.

+ Here is the caller graph for this function:

◆ printableValueTr()

virtual QString printableValueTr ( const QString &  value,
const AttributeUnit unit = nullptr 
) const
pure virtualnoexcept

Implemented in AttrTypeCapacitance, AttrTypeCurrent, AttrTypeFrequency, AttrTypeInductance, AttrTypePower, AttrTypeResistance, AttrTypeString, and AttrTypeVoltage.

+ Here is the caller graph for this function:

◆ getAllTypes()

QList< const AttributeType * > getAllTypes ( )
staticnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromString()

const AttributeType & fromString ( const QString &  type)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

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

Member Data Documentation

◆ mType

Type_t mType
protected

◆ mTypeName

QString mTypeName
protected

◆ mTypeNameTr

QString mTypeNameTr
protected

◆ mAvailableUnits

QList<const AttributeUnit*> mAvailableUnits
protected

◆ mDefaultUnit

const AttributeUnit* mDefaultUnit
protected

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