Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
CommandType Class Referenceabstract

Base class for containing data common to all commands of a given type. Also acts as a factory. More...

#include <CommandType.h>

Inheritance diagram for CommandType:
AutomationCommandsType BatchEvalCommandType CompareAudioCommandType ExecMenuCommandType ExportCommandType GetPreferenceCommandType GetProjectInfoCommandType GetTrackInfoCommandType HelpCommandType ImportCommandType MessageCommandType OpenProjectCommandType SaveProjectCommandType ScreenshotCommandType SelectCommandType SetPreferenceCommandType SetProjectInfoCommandType SetTrackInfoCommandType

Public Member Functions

 CommandType ()
 
virtual ~CommandType ()
 
const wxString & GetName ()
 
CommandSignatureGetSignature ()
 
wxString Describe ()
 
virtual wxString BuildName ()=0
 
virtual void BuildSignature (CommandSignature &signature)=0
 Postcondition: signature is a 'signature' map containing parameter. More...
 
virtual CommandHolder Create (std::unique_ptr< CommandOutputTarget > &&target)=0
 

Private Attributes

wxString mName
 
Maybe< CommandSignaturemSignature
 

Detailed Description

Base class for containing data common to all commands of a given type. Also acts as a factory.

Definition at line 29 of file CommandType.h.

Constructor & Destructor Documentation

CommandType::CommandType ( )

Definition at line 26 of file CommandType.cpp.

27  : mName{}, mSignature{}
28 { }
Maybe< CommandSignature > mSignature
Definition: CommandType.h:33
wxString mName
Definition: CommandType.h:32
CommandType::~CommandType ( )
virtual

Definition at line 30 of file CommandType.cpp.

31 {
32 }

Member Function Documentation

virtual wxString CommandType::BuildName ( )
pure virtual
virtual void CommandType::BuildSignature ( CommandSignature signature)
pure virtual
virtual CommandHolder CommandType::Create ( std::unique_ptr< CommandOutputTarget > &&  target)
pure virtual
wxString CommandType::Describe ( )

Definition at line 51 of file CommandType.cpp.

References desc, CommandSignature::GetDefaults(), Validator::GetDescription(), GetName(), GetSignature(), CommandSignature::GetValidator(), and mSignature.

Referenced by HelpCommand::Apply().

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 }
std::map< wxString, wxVariant > ParamValueMap
Definition: CommandMisc.h:23
const wxString & GetName()
Definition: CommandType.cpp:34
const wxChar * desc
Definition: ExportPCM.cpp:58
Maybe< CommandSignature > mSignature
Definition: CommandType.h:33
CommandSignature & GetSignature()
Definition: CommandType.cpp:41
ParamValueMap GetDefaults() const
virtual wxString GetDescription() const
Definition: Validators.h:74
Validator & GetValidator(const wxString &paramName)
const wxString & CommandType::GetName ( )

Definition at line 34 of file CommandType.cpp.

References BuildName(), and mName.

Referenced by Describe(), and CommandImplementation::GetName().

35 {
36  if (mName.empty())
37  mName = BuildName();
38  return mName;
39 }
virtual wxString BuildName()=0
wxString mName
Definition: CommandType.h:32
CommandSignature & CommandType::GetSignature ( )

Definition at line 41 of file CommandType.cpp.

References BuildSignature(), Maybe< X >::create(), and mSignature.

Referenced by CommandBuilder::BuildCommand(), Describe(), CommandImplementation::GetSignature(), and CommandImplementation::SetParameter().

42 {
43  if (!mSignature)
44  {
47  }
48  return *mSignature;
49 }
virtual void BuildSignature(CommandSignature &signature)=0
Postcondition: signature is a 'signature' map containing parameter.
Maybe< CommandSignature > mSignature
Definition: CommandType.h:33
void create(Args &&...args)
Definition: MemoryX.h:632

Member Data Documentation

wxString CommandType::mName
private

Definition at line 32 of file CommandType.h.

Referenced by GetName().

Maybe<CommandSignature> CommandType::mSignature
private

Definition at line 33 of file CommandType.h.

Referenced by Describe(), and GetSignature().


The documentation for this class was generated from the following files: