Audacity  3.0.3
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 
21 #include "CommandType.h"
22 
23 #include <wx/string.h>
24 
26  : mSymbol{}, mSignature{}
27 { }
28 
30 {
31 }
32 
34 {
35  if (mSymbol.empty())
36  mSymbol = BuildName();
37  return mSymbol;
38 }
39 
41 {
42  if (!mSignature)
43  {
46  }
47  return *mSignature;
48 }
49 
51 {
52  // PRL: Is this intended for end-user visibility or just debugging? It did not
53  // use _(""), so I assume it is meant to use internal strings
54  wxString desc = GetSymbol().Internal() + wxT("\nParameters:");
55  GetSignature();
56  ParamValueMap::iterator iter;
57  ParamValueMap defaults = mSignature->GetDefaults();
58  for (iter = defaults.begin(); iter != defaults.end(); ++iter)
59  {
60  desc += wxT("\n") + iter->first + wxT(": ")
61  + mSignature->GetValidator(iter->first).GetDescription()
62  + wxT(" (default: ")
63  + iter->second.MakeString() + wxT(")");
64  }
65  return desc;
66 }
Optional::emplace
X & emplace(Args &&... args)
Definition: MemoryX.h:193
ParamValueMap
std::map< wxString, wxVariant > ParamValueMap
Definition: CommandMisc.h:23
CommandSignature::GetValidator
Validator & GetValidator(const wxString &paramName)
Definition: CommandSignature.cpp:47
Validator::GetDescription
virtual wxString GetDescription() const
Definition: Validators.h:78
CommandSignature
Class that maps parameter names to default values and validators.
Definition: CommandSignature.h:29
OldStyleCommandType::Describe
wxString Describe()
Definition: CommandType.cpp:50
desc
const TranslatableString desc
Definition: ExportPCM.cpp:58
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
OldStyleCommandType::GetSignature
CommandSignature & GetSignature()
Definition: CommandType.cpp:40
OldStyleCommandType::BuildName
virtual ComponentInterfaceSymbol BuildName()=0
OldStyleCommandType::mSignature
Optional< CommandSignature > mSignature
Definition: CommandType.h:46
OldStyleCommandType::BuildSignature
virtual void BuildSignature(CommandSignature &signature)=0
Postcondition: signature is a 'signature' map containing parameter.
CommandSignature::GetDefaults
ParamValueMap GetDefaults() const
Definition: CommandSignature.cpp:42
OldStyleCommandType::OldStyleCommandType
OldStyleCommandType()
Definition: CommandType.cpp:25
OldStyleCommandType::mSymbol
ComponentInterfaceSymbol mSymbol
Definition: CommandType.h:45
CommandType.h
Contains declarations for CommandType class.
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterfaceSymbol.h:55
ComponentInterfaceSymbol::empty
bool empty() const
Definition: ComponentInterfaceSymbol.h:62
OldStyleCommandType::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: CommandType.cpp:33
OldStyleCommandType::~OldStyleCommandType
virtual ~OldStyleCommandType()
Definition: CommandType.cpp:29