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

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

#include <workspacesettingsitem_genericvaluelist.h>

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

Public Member Functions

 WorkspaceSettingsItem_GenericValueList ()=delete
 
 WorkspaceSettingsItem_GenericValueList (const WorkspaceSettingsItem_GenericValueList &other)=delete
 
 WorkspaceSettingsItem_GenericValueList (const QString &listKey, const QString &itemKey, const T &defaultValue, QObject *parent=nullptr) noexcept
 
 ~WorkspaceSettingsItem_GenericValueList () noexcept
 
const T & get () const noexcept
 Get the current value.
 
bool contains (const typename T::value_type &item) const noexcept
 Check if the current value contains a praticular item.
 
void set (const T &value) noexcept
 Set the value.
 
void add (const typename T::value_type &item) noexcept
 Add a single item to the value list.
 
const T & getDefault () const noexcept
 Get the default value.
 
WorkspaceSettingsItem_GenericValueListoperator= (const WorkspaceSettingsItem_GenericValueList &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.
 
makeCanonical (const QList< typename T::value_type > &value) const noexcept
 Helper for serialization of QList.
 
QList< typename T::value_type > makeCanonical (const QSet< typename T::value_type > &value) const noexcept
 Helper for serialization of QSet.
 
void serializeImpl (SExpression &root) const override
 Serialize the value into S-Expression node.
 

Private Attributes

QString mItemKey
 Inner key used for serialization.
 
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_GenericValueList< T >

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

Constructor & Destructor Documentation

◆ WorkspaceSettingsItem_GenericValueList() [1/3]

template<typename T >
WorkspaceSettingsItem_GenericValueList ( )
delete

◆ WorkspaceSettingsItem_GenericValueList() [2/3]

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

◆ WorkspaceSettingsItem_GenericValueList() [3/3]

template<typename T >
WorkspaceSettingsItem_GenericValueList ( const QString &  listKey,
const QString &  itemKey,
const T &  defaultValue,
QObject *  parent = nullptr 
)
inlineexplicitnoexcept

◆ ~WorkspaceSettingsItem_GenericValueList()

template<typename T >
~WorkspaceSettingsItem_GenericValueList ( )
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:

◆ contains()

template<typename T >
bool contains ( const typename T::value_type &  item) const
inlinenoexcept

Check if the current value contains a praticular item.

Parameters
itemItem to check.
Returns
Whether the item is contained in the current value or not.

◆ 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:

◆ add()

template<typename T >
void add ( const typename T::value_type &  item)
inlinenoexcept

Add a single item to the value list.

Parameters
itemThe item to append (list) or insert (unordered set)
+ Here is the call 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_GenericValueList & operator= ( const WorkspaceSettingsItem_GenericValueList< 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:

◆ makeCanonical() [1/2]

template<typename T >
T makeCanonical ( const QList< typename T::value_type > &  value) const
inlineprivatenoexcept

Helper for serialization of QList.

Parameters
valueQList to serialize.
Returns
Unmodified value.
+ Here is the caller graph for this function:

◆ makeCanonical() [2/2]

template<typename T >
QList< typename T::value_type > makeCanonical ( const QSet< typename T::value_type > &  value) const
inlineprivatenoexcept

Helper for serialization of QSet.

Parameters
valueQSet to serialize.
Returns
QSet as a sorted QList.
+ 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

◆ mItemKey

template<typename T >
QString mItemKey
private

Inner key used for serialization.

◆ 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: