Audacity  2.2.0
CommandBuilder.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2009 Audacity Team
5  File License: wxWidgets
6 
7  Dan Horgan
8 
9 ******************************************************************//*******************************************************************/
15 
16 #ifndef __COMMANDBUILDER__
17 #define __COMMANDBUILDER__
18 
19 #include "../MemoryX.h"
20 #include <wx/string.h>
21 
22 class Command;
23 using CommandHolder = std::shared_ptr<Command>;
24 class wxString;
25 
26 // CommandBuilder has the task of validating and interpreting a command string.
27 // If the string represents a valid command, it builds the command object.
28 
30 {
31  private:
32  bool mValid;
34  wxString mError;
35 
36  void Failure(const wxString &msg = wxEmptyString);
37  void Success(const CommandHolder &cmd);
38  void BuildCommand(const wxString &cmdName, const wxString &cmdParams);
39  void BuildCommand(const wxString &cmdString);
40  public:
41  CommandBuilder(const wxString &cmdString);
42  CommandBuilder(const wxString &cmdName,
43  const wxString &cmdParams);
45  bool WasValid();
47  const wxString &GetErrorMessage();
48 };
49 #endif /* End of include guard: __COMMANDBUILDER__ */
CommandBuilder(const wxString &cmdString)
Definition: CommandBuilder.cpp:33
const wxString & GetErrorMessage()
Definition: CommandBuilder.cpp:54
std::shared_ptr< Command > CommandHolder
Definition: AppCommandEvent.h:26
void Success(const CommandHolder &cmd)
Definition: CommandBuilder.cpp:74
bool WasValid()
Definition: CommandBuilder.cpp:49
void BuildCommand(const wxString &cmdName, const wxString &cmdParams)
Definition: CommandBuilder.cpp:80
Base class which encapsulates a process.
Definition: Command.h:60
void Failure(const wxString &msg=wxEmptyString)
Definition: CommandBuilder.cpp:68
wxString mError
Definition: CommandBuilder.h:34
CommandHolder GetCommand()
Definition: CommandBuilder.cpp:59
CommandHolder mCommand
Definition: CommandBuilder.h:33
~CommandBuilder()
Definition: CommandBuilder.cpp:45
bool mValid
Definition: CommandBuilder.h:32
A type of factory for Commands of various sorts.
Definition: CommandBuilder.h:29