LibrePCB Developers Documentation
WorkspaceSettingsItem_GenericValue< T > Class Template Referencefinal

Generic implementation of librepcb::workspace::WorkspaceSettingsItem for simple, value-type settings. More...

#include <workspacesettingsitem_genericvalue.h>

+ Inheritance diagram for WorkspaceSettingsItem_GenericValue< T >:
+ Collaboration diagram for WorkspaceSettingsItem_GenericValue< T >:

Public Member Functions

 WorkspaceSettingsItem_GenericValue ()=delete
 
 WorkspaceSettingsItem_GenericValue (const WorkspaceSettingsItem_GenericValue &other)=delete
 
 WorkspaceSettingsItem_GenericValue (const QString &key, const T &defaultValue, QObject *parent=nullptr) noexcept
 
 ~WorkspaceSettingsItem_GenericValue () noexcept
 
const T & get () const noexcept
 Get the current value. More...
 
void set (const T &value) noexcept
 Set the value. More...
 
const T & getDefault () const noexcept
 Get the default value. More...
 
virtual void restoreDefault () noexcept override
 Restore default value. More...
 
void load (const SExpression &root) override
 Load value from S-Expression node. More...
 
void serialize (SExpression &root) const override
 Serialize the value into S-Expression node. More...
 
WorkspaceSettingsItem_GenericValueoperator= (const WorkspaceSettingsItem_GenericValue &rhs)=delete
 
- Public Member Functions inherited from WorkspaceSettingsItem
 WorkspaceSettingsItem (QObject *parent=nullptr) noexcept
 
 WorkspaceSettingsItem (const WorkspaceSettingsItem &other)=delete
 
 ~WorkspaceSettingsItem () noexcept
 
WorkspaceSettingsItemoperator= (const WorkspaceSettingsItem &rhs)=delete
 

Private Attributes

QString mKey
 Key used for serialization. More...
 
mDefaultValue
 Initial, default value. More...
 
mCurrentValue
 Current value. More...
 

Additional Inherited Members

- Signals inherited from WorkspaceSettingsItem
void edited ()
 Signal to notify about changes of the settings value. More...
 

Detailed Description

template<typename T>
class librepcb::workspace::WorkspaceSettingsItem_GenericValue< T >

Generic implementation of librepcb::workspace::WorkspaceSettingsItem for simple, value-type settings.

Constructor & Destructor Documentation

◆ WorkspaceSettingsItem_GenericValue() [1/3]

◆ WorkspaceSettingsItem_GenericValue() [2/3]

◆ WorkspaceSettingsItem_GenericValue() [3/3]

WorkspaceSettingsItem_GenericValue ( const QString &  key,
const T &  defaultValue,
QObject *  parent = nullptr 
)
inlineexplicitnoexcept

◆ ~WorkspaceSettingsItem_GenericValue()

Member Function Documentation

◆ get()

const T& get ( ) const
inlinenoexcept

Get the current value.

Returns
Current value
+ Here is the caller graph for this function:

◆ set()

void set ( const T &  value)
inlinenoexcept

Set the value.

Parameters
valueThe new value
+ Here is the caller graph for this function:

◆ getDefault()

const T& getDefault ( ) const
inlinenoexcept

Get the default value.

Returns
Default value

◆ restoreDefault()

virtual void restoreDefault ( )
inlineoverridevirtualnoexcept

Restore default value.

Note
Implementation must emit the edited() signal.

Implements WorkspaceSettingsItem.

◆ load()

void load ( const SExpression root)
inlineoverridevirtual

Load value from S-Expression node.

Parameters
rootRoot node of the settings file.
Note
Implementation must emit the edited() signal.
Implementation must be atomic, i.e. either the value must be loaded completely from file, or left at the old value (in case of errors).

Implements WorkspaceSettingsItem.

◆ serialize()

void serialize ( SExpression root) const
inlineoverridevirtual

Serialize the value into S-Expression node.

Parameters
rootRoot node of the settings file.

Implements WorkspaceSettingsItem.

◆ operator=()

+ Here is the caller graph for this function:

Member Data Documentation

◆ mKey

QString mKey
private

Key used for serialization.

◆ mDefaultValue

T mDefaultValue
private

Initial, default value.

◆ mCurrentValue

T mCurrentValue
private

Current value.


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