Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
ShuttleSetAutomation Class Referencefinal

SettingsVisitor that sets parameters to a value (from a string) More...

#include <ShuttleAutomation.h>

Inheritance diagram for ShuttleSetAutomation:
[legend]
Collaboration diagram for ShuttleSetAutomation:
[legend]

Public Member Functions

 ShuttleSetAutomation ()
 
bool CouldGet (const wxString &key)
 
void SetForValidating (CommandParameters *pEap)
 
void SetForWriting (CommandParameters *pEap)
 
SettingsVisitorOptional (bool &var) override
 
void Define (bool &var, const wxChar *key, bool vdefault, bool vmin, bool vmax, bool vscl) override
 
void Define (int &var, const wxChar *key, int vdefault, int vmin, int vmax, int vscl) override
 
void Define (size_t &var, const wxChar *key, int vdefault, int vmin, int vmax, int vscl) override
 
void Define (float &var, const wxChar *key, float vdefault, float vmin, float vmax, float vscl) override
 
void Define (double &var, const wxChar *key, float vdefault, float vmin, float vmax, float vscl) override
 
void Define (double &var, const wxChar *key, double vdefault, double vmin, double vmax, double vscl) override
 
void Define (wxString &var, const wxChar *key, wxString vdefault, wxString vmin, wxString vmax, wxString vscl) override
 
void DefineEnum (int &var, const wxChar *key, int vdefault, const EnumValueSymbol strings[], size_t nStrings) override
 
- Public Member Functions inherited from SettingsVisitorBase< Const >
 SettingsVisitorBase ()
 
virtual ~SettingsVisitorBase ()
 
bool ShouldSet ()
 
virtual SettingsVisitorBaseOptional (Ref< bool > var)
 
virtual SettingsVisitorBaseOptionalY (Ref< bool > var)
 
virtual SettingsVisitorBaseOptionalN (Ref< bool > var)
 
virtual void Define (Arg< bool > var, const wxChar *key, bool vdefault, bool vmin=false, bool vmax=false, bool vscl=false)
 
virtual void Define (Arg< size_t > var, const wxChar *key, int vdefault, int vmin=0, int vmax=100000, int vscl=1)
 
virtual void Define (Arg< int > var, const wxChar *key, int vdefault, int vmin=0, int vmax=100000, int vscl=1)
 
virtual void Define (Arg< float > var, const wxChar *key, float vdefault, float vmin, float vmax, float vscl=1.0f)
 
virtual void Define (Arg< double > var, const wxChar *key, float vdefault, float vmin, float vmax, float vscl=1.0f)
 
virtual void Define (Arg< double > var, const wxChar *key, double vdefault, double vmin, double vmax, double vscl=1.0f)
 
virtual void Define (Ref< wxString > var, const wxChar *key, wxString vdefault, wxString vmin={}, wxString vmax={}, wxString vscl={})
 
virtual void DefineEnum (Arg< int > var, const wxChar *key, int vdefault, const EnumValueSymbol strings[], size_t nStrings)
 

Public Attributes

bool bOK { false }
 
bool bWrite { false }
 
- Public Attributes inherited from SettingsVisitorBase< Const >
wxString mParams
 
std::conditional_t< Const, const bool, bool > * pOptionalFlag {}
 
CommandParametersmpEap {}
 

Additional Inherited Members

- Public Types inherited from SettingsVisitorBase< Const >
template<typename T >
using Ref = std::conditional_t< Const, const T &, T & >
 
template<typename T >
using Arg = std::conditional_t< Const, T, T & >
 

Detailed Description

SettingsVisitor that sets parameters to a value (from a string)

Definition at line 270 of file ShuttleAutomation.h.

Constructor & Destructor Documentation

◆ ShuttleSetAutomation()

ShuttleSetAutomation::ShuttleSetAutomation ( )
inline

Definition at line 273 of file ShuttleAutomation.h.

273{}

Member Function Documentation

◆ CouldGet()

bool ShuttleSetAutomation::CouldGet ( const wxString &  key)

Definition at line 92 of file ShuttleAutomation.cpp.

92 {
93 // Not optional? Can get as we will get the default, at worst.
94 if( !pOptionalFlag )
95 return true;
96 bool result = mpEap->HasEntry( key );
97 *pOptionalFlag = result;
98 pOptionalFlag = NULL;
99 return result;
100}
static const AudacityProject::AttachedObjects::RegisteredFactory key
virtual bool HasEntry(const wxString &strName) const override
CommandParameters * mpEap
std::conditional_t< Const, const bool, bool > * pOptionalFlag

References CommandParameters::HasEntry(), key, SettingsVisitorBase< Const >::mpEap, and SettingsVisitorBase< Const >::pOptionalFlag.

Referenced by Define(), and DefineEnum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Define() [1/7]

void ShuttleSetAutomation::Define ( bool &  var,
const wxChar *  key,
bool  vdefault,
bool  vmin,
bool  vmax,
bool  vscl 
)
override

Definition at line 102 of file ShuttleAutomation.cpp.

103{
104 CouldGet( key );
105 if( !bOK )
106 return;
107 // Use of temp in this and related functions is to handle the case of
108 // only committing values if all values pass verification.
109 bool temp =var;
110 bOK = mpEap->ReadAndVerify(key, &temp, vdefault);
111 if( bWrite && bOK)
112 var = temp;
113}
bool ReadAndVerify(const wxString &key, float *val, float defVal, float min, float max) const
bool CouldGet(const wxString &key)

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [2/7]

void ShuttleSetAutomation::Define ( double &  var,
const wxChar *  key,
double  vdefault,
double  vmin,
double  vmax,
double  vscl 
)
override

Definition at line 160 of file ShuttleAutomation.cpp.

161{
162 CouldGet( key );
163 if( !bOK )
164 return;
165 double temp = var;
166 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
167 if( bWrite && bOK)
168 var = temp;
169}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [3/7]

void ShuttleSetAutomation::Define ( double &  var,
const wxChar *  key,
float  vdefault,
float  vmin,
float  vmax,
float  vscl 
)
override

Definition at line 149 of file ShuttleAutomation.cpp.

150{
151 CouldGet( key );
152 if( !bOK )
153 return;
154 double temp = var;
155 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
156 if( bWrite && bOK)
157 var = temp;
158}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [4/7]

void ShuttleSetAutomation::Define ( float &  var,
const wxChar *  key,
float  vdefault,
float  vmin,
float  vmax,
float  vscl 
)
override

Definition at line 137 of file ShuttleAutomation.cpp.

138{
139 CouldGet( key );
140 if( !bOK )
141 return;
142 float temp = var;
143 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
144 if( bWrite && bOK )
145 var = temp;
146}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [5/7]

void ShuttleSetAutomation::Define ( int &  var,
const wxChar *  key,
int  vdefault,
int  vmin,
int  vmax,
int  vscl 
)
override

Definition at line 115 of file ShuttleAutomation.cpp.

116{
117 CouldGet( key );
118 if( !bOK )
119 return;
120 int temp =var;
121 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
122 if( bWrite && bOK)
123 var = temp;
124}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [6/7]

void ShuttleSetAutomation::Define ( size_t &  var,
const wxChar *  key,
int  vdefault,
int  vmin,
int  vmax,
int  vscl 
)
override

Definition at line 126 of file ShuttleAutomation.cpp.

127{
128 CouldGet( key );
129 if( !bOK )
130 return;
131 int temp = var;
132 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
133 if( bWrite && bOK )
134 var = temp;
135}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Define() [7/7]

void ShuttleSetAutomation::Define ( wxString &  var,
const wxChar *  key,
wxString  vdefault,
wxString  vmin,
wxString  vmax,
wxString  vscl 
)
override

Definition at line 172 of file ShuttleAutomation.cpp.

173{
174 CouldGet( key );
175 if( !bOK )
176 return;
177 wxString temp = var;
178 bOK = mpEap->ReadAndVerify(key, &temp, vdefault);
179 if( bWrite && bOK )
180 var = temp;
181}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ DefineEnum()

void ShuttleSetAutomation::DefineEnum ( int &  var,
const wxChar *  key,
int  vdefault,
const EnumValueSymbol  strings[],
size_t  nStrings 
)
override

Definition at line 184 of file ShuttleAutomation.cpp.

185{
186 CouldGet( key );
187 if( !bOK )
188 return;
189 int temp = var;
190 bOK = mpEap->ReadAndVerify(key, &temp, vdefault, strings, nStrings);
191 if( bWrite && bOK)
192 var = temp;
193}

References bOK, bWrite, CouldGet(), key, SettingsVisitorBase< Const >::mpEap, and CommandParameters::ReadAndVerify().

Here is the call graph for this function:

◆ Optional()

SettingsVisitor & ShuttleSetAutomation::Optional ( bool &  var)
override

Definition at line 82 of file ShuttleAutomation.cpp.

82 {
83 pOptionalFlag = &var;
84 return *this;
85};

References SettingsVisitorBase< Const >::pOptionalFlag.

◆ SetForValidating()

void ShuttleSetAutomation::SetForValidating ( CommandParameters pEap)
inline

Definition at line 278 of file ShuttleAutomation.h.

278 {
279 mpEap = pEap;
280 bOK = true;
281 bWrite = false;
282 }

◆ SetForWriting()

void ShuttleSetAutomation::SetForWriting ( CommandParameters pEap)
inline

Definition at line 283 of file ShuttleAutomation.h.

283 {
284 mpEap = pEap;
285 bOK = true;
286 bWrite = true;
287 }

Member Data Documentation

◆ bOK

bool ShuttleSetAutomation::bOK { false }

Definition at line 274 of file ShuttleAutomation.h.

Referenced by Define(), and DefineEnum().

◆ bWrite

bool ShuttleSetAutomation::bWrite { false }

Definition at line 275 of file ShuttleAutomation.h.

Referenced by Define(), and DefineEnum().


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