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

SettingsVisitor that retrieves a JSON format definition of a command's parameters. More...

#include <ShuttleGetDefinition.h>

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

Public Member Functions

 ShuttleGetDefinition (CommandMessageTarget &target)
 
bool IsOptional ()
 
ConstSettingsVisitorOptional (const 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 (const 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 Member Functions inherited from CommandMessageTargetDecorator
 CommandMessageTargetDecorator (CommandMessageTarget &target)
 
 ~CommandMessageTargetDecorator () override
 
void Update (const wxString &message) override
 
void StartArray () override
 
void EndArray () override
 
void StartStruct () override
 
void EndStruct () override
 
void AddItem (const wxString &value, const wxString &name={}) override
 
void AddBool (const bool value, const wxString &name={}) override
 
void AddItem (const double value, const wxString &name={}) override
 
void StartField (const wxString &name={}) override
 
void EndField () override
 
void Flush () override
 
- Public Member Functions inherited from CommandMessageTarget
 CommandMessageTarget ()
 
virtual ~CommandMessageTarget ()
 
virtual void Update (const wxString &message)=0
 
virtual void StartArray ()
 
virtual void EndArray ()
 
virtual void StartStruct ()
 
virtual void EndStruct ()
 
virtual void AddItem (const wxString &value, const wxString &name={})
 
virtual void AddBool (const bool value, const wxString &name={})
 
virtual void AddItem (const double value, const wxString &name={})
 
virtual void StartField (const wxString &name={})
 
virtual void EndField ()
 
virtual void Flush ()
 
wxString Escaped (const wxString &str)
 

Public Attributes

wxString Result
 
- Public Attributes inherited from SettingsVisitorBase< Const >
wxString mParams
 
std::conditional_t< Const, const bool, bool > * pOptionalFlag {}
 
CommandParametersmpEap {}
 
- Public Attributes inherited from CommandMessageTargetDecorator
CommandMessageTargetmTarget
 
- Public Attributes inherited from CommandMessageTarget
std::vector< int > mCounts
 

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 retrieves a JSON format definition of a command's parameters.

Definition at line 20 of file ShuttleGetDefinition.h.

Constructor & Destructor Documentation

◆ ShuttleGetDefinition()

ShuttleGetDefinition::ShuttleGetDefinition ( CommandMessageTarget target)

Definition at line 26 of file ShuttleGetDefinition.cpp.

27{
28}
CommandMessageTargetDecorator is a CommandOutputTarget that forwards its work on to another one....

Member Function Documentation

◆ Define() [1/7]

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

Definition at line 31 of file ShuttleGetDefinition.cpp.

33{
35 AddItem( wxString(key), "key" );
36 AddItem( "bool", "type" );
37 if( IsOptional() )
38 AddItem( "unchanged", "default" );
39 else
40 AddItem( vdefault ? "True" : "False", "default" );
41 EndStruct();
42}
static const AudacityProject::AttachedObjects::RegisteredFactory key
void AddItem(const wxString &value, const wxString &name={}) override

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [2/7]

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

Definition at line 111 of file ShuttleGetDefinition.cpp.

113{
114 StartStruct();
115 AddItem( wxString(key), "key" );
116 AddItem( "string", "type" );
117 if( IsOptional() )
118 AddItem( "unchanged", "default" );
119 else
120 AddItem( vdefault, "default" );
121 EndStruct();
122}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [3/7]

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

Definition at line 97 of file ShuttleGetDefinition.cpp.

99{
100 StartStruct();
101 AddItem( wxString(key), "key" );
102 AddItem( "double", "type" );
103 if( IsOptional() )
104 AddItem( "unchanged", "default" );
105 else
106 AddItem( (double)vdefault, "default" );
107 EndStruct();
108}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [4/7]

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

Definition at line 84 of file ShuttleGetDefinition.cpp.

86{
88 AddItem( wxString(key), "key" );
89 AddItem( "float", "type" );
90 if( IsOptional() )
91 AddItem( "unchanged", "default" );
92 else
93 AddItem( (double)vdefault, "default" );
94 EndStruct();
95}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [5/7]

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

Definition at line 71 of file ShuttleGetDefinition.cpp.

73{
75 AddItem( wxString(key), "key" );
76 AddItem( "float", "type" );
77 if( IsOptional() )
78 AddItem( "unchanged", "default" );
79 else
80 AddItem( (double)vdefault, "default" );
81 EndStruct();
82}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [6/7]

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

Definition at line 44 of file ShuttleGetDefinition.cpp.

46{
48 AddItem( wxString(key), "key" );
49 AddItem( "int", "type" );
50 if( IsOptional() )
51 AddItem( "unchanged", "default" );
52 else
53 AddItem( (double)vdefault, "default" );
54 EndStruct();
55}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ Define() [7/7]

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

Definition at line 57 of file ShuttleGetDefinition.cpp.

59{
61 AddItem( wxString(key), "key" );
62 AddItem( "size_t", "type" );
63 if( IsOptional() )
64 AddItem( "unchanged", "default" );
65 else
66 AddItem( (double)vdefault, "default" );
67 EndStruct();
68
69}

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndStruct(), IsOptional(), key, and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ DefineEnum()

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

Definition at line 125 of file ShuttleGetDefinition.cpp.

127{
128 StartStruct();
129 AddItem( wxString(key), "key" );
130 AddItem( "enum", "type" );
131 if( IsOptional() )
132 AddItem( "unchanged", "default" );
133 else
134 AddItem( strings[vdefault].Internal(), "default" );
135 StartField( "enum" );
136 StartArray();
137 for( size_t i = 0; i < nStrings; i++ )
138 AddItem( strings[i].Internal() );
139 EndArray();
140 EndField();
141 EndStruct();
142}
@ Internal
Indicates internal failure from Audacity.
void StartField(const wxString &name={}) override

References CommandMessageTargetDecorator::AddItem(), CommandMessageTargetDecorator::EndArray(), CommandMessageTargetDecorator::EndField(), CommandMessageTargetDecorator::EndStruct(), Internal, IsOptional(), key, CommandMessageTargetDecorator::StartArray(), CommandMessageTargetDecorator::StartField(), and CommandMessageTargetDecorator::StartStruct().

Here is the call graph for this function:

◆ IsOptional()

bool ShuttleGetDefinition::IsOptional ( )

Definition at line 14 of file ShuttleGetDefinition.cpp.

14 {
15 bool result = pOptionalFlag !=NULL;
16 pOptionalFlag = NULL;
17 return result;
18}
std::conditional_t< Const, const bool, bool > * pOptionalFlag

References SettingsVisitorBase< Const >::pOptionalFlag.

Referenced by Define(), and DefineEnum().

Here is the caller graph for this function:

◆ Optional()

ConstSettingsVisitor & ShuttleGetDefinition::Optional ( const bool &  var)
override

Definition at line 21 of file ShuttleGetDefinition.cpp.

21 {
22 pOptionalFlag = &var;
23 return *this;
24};

References SettingsVisitorBase< Const >::pOptionalFlag.

Member Data Documentation

◆ Result

wxString ShuttleGetDefinition::Result

Definition at line 25 of file ShuttleGetDefinition.h.


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