Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
CommandOutputTargets Class Reference

CommandOutputTargets a mix of three output classes to output progress indication, status messages and errors. More...

#include <CommandTargets.h>

Inheritance diagram for CommandOutputTargets:
[legend]
Collaboration diagram for CommandOutputTargets:
[legend]

Public Member Functions

 CommandOutputTargets (std::unique_ptr< CommandProgressTarget > pt=TargetFactory::ProgressDefault(), std::shared_ptr< CommandMessageTarget > st=TargetFactory::MessageDefault(), std::shared_ptr< CommandMessageTarget > et=TargetFactory::MessageDefault())
 
 ~CommandOutputTargets ()
 
void Progress (double completed)
 
void Status (const wxString &status, bool bFlush=false)
 
void Error (const wxString &message)
 
void StartArray ()
 
void EndArray ()
 
void StartStruct ()
 
void EndStruct ()
 
void StartField (const wxString &name)
 
void EndField ()
 
void AddItem (const wxString &value, const wxString &name={})
 
void AddBool (const bool value, const wxString &name={})
 
void AddItem (const double value, const wxString &name={})
 

Public Attributes

std::unique_ptr< CommandProgressTargetmProgressTarget
 
std::shared_ptr< CommandMessageTargetmStatusTarget
 
std::shared_ptr< CommandMessageTargetmErrorTarget
 

Detailed Description

CommandOutputTargets a mix of three output classes to output progress indication, status messages and errors.

Used to aggregate the various output targets a command may have. Assumes responsibility for pointers passed into it. mProgressTarget is a unique pointer, but mStatusTraget and mErrorTarget are shared ones, because they may both point to the same output

Definition at line 274 of file CommandTargets.h.

Constructor & Destructor Documentation

◆ CommandOutputTargets()

CommandOutputTargets::CommandOutputTargets ( std::unique_ptr< CommandProgressTarget pt = TargetFactory::ProgressDefault(),
std::shared_ptr< CommandMessageTarget st = TargetFactory::MessageDefault(),
std::shared_ptr< CommandMessageTarget et = TargetFactory::MessageDefault() 
)
inline

Definition at line 281 of file CommandTargets.h.

288 : mProgressTarget(std::move(pt)), mStatusTarget(st), mErrorTarget(et)
289 { }
std::shared_ptr< CommandMessageTarget > mStatusTarget
std::unique_ptr< CommandProgressTarget > mProgressTarget
std::shared_ptr< CommandMessageTarget > mErrorTarget

◆ ~CommandOutputTargets()

CommandOutputTargets::~CommandOutputTargets ( )
inline

Definition at line 290 of file CommandTargets.h.

291 {
292 }

Member Function Documentation

◆ AddBool()

void CommandOutputTargets::AddBool ( const bool  value,
const wxString &  name = {} 
)
inline

Definition at line 347 of file CommandTargets.h.

347 {} )
348 {
349 if (mStatusTarget)
350 mStatusTarget->AddItem( value, name );
351 }
wxString name
Definition: TagsEditor.cpp:166

◆ AddItem() [1/2]

void CommandOutputTargets::AddItem ( const double  value,
const wxString &  name = {} 
)
inline

Definition at line 352 of file CommandTargets.h.

352 {} )
353 {
354 if (mStatusTarget)
355 mStatusTarget->AddItem( value, name );
356 }

◆ AddItem() [2/2]

void CommandOutputTargets::AddItem ( const wxString &  value,
const wxString &  name = {} 
)
inline

Definition at line 342 of file CommandTargets.h.

342 {} )
343 {
344 if (mStatusTarget)
345 mStatusTarget->AddItem( value, name );
346 }

◆ EndArray()

void CommandOutputTargets::EndArray ( )
inline

Definition at line 317 of file CommandTargets.h.

318 {
319 if (mStatusTarget)
320 mStatusTarget->EndArray();
321 }

References mStatusTarget.

◆ EndField()

void CommandOutputTargets::EndField ( )
inline

Definition at line 337 of file CommandTargets.h.

338 {
339 if (mStatusTarget)
340 mStatusTarget->EndField();
341 }

References mStatusTarget.

◆ EndStruct()

void CommandOutputTargets::EndStruct ( )
inline

Definition at line 327 of file CommandTargets.h.

328 {
329 if (mStatusTarget)
330 mStatusTarget->EndStruct();
331 }

References mStatusTarget.

◆ Error()

void CommandOutputTargets::Error ( const wxString &  message)
inline

Definition at line 307 of file CommandTargets.h.

308 {
309 if (mErrorTarget)
310 mErrorTarget->Update(message);
311 }

References mErrorTarget.

◆ Progress()

void CommandOutputTargets::Progress ( double  completed)
inline

Definition at line 294 of file CommandTargets.h.

295 {
296 if (mProgressTarget)
297 mProgressTarget->Update(completed);
298 }

References mProgressTarget.

◆ StartArray()

void CommandOutputTargets::StartArray ( )
inline

Definition at line 312 of file CommandTargets.h.

313 {
314 if (mStatusTarget)
315 mStatusTarget->StartArray();
316 }

References mStatusTarget.

◆ StartField()

void CommandOutputTargets::StartField ( const wxString &  name)
inline

Definition at line 332 of file CommandTargets.h.

333 {
334 if (mStatusTarget)
335 mStatusTarget->StartField(name);
336 }

References mStatusTarget, and name.

◆ StartStruct()

void CommandOutputTargets::StartStruct ( )
inline

Definition at line 322 of file CommandTargets.h.

323 {
324 if (mStatusTarget)
325 mStatusTarget->StartStruct();
326 }

References mStatusTarget.

◆ Status()

void CommandOutputTargets::Status ( const wxString &  status,
bool  bFlush = false 
)
inline

Definition at line 299 of file CommandTargets.h.

300 {
301 if (mStatusTarget){
302 mStatusTarget->Update(status);
303 if( bFlush )
304 mStatusTarget->Flush();
305 }
306 }

References mStatusTarget.

Member Data Documentation

◆ mErrorTarget

std::shared_ptr<CommandMessageTarget> CommandOutputTargets::mErrorTarget

◆ mProgressTarget

std::unique_ptr<CommandProgressTarget> CommandOutputTargets::mProgressTarget

◆ mStatusTarget

std::shared_ptr<CommandMessageTarget> CommandOutputTargets::mStatusTarget

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