Audacity  2.3.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CommandSignature Class Reference

Class that maps parameter names to default values and validators. More...

#include <CommandSignature.h>

Public Member Functions

 CommandSignature ()
 
 ~CommandSignature ()
 
void AddParameter (const wxString &name, const wxVariant &dft, std::unique_ptr< Validator > &&valid)
 
ParamValueMap GetDefaults () const
 
ValidatorGetValidator (const wxString &paramName)
 

Private Member Functions

 CommandSignature (const CommandSignature &WXUNUSED(other))
 

Private Attributes

ParamValueMap mDefaults
 
ValidatorMap mValidators
 

Detailed Description

Class that maps parameter names to default values and validators.

Definition at line 28 of file CommandSignature.h.

Constructor & Destructor Documentation

CommandSignature::CommandSignature ( const CommandSignature WXUNUSEDother)
inlineexplicitprivate

Definition at line 33 of file CommandSignature.h.

33 { }
CommandSignature::CommandSignature ( )
inlineexplicit

Definition at line 35 of file CommandSignature.h.

35 { }
CommandSignature::~CommandSignature ( )

Definition at line 21 of file CommandSignature.cpp.

22 {
23 }

Member Function Documentation

void CommandSignature::AddParameter ( const wxString &  name,
const wxVariant &  dft,
std::unique_ptr< Validator > &&  valid 
)

Definition at line 25 of file CommandSignature.cpp.

References mDefaults, and mValidators.

Referenced by BatchEvalCommandType::BuildSignature().

28 {
29  wxASSERT_MSG(valid->Validate(dft),
30  wxT("Invalid command signature: the default value of '")
31  + dft.MakeString()
32  + wxT("' for the '")
33  + name
34  + wxT("' parameter doesn't satisfy the provided validator.")
35  + wxT(" It should be ")
36  + valid->GetDescription()
37  + wxT("."));
38  mDefaults.insert(std::pair<wxString, wxVariant>(name, dft));
39  mValidators.insert(ValidatorMap::value_type(name, std::move(valid)));
40 }
ValidatorMap mValidators
virtual wxString GetDescription() const
Definition: Validators.h:74
virtual bool Validate(const wxVariant &v)
Judge whether the passed value satisfies the Validator.
Definition: Validators.h:66
const wxChar * name
Definition: Distortion.cpp:94
ParamValueMap mDefaults
ParamValueMap CommandSignature::GetDefaults ( ) const

Definition at line 42 of file CommandSignature.cpp.

References mDefaults.

Referenced by CommandBuilder::BuildCommand(), and OldStyleCommandType::Describe().

43 {
44  return mDefaults;
45 }
ParamValueMap mDefaults
Validator & CommandSignature::GetValidator ( const wxString &  paramName)

Definition at line 47 of file CommandSignature.cpp.

References mValidators.

Referenced by OldStyleCommandType::Describe(), and CommandImplementation::SetParameter().

48 {
49  wxASSERT(mValidators.find(paramName) != mValidators.end());
50  return *mValidators[paramName];
51 }
ValidatorMap mValidators

Member Data Documentation

ParamValueMap CommandSignature::mDefaults
private

Definition at line 31 of file CommandSignature.h.

Referenced by AddParameter(), and GetDefaults().

ValidatorMap CommandSignature::mValidators
private

Definition at line 32 of file CommandSignature.h.

Referenced by AddParameter(), and GetValidator().


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