LibrePCB Developers Documentation
Loading...
Searching...
No Matches
WorkspaceSettingsItem_GenericValue< T > Class Template Referencefinal

Generic implementation of librepcb::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.
 
void set (const T &value) noexcept
 Set the value.
 
const T & getDefault () const noexcept
 Get the default value.
 
WorkspaceSettingsItem_GenericValueoperator= (const WorkspaceSettingsItem_GenericValue &rhs)=delete
 
- Public Member Functions inherited from WorkspaceSettingsItem
 WorkspaceSettingsItem ()=delete
 
 WorkspaceSettingsItem (const QString &key, QObject *parent=nullptr) noexcept
 
 WorkspaceSettingsItem (const WorkspaceSettingsItem &other)=delete
 
virtual ~WorkspaceSettingsItem () noexcept
 
const QString & getKey () const noexcept
 Get the setting key used for serialization.
 
bool isDefaultValue () const noexcept
 Check whether this setting is at its default value (not modified)
 
bool isEdited () const noexcept
 Check whether this setting was edited sinc the last load or save.
 
void restoreDefault () noexcept
 Restore default value.
 
void load (const SExpression &root)
 Load value from S-Expression file.
 
void serialize (SExpression &root) const
 Serialize the value into S-Expression nodes.
 
WorkspaceSettingsItemoperator= (const WorkspaceSettingsItem &rhs)=delete
 

Private Member Functions

virtual void restoreDefaultImpl () noexcept override
 Restore default value.
 
void loadImpl (const SExpression &root) override
 Load value from S-Expression node.
 
void serializeImpl (SExpression &root) const override
 Serialize the value into S-Expression node.
 

Private Attributes

mDefaultValue
 Initial, default value.
 
mCurrentValue
 Current value.
 

Additional Inherited Members

- Signals inherited from WorkspaceSettingsItem
void edited ()
 Signal to notify about changes of the settings value.
 
- Protected Member Functions inherited from WorkspaceSettingsItem
void valueModified () noexcept
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ WorkspaceSettingsItem_GenericValue() [1/3]

template<typename T >
WorkspaceSettingsItem_GenericValue ( )
delete

◆ WorkspaceSettingsItem_GenericValue() [2/3]

template<typename T >
WorkspaceSettingsItem_GenericValue ( const WorkspaceSettingsItem_GenericValue< T > &  other)
delete

◆ WorkspaceSettingsItem_GenericValue() [3/3]

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

◆ ~WorkspaceSettingsItem_GenericValue()

template<typename T >
~WorkspaceSettingsItem_GenericValue ( )
inlinenoexcept

Member Function Documentation

◆ get()

template<typename T >
const T & get ( ) const
inlinenoexcept

Get the current value.

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

◆ set()

template<typename T >
void set ( const T &  value)
inlinenoexcept

Set the value.

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

◆ getDefault()

template<typename T >
const T & getDefault ( ) const
inlinenoexcept

Get the default value.

Returns
Default value

◆ operator=()

template<typename T >
WorkspaceSettingsItem_GenericValue & operator= ( const WorkspaceSettingsItem_GenericValue< T > &  rhs)
delete

◆ restoreDefaultImpl()

template<typename T >
virtual void restoreDefaultImpl ( )
inlineoverrideprivatevirtualnoexcept

Restore default value.

Note
Implementation must emit the edited() signal if the value has changed.

Implements WorkspaceSettingsItem.

+ Here is the call graph for this function:

◆ loadImpl()

template<typename T >
void loadImpl ( const SExpression root)
inlineoverrideprivatevirtual

Load value from S-Expression node.

Parameters
rootS-Expression node of the settings element.
Note
Implementation must emit the edited() signal if the value has changed.
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.

+ Here is the call graph for this function:

◆ serializeImpl()

template<typename T >
void serializeImpl ( SExpression root) const
inlineoverrideprivatevirtual

Serialize the value into S-Expression node.

Parameters
rootS-Expression node to be updated.

Implements WorkspaceSettingsItem.

+ Here is the call graph for this function:

Member Data Documentation

◆ mDefaultValue

template<typename T >
T mDefaultValue
private

Initial, default value.

◆ mCurrentValue

template<typename T >
T mCurrentValue
private

Current value.


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