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

Shuttle 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 ()
 
ShuttleParamsOptional (bool &var) override
 
void Define (bool &var, const wxChar *key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl) override
 
void Define (int &var, const wxChar *key, const int vdefault, const int vmin, const int vmax, const int vscl) override
 
void Define (size_t &var, const wxChar *key, const int vdefault, const int vmin, const int vmax, const int vscl) override
 
void Define (float &var, const wxChar *key, const float vdefault, const float vmin, const float vmax, const float vscl) override
 
void Define (double &var, const wxChar *key, const float vdefault, const float vmin, const float vmax, const float vscl) override
 
void Define (double &var, const wxChar *key, const double vdefault, const double vmin, const double vmax, const double vscl) override
 
void Define (wxString &var, const wxChar *key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl) override
 
void DefineEnum (int &var, const wxChar *key, const int vdefault, const EnumValueSymbol strings[], size_t nStrings) override
 
- Public Member Functions inherited from ShuttleParams
 ShuttleParams ()
 
virtual ~ShuttleParams ()
 
bool ShouldSet ()
 
virtual ShuttleParamsOptional (bool &WXUNUSED(var))
 
virtual ShuttleParamsOptionalY (bool &var)
 
virtual ShuttleParamsOptionalN (bool &var)
 
- 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 ()
 
wxString Escaped (const wxString &str)
 

Public Attributes

wxString Result
 
- Public Attributes inherited from ShuttleParams
wxString mParams
 
bool * pOptionalFlag
 
CommandParametersmpEap
 
- Public Attributes inherited from CommandMessageTargetDecorator
CommandMessageTargetmTarget
 
- Public Attributes inherited from CommandMessageTarget
std::vector< int > mCounts
 

Detailed Description

Shuttle 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 }

Member Function Documentation

◆ Define() [1/7]

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

Reimplemented from ShuttleParams.

Definition at line 31 of file ShuttleGetDefinition.cpp.

32 {
33  StartStruct();
34  AddItem( wxString(key), "key" );
35  AddItem( "bool", "type" );
36  if( IsOptional() )
37  AddItem( "unchanged", "default" );
38  else
39  AddItem( vdefault ? "True" : "False", "default" );
40  EndStruct();
41 }

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

Here is the call graph for this function:

◆ Define() [2/7]

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

Reimplemented from ShuttleParams.

Definition at line 92 of file ShuttleGetDefinition.cpp.

93 {
94  StartStruct();
95  AddItem( wxString(key), "key" );
96  AddItem( "double", "type" );
97  if( IsOptional() )
98  AddItem( "unchanged", "default" );
99  else
100  AddItem( (double)vdefault, "default" );
101  EndStruct();
102 }

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,
const float  vdefault,
const float  vmin,
const float  vmax,
const float  vscl 
)
overridevirtual

Reimplemented from ShuttleParams.

Definition at line 80 of file ShuttleGetDefinition.cpp.

81 {
82  StartStruct();
83  AddItem( wxString(key), "key" );
84  AddItem( "float", "type" );
85  if( IsOptional() )
86  AddItem( "unchanged", "default" );
87  else
88  AddItem( (double)vdefault, "default" );
89  EndStruct();
90 }

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

Here is the call graph for this function:

◆ Define() [4/7]

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

Reimplemented from ShuttleParams.

Definition at line 68 of file ShuttleGetDefinition.cpp.

69 {
70  StartStruct();
71  AddItem( wxString(key), "key" );
72  AddItem( "float", "type" );
73  if( IsOptional() )
74  AddItem( "unchanged", "default" );
75  else
76  AddItem( (double)vdefault, "default" );
77  EndStruct();
78 }

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

Here is the call graph for this function:

◆ Define() [5/7]

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

Reimplemented from ShuttleParams.

Definition at line 43 of file ShuttleGetDefinition.cpp.

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

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

Here is the call graph for this function:

◆ Define() [6/7]

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

Reimplemented from ShuttleParams.

Definition at line 55 of file ShuttleGetDefinition.cpp.

56 {
57  StartStruct();
58  AddItem( wxString(key), "key" );
59  AddItem( "size_t", "type" );
60  if( IsOptional() )
61  AddItem( "unchanged", "default" );
62  else
63  AddItem( (double)vdefault, "default" );
64  EndStruct();
65 
66 }

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

Here is the call graph for this function:

◆ Define() [7/7]

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

Reimplemented from ShuttleParams.

Definition at line 105 of file ShuttleGetDefinition.cpp.

106 {
107  StartStruct();
108  AddItem( wxString(key), "key" );
109  AddItem( "string", "type" );
110  if( IsOptional() )
111  AddItem( "unchanged", "default" );
112  else
113  AddItem( vdefault, "default" );
114  EndStruct();
115 }

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,
const int  vdefault,
const EnumValueSymbol  strings[],
size_t  nStrings 
)
overridevirtual

Reimplemented from ShuttleParams.

Definition at line 118 of file ShuttleGetDefinition.cpp.

121 {
122  StartStruct();
123  AddItem( wxString(key), "key" );
124  AddItem( "enum", "type" );
125  if( IsOptional() )
126  AddItem( "unchanged", "default" );
127  else
128  AddItem( strings[vdefault].Internal(), "default" );
129  StartField( "enum" );
130  StartArray();
131  for( size_t i = 0; i < nStrings; i++ )
132  AddItem( strings[i].Internal() );
133  EndArray();
134  EndField();
135  EndStruct();
136 }

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 }

References ShuttleParams::pOptionalFlag.

Referenced by Define(), and DefineEnum().

Here is the caller graph for this function:

◆ Optional()

ShuttleParams & ShuttleGetDefinition::Optional ( bool &  var)
override

Definition at line 21 of file ShuttleGetDefinition.cpp.

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

References ShuttleParams::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:
CommandMessageTargetDecorator::StartField
void StartField(const wxString &name={}) override
Definition: CommandTargets.h:110
CommandMessageTargetDecorator::EndStruct
void EndStruct() override
Definition: CommandTargets.h:103
CommandMessageTargetDecorator::AddItem
void AddItem(const wxString &value, const wxString &name={}) override
Definition: CommandTargets.h:104
CommandMessageTargetDecorator::EndField
void EndField() override
Definition: CommandTargets.h:112
CommandMessageTargetDecorator::EndArray
void EndArray() override
Definition: CommandTargets.h:101
CommandMessageTargetDecorator::StartArray
void StartArray() override
Definition: CommandTargets.h:100
CommandMessageTargetDecorator::StartStruct
void StartStruct() override
Definition: CommandTargets.h:102
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
CommandMessageTargetDecorator::CommandMessageTargetDecorator
CommandMessageTargetDecorator(CommandMessageTarget &target)
Definition: CommandTargets.h:97
ExceptionType::Internal
@ Internal
Indicates internal failure from Audacity.
ShuttleGetDefinition::IsOptional
bool IsOptional()
Definition: ShuttleGetDefinition.cpp:14
ShuttleParams::pOptionalFlag
bool * pOptionalFlag
Definition: Shuttle.h:65