Audacity 3.2.0
Public Member Functions | Private Types | Private Attributes | List of all members
StickySetting< SettingType >::ResetHandler Class Referencefinal
Inheritance diagram for StickySetting< SettingType >::ResetHandler:
[legend]
Collaboration diagram for StickySetting< SettingType >::ResetHandler:
[legend]

Public Member Functions

 ResetHandler (const ResetHandler &)=delete
 
ResetHandleroperator= (const ResetHandler &)=delete
 
 ResetHandler (ResetHandler &&)=delete
 
ResetHandleroperator= (ResetHandler &&)=delete
 
 ResetHandler (SettingType &setting)
 
 ~ResetHandler () override
 
void OnSettingResetBegin () override
 Happens before preferences reset. More...
 
void OnSettingResetEnd () override
 Happens after preferences reset. More...
 
- Public Member Functions inherited from PreferencesResetHandler
virtual ~PreferencesResetHandler ()
 
virtual void OnSettingResetBegin ()=0
 Happens before preferences reset. More...
 
virtual void OnSettingResetEnd ()=0
 Happens after preferences reset. More...
 

Private Types

using ValueType = typename SettingType::ValueType
 

Private Attributes

SettingType & mSetting
 
std::optional< ValueTypemCapturedValue
 

Detailed Description

template<typename SettingType>
class StickySetting< SettingType >::ResetHandler

Definition at line 591 of file Prefs.h.

Member Typedef Documentation

◆ ValueType

template<typename SettingType >
using StickySetting< SettingType >::ResetHandler::ValueType = typename SettingType::ValueType
private

Definition at line 593 of file Prefs.h.

Constructor & Destructor Documentation

◆ ResetHandler() [1/3]

template<typename SettingType >
StickySetting< SettingType >::ResetHandler::ResetHandler ( const ResetHandler )
delete

◆ ResetHandler() [2/3]

template<typename SettingType >
StickySetting< SettingType >::ResetHandler::ResetHandler ( ResetHandler &&  )
delete

◆ ResetHandler() [3/3]

template<typename SettingType >
StickySetting< SettingType >::ResetHandler::ResetHandler ( SettingType &  setting)
inline

Definition at line 605 of file Prefs.h.

605: mSetting(setting) { }
SettingType & mSetting
Definition: Prefs.h:595

◆ ~ResetHandler()

template<typename SettingType >
StickySetting< SettingType >::ResetHandler::~ResetHandler ( )
inlineoverride

Definition at line 606 of file Prefs.h.

606{ assert(!mCapturedValue.has_value()); }
std::optional< ValueType > mCapturedValue
Definition: Prefs.h:597

Member Function Documentation

◆ OnSettingResetBegin()

template<typename SettingType >
void StickySetting< SettingType >::ResetHandler::OnSettingResetBegin ( )
inlineoverridevirtual

Happens before preferences reset.

Implements PreferencesResetHandler.

Definition at line 608 of file Prefs.h.

609 {
610 assert(!mCapturedValue.has_value());
611 ValueType value;
612 if(mSetting.Read(&value))
613 mCapturedValue = value;
614 }

◆ OnSettingResetEnd()

template<typename SettingType >
void StickySetting< SettingType >::ResetHandler::OnSettingResetEnd ( )
inlineoverridevirtual

Happens after preferences reset.

Implements PreferencesResetHandler.

Definition at line 616 of file Prefs.h.

617 {
618 if(mCapturedValue.has_value())
619 {
620 auto Do = finally([=]{ mCapturedValue = std::nullopt; });
621 mSetting.Write(*mCapturedValue);
622 }
623 }

◆ operator=() [1/2]

template<typename SettingType >
ResetHandler & StickySetting< SettingType >::ResetHandler::operator= ( const ResetHandler )
delete

◆ operator=() [2/2]

template<typename SettingType >
ResetHandler & StickySetting< SettingType >::ResetHandler::operator= ( ResetHandler &&  )
delete

Member Data Documentation

◆ mCapturedValue

template<typename SettingType >
std::optional<ValueType> StickySetting< SettingType >::ResetHandler::mCapturedValue
private

Definition at line 597 of file Prefs.h.

◆ mSetting

template<typename SettingType >
SettingType& StickySetting< SettingType >::ResetHandler::mSetting
private

Definition at line 595 of file Prefs.h.


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