Audacity 3.2.0
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
17#include "CommandSignature.h"
18
20
22{
23}
24
26 const wxVariant &dft,
27 std::unique_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
47Validator &CommandSignature::GetValidator(const wxString &paramName)
48{
49 wxASSERT(mValidators.find(paramName) != mValidators.end());
50 return *mValidators[paramName];
51}
wxT("CloseDown"))
std::map< wxString, wxVariant > ParamValueMap
Definition: CommandMisc.h:23
Declaration of CommandSignature class.
const TranslatableString name
Definition: Distortion.cpp:74
void AddParameter(const wxString &name, const wxVariant &dft, std::unique_ptr< Validator > &&valid)
ParamValueMap GetDefaults() const
ParamValueMap mDefaults
ValidatorMap mValidators
Validator & GetValidator(const wxString &paramName)
A Validator is an object which checks whether a wxVariant satisfies a certain criterion....
Definition: Validators.h:53