55#ifndef __COMMANDTARGETS__
56#define __COMMANDTARGETS__
70 virtual void Update(
double completed) = 0;
79 virtual void Update(
const wxString &message) = 0;
80 virtual void StartArray();
81 virtual void EndArray();
82 virtual void StartStruct();
83 virtual void EndStruct();
84 virtual void AddItem(
const wxString &value ,
const wxString &
name = {} );
85 virtual void AddBool(
const bool value ,
const wxString &
name = {} );
86 virtual void AddItem(
const double value ,
const wxString &
name = {} );
87 virtual void StartField(
const wxString &
name = {} );
88 virtual void EndField( );
90 wxString Escaped(
const wxString &
str);
104 void AddItem(
const wxString &value ,
const wxString &
name = {} )
override
106 void AddBool(
const bool value ,
const wxString &
name = {} )
override
108 void AddItem(
const double value ,
const wxString &
name = {} )
override
127 virtual void AddItem(
const wxString &value ,
const wxString &
name = {} )
override;
128 virtual void AddBool(
const bool value ,
const wxString &
name = {} )
override;
129 virtual void AddItem(
const double value ,
const wxString &
name = {} )
override;
142 virtual void AddItem(
const wxString &value ,
const wxString &
name = {} )
override;
143 virtual void AddBool(
const bool value ,
const wxString &
name = {} )
override;
144 virtual void AddItem(
const double value ,
const wxString &
name = {} )
override;
154 void Update(
double WXUNUSED(completed))
override {}
170 virtual ~GUIProgressTarget() {}
171 void Update(
double completed)
override
173 mProgress.
Update(completed);
183 std::unique_ptr<CommandMessageTarget>
mTarget;
193 mTarget->Update(wxString::Format(
wxT(
"%.2f%%"), completed*100));
202 void Update(
const wxString &)
override {}
210 void Update(
const wxString &message)
override;
222 void Update(
const wxString &message)
override;
242 void Update(
const wxString &message)
override
261 std::unique_ptr<CommandMessageTarget>
m1,
m2;
264 std::unique_ptr<CommandMessageTarget> &&t2)
273 void Update(
const wxString &message)
override
291 return std::make_unique<NullProgressTarget>();
296 return std::make_shared<MessageBoxTarget>();
329 void Status(
const wxString &status,
bool bFlush=
false)
const TranslatableString name
BriefCommandMessageTarget is a CommandOutputTarget that provides status in a briefer listing.
virtual void StartStruct() override
virtual void EndArray() override
BriefCommandMessageTarget(CommandMessageTarget &target)
virtual void EndStruct() override
virtual void AddBool(const bool value, const wxString &name={}) override
virtual void StartField(const wxString &name={}) override
virtual void AddItem(const double value, const wxString &name={}) override
virtual void EndField() override
virtual void AddItem(const wxString &value, const wxString &name={}) override
virtual void StartArray() override
BriefCommandOutputTargets is a CommandOutputTargets that replaces the status message target with the ...
CommandOutputTargets * pToRestore
Sends messages to two message targets at once.
CombinedMessageTarget(std::unique_ptr< CommandMessageTarget > &&t1, std::unique_ptr< CommandMessageTarget > &&t2)
std::unique_ptr< CommandMessageTarget > m2
std::unique_ptr< CommandMessageTarget > m1
void Update(const wxString &message) override
CommandMessageTargetDecorator is a CommandOutputTarget that forwards its work on to another one....
void AddBool(const bool value, const wxString &name={}) override
void StartStruct() override
void StartField(const wxString &name={}) override
void AddItem(const double value, const wxString &name={}) override
void AddItem(const wxString &value, const wxString &name={}) override
~CommandMessageTargetDecorator() override
void EndStruct() override
void Update(const wxString &message) override
void StartArray() override
CommandMessageTargetDecorator(CommandMessageTarget &target)
CommandMessageTarget & mTarget
Interface for objects that can receive (string) messages from a command.
virtual void AddBool(const bool value, const wxString &name={})
std::vector< int > mCounts
virtual ~CommandMessageTarget()
virtual void AddItem(const wxString &value, const wxString &name={})
virtual void Update(const wxString &message)=0
virtual void StartField(const wxString &name={})
virtual void StartStruct()
virtual void StartArray()
CommandOutputTargets a mix of three output classes to output progress indication, status messages and...
std::shared_ptr< CommandMessageTarget > mStatusTarget
void AddItem(const double value, const wxString &name={})
std::unique_ptr< CommandProgressTarget > mProgressTarget
void StartField(const wxString &name)
std::shared_ptr< CommandMessageTarget > mErrorTarget
void AddBool(const bool value, const wxString &name={})
void Error(const wxString &message)
CommandOutputTargets(std::unique_ptr< CommandProgressTarget > &&pt=TargetFactory::ProgressDefault(), std::shared_ptr< CommandMessageTarget > &&st=TargetFactory::MessageDefault(), std::shared_ptr< CommandMessageTarget > &&et=TargetFactory::MessageDefault())
void AddItem(const wxString &value, const wxString &name={})
void Progress(double completed)
void Status(const wxString &status, bool bFlush=false)
Interface for objects that can receive command progress information.
virtual ~CommandProgressTarget()
virtual void Update(double completed)=0
InteractiveOutputTargets is an output target that pops up a dialog, if necessary.
InteractiveOutputTargets()
LispifiedCommandOutputTargets is a CommandOutputTargets that replaces the status message target with ...
CommandOutputTargets * pToRestore
LispyCommandMessageTarget is a CommandOutputTarget that provides status in a lispy style.
virtual void StartStruct() override
virtual void StartField(const wxString &name={}) override
LispyCommandMessageTarget(CommandMessageTarget &target)
virtual void EndArray() override
virtual void AddBool(const bool value, const wxString &name={}) override
virtual void EndField() override
virtual void EndStruct() override
virtual void StartArray() override
virtual void AddItem(const wxString &value, const wxString &name={}) override
Displays messages from a command in an AudacityMessageBox.
virtual ~MessageBoxTarget()
Used to ignore a command's message updates.
void Update(const wxString &) override
virtual ~NullMessageTarget()
Used to ignore a command's progress updates.
virtual ~NullProgressTarget()
void Update(double WXUNUSED(completed)) override
ProgressResult Update(int value, const TranslatableString &message={})
ProgressToMessageTarget formats the percentage complete text as a message and sends it to that messag...
void Update(double completed) override
ProgressToMessageTarget(std::unique_ptr< CommandMessageTarget > &&target)
virtual ~ProgressToMessageTarget()
std::unique_ptr< CommandMessageTarget > mTarget
Constructs a response (to be sent back to a script)
virtual void Flush() override
void Update(const wxString &message) override
virtual ~ResponseTarget()
Displays messages from a command in a wxStatusBar.
StatusBarTarget(wxStatusBar &sb)
TargetFactory makes Command output targets. By default, we ignore progress updates but display all ot...
static std::unique_ptr< CommandProgressTarget > ProgressDefault()
static std::shared_ptr< CommandMessageTarget > MessageDefault()