1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-26 17:38:10 +02:00
audacity/src/commands/CommandSignature.cpp
martynshaw99 4ce2643d5f Remove the
// Indentation settings for Vim and Emacs
etc. lines from all files, as Campbell's patch (except for other changes to Languages.cpp)
2013-09-24 00:14:37 +00:00

57 lines
1.5 KiB
C++

/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Dan Horgan
******************************************************************//**
\file CommandSignature.cpp
\brief Definitions for CommandSignature class
*//*******************************************************************/
#include "CommandMisc.h"
#include "CommandSignature.h"
#include "Validators.h"
CommandSignature::~CommandSignature()
{
// Delete the validators
ValidatorMap::iterator iter;
for (iter = mValidators.begin(); iter != mValidators.end(); ++iter)
{
delete iter->second;
}
}
void CommandSignature::AddParameter(const wxString &name,
const wxVariant &dft,
Validator *valid)
{
wxASSERT_MSG(valid->Validate(dft),
wxT("Invalid command signature: the default value of '")
+ dft.MakeString()
+ wxT("' for the '")
+ name
+ wxT("' parameter doesn't satisfy the provided validator.")
+ wxT(" It should be ")
+ valid->GetDescription()
+ wxT("."));
mDefaults.insert(std::pair<wxString, wxVariant>(name, dft));
mValidators.insert(std::pair<wxString, Validator*>(name, valid));
}
ParamValueMap CommandSignature::GetDefaults() const
{
return mDefaults;
}
Validator &CommandSignature::GetValidator(const wxString &paramName)
{
wxASSERT(mValidators.find(paramName) != mValidators.end());
return *mValidators[paramName];
}