Audacity  2.2.2
CommandType.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 ******************************************************************//*******************************************************************/
19 
20 #include "../Audacity.h"
21 #include "CommandType.h"
22 #include "CommandMisc.h"
23 #include "CommandSignature.h"
24 #include <wx/string.h>
25 
27  : mName{}, mSignature{}
28 { }
29 
31 {
32 }
33 
34 const wxString &CommandType::GetName()
35 {
36  if (mName.empty())
37  mName = BuildName();
38  return mName;
39 }
40 
42 {
43  if (!mSignature)
44  {
47  }
48  return *mSignature;
49 }
50 
52 {
53  wxString desc = GetName() + wxT("\nParameters:");
54  GetSignature();
55  ParamValueMap::iterator iter;
56  ParamValueMap defaults = mSignature->GetDefaults();
57  for (iter = defaults.begin(); iter != defaults.end(); ++iter)
58  {
59  desc += wxT("\n") + iter->first + wxT(": ")
60  + mSignature->GetValidator(iter->first).GetDescription()
61  + wxT(" (default: ")
62  + iter->second.MakeString() + wxT(")");
63  }
64  return desc;
65 }
virtual ~CommandType()
Definition: CommandType.cpp:30
virtual void BuildSignature(CommandSignature &signature)=0
Postcondition: signature is a 'signature' map containing parameter.
std::map< wxString, wxVariant > ParamValueMap
Definition: CommandMisc.h:23
const wxString & GetName()
Definition: CommandType.cpp:34
const wxChar * desc
Definition: ExportPCM.cpp:58
Contains declarations for CommandType class.
Maybe< CommandSignature > mSignature
Definition: CommandType.h:33
CommandSignature & GetSignature()
Definition: CommandType.cpp:41
ParamValueMap GetDefaults() const
virtual wxString GetDescription() const
Definition: Validators.h:74
virtual wxString BuildName()=0
wxString mName
Definition: CommandType.h:32
wxString Describe()
Definition: CommandType.cpp:51
Validator & GetValidator(const wxString &paramName)
Class that maps parameter names to default values and validators.
Declaration of CommandSignature class.
void create(Args &&...args)
Definition: MemoryX.h:632