Audacity  2.2.2
Public Member Functions | List of all members
GetPreferenceCommand Class Referencefinal

Command for getting the value of a preference. More...

#include <PreferenceCommands.h>

Inheritance diagram for GetPreferenceCommand:
CommandImplementation Command

Public Member Functions

 GetPreferenceCommand (CommandType &type, std::unique_ptr< CommandOutputTarget > &&target)
virtual ~GetPreferenceCommand ()
bool Apply (CommandExecutionContext context) override
- Public Member Functions inherited from CommandImplementation
void Progress (double completed)
void Status (const wxString &status) override
void Error (const wxString &message) override
 CommandImplementation (CommandType &type, std::unique_ptr< CommandOutputTarget > &&output)
virtual ~CommandImplementation ()
wxString GetName ()
 An instance method for getting the command name (for consistency) More...
CommandSignatureGetSignature ()
 Get the signature of the command. More...
bool SetParameter (const wxString &paramName, const wxVariant &paramValue)
- Public Member Functions inherited from Command
virtual ~Command ()

Additional Inherited Members

- Protected Member Functions inherited from CommandImplementation
void TypeCheck (const wxString &typeName, const wxString &paramName, const wxVariant &param)
void CheckParam (const wxString &paramName)
bool HasParam (const wxString &paramName)
bool GetBool (const wxString &paramName)
long GetLong (const wxString &paramName)
double GetDouble (const wxString &paramName)
wxString GetString (const wxString &paramName)
- Protected Attributes inherited from CommandImplementation
< CommandOutputTarget

Detailed Description

Command for getting the value of a preference.

Definition at line 36 of file PreferenceCommands.h.

Constructor & Destructor Documentation

GetPreferenceCommand::GetPreferenceCommand ( CommandType type,
std::unique_ptr< CommandOutputTarget > &&  target 

Definition at line 39 of file PreferenceCommands.h.

41  : CommandImplementation(type, std::move(target))
42  { }
CommandImplementation(CommandType &type, std::unique_ptr< CommandOutputTarget > &&output)
Definition: Command.cpp:95
GetPreferenceCommand::~GetPreferenceCommand ( )

Definition at line 51 of file PreferenceCommands.cpp.

52 { }

Member Function Documentation

bool GetPreferenceCommand::Apply ( CommandExecutionContext  context)

Actually carry out the command. Return true if successful and false otherwise.

Reimplemented from CommandImplementation.

Definition at line 39 of file PreferenceCommands.cpp.

References CommandImplementation::GetString(), gPrefs, and CommandImplementation::Status().

40 {
41  wxString prefName = GetString(wxT("PrefName"));
42  wxString prefValue;
43  if (!gPrefs->Read(prefName, &prefValue))
44  {
45  return false;
46  }
47  Status(prefValue);
48  return true;
49 }
wxString GetString(const wxString &paramName)
Definition: Command.cpp:165
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
void Status(const wxString &status) override
Definition: Command.cpp:179

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