Audacity 3.2.0
Public Member Functions | List of all members
EnumSetting< Enum > Class Template Reference

Adapts EnumSettingBase to a particular enumeration type. More...

#include <Prefs.h>

Inheritance diagram for EnumSetting< Enum >:
[legend]
Collaboration diagram for EnumSetting< Enum >:
[legend]

Public Member Functions

template<typename Key >
 EnumSetting (Key &&key, EnumValueSymbols symbols, long defaultSymbol, std::vector< Enum > values, const wxString &oldKey={})
 
Enum ReadEnum () const
 
Enum ReadEnumWithDefault (Enum defaultValue) const
 
bool WriteEnum (Enum value)
 
- Public Member Functions inherited from EnumSettingBase
template<typename Key >
 EnumSettingBase (Key &&key, EnumValueSymbols symbols, long defaultSymbol, std::vector< int > intValues, const wxString &oldKey={})
 
- Public Member Functions inherited from ChoiceSetting
 ChoiceSetting (const SettingPath &, EnumValueSymbols, long=-1)=delete
 
 ChoiceSetting (TransactionalSettingBase &key, EnumValueSymbols symbols, long defaultSymbol=-1)
 
 ChoiceSetting (const SettingBase &key, EnumValueSymbols symbols, long defaultSymbol=-1)
 
const wxString & Key () const
 
const EnumValueSymbolDefault () const
 
const EnumValueSymbolsGetSymbols () const
 
wxString Read () const
 
wxString ReadWithDefault (const wxString &) const
 
bool Write (const wxString &value)
 
void SetDefault (long value)
 

Additional Inherited Members

- Protected Member Functions inherited from EnumSettingBase
int ReadInt () const
 
int ReadIntWithDefault (int defaultValue) const
 
bool WriteInt (int code)
 
size_t FindInt (int code) const
 
void Migrate (wxString &) override
 
- Protected Member Functions inherited from ChoiceSetting
size_t Find (const wxString &value) const
 
virtual void Migrate (wxString &)
 
- Protected Attributes inherited from ChoiceSetting
const wxString mKey
 
const EnumValueSymbols mSymbols
 
TransactionalSettingBase *const mpOtherSettings {}
 
bool mMigrated { false }
 
long mDefaultSymbol
 

Detailed Description

template<typename Enum>
class EnumSetting< Enum >

Adapts EnumSettingBase to a particular enumeration type.

Definition at line 506 of file Prefs.h.

Constructor & Destructor Documentation

◆ EnumSetting()

template<typename Enum >
template<typename Key >
EnumSetting< Enum >::EnumSetting ( Key &&  key,
EnumValueSymbols  symbols,
long  defaultSymbol,
std::vector< Enum >  values,
const wxString &  oldKey = {} 
)
inline
Precondition
intValues.size() == symbols.size()

Definition at line 512 of file Prefs.h.

518 {}
519 ) : EnumSettingBase{ std::forward<Key>(key), move(symbols), defaultSymbol,
520 { values.begin(), values.end() }, oldKey }
521 {}
static const AudacityProject::AttachedObjects::RegisteredFactory key
const wxChar * values

Member Function Documentation

◆ ReadEnum()

template<typename Enum >
Enum EnumSetting< Enum >::ReadEnum ( ) const
inline

Definition at line 524 of file Prefs.h.

525 { return static_cast<Enum>( ReadInt() ); }
int ReadInt() const
Definition: Prefs.cpp:410

References anonymous_namespace{ProjectSerializer.cpp}::ReadInt.

Referenced by Dither::BestDitherChoice(), Exporter::CheckMix(), NoteTrack::ExportAllegro(), Dither::FastDitherChoice(), SpectrogramSettings::LoadPrefs(), Resample::SetMethod(), SpectrogramSettings::UpdatePrefs(), and TracksPrefs::ViewModeChoice().

Here is the caller graph for this function:

◆ ReadEnumWithDefault()

template<typename Enum >
Enum EnumSetting< Enum >::ReadEnumWithDefault ( Enum  defaultValue) const
inline

Definition at line 530 of file Prefs.h.

531 {
532 auto integer = static_cast<int>(defaultValue);
533 return static_cast<Enum>( ReadIntWithDefault( integer ) );
534 }
int ReadIntWithDefault(int defaultValue) const
Definition: Prefs.cpp:418

◆ WriteEnum()

template<typename Enum >
bool EnumSetting< Enum >::WriteEnum ( Enum  value)
inline

Definition at line 536 of file Prefs.h.

537 { return WriteInt( static_cast<int>( value ) ); }
bool WriteInt(int code)
Definition: Prefs.cpp:461

References anonymous_namespace{ProjectSerializer.cpp}::WriteInt.

Referenced by SpectrogramSettings::SavePrefs().

Here is the caller graph for this function:

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