Audacity  2.2.2
CommandSignature.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2009 Audacity Team
5  License: wxwidgets
6 
7  Dan Horgan
8 
9 ******************************************************************//*******************************************************************/
15 
16 #include "../Audacity.h"
17 #include "CommandSignature.h"
18 #include "CommandMisc.h"
19 #include "Validators.h"
20 
22 {
23 }
24 
25 void CommandSignature::AddParameter(const wxString &name,
26  const wxVariant &dft,
27  movable_ptr<Validator> &&valid)
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 }
41 
43 {
44  return mDefaults;
45 }
46 
47 Validator &CommandSignature::GetValidator(const wxString &paramName)
48 {
49  wxASSERT(mValidators.find(paramName) != mValidators.end());
50  return *mValidators[paramName];
51 }
std::unique_ptr< T > movable_ptr
Definition: MemoryX.h:713
std::map< wxString, wxVariant > ParamValueMap
Definition: CommandMisc.h:23
ValidatorMap mValidators
void AddParameter(const wxString &name, const wxVariant &dft, movable_ptr< Validator > &&valid)
ParamValueMap GetDefaults() const
Contains declarations and definitions for Validator, OptionValidator, BoolValidator, DoubleValidator, RangeValidator, IntValidator and AndValidator classes.
const wxChar * name
Definition: Distortion.cpp:94
Validator & GetValidator(const wxString &paramName)
Declaration of CommandSignature class.
ParamValueMap mDefaults
A Validator is an object which checks whether a wxVariant satisfies a certain criterion. This is a base validator which allows anything.
Definition: Validators.h:48