Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
ResponseTarget Class Referencefinal

Constructs a response (to be sent back to a script) More...

#include <CommandTargets.h>

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

Public Member Functions

 ResponseTarget ()
 
 ~ResponseTarget () override
 
void Update (const wxString &message) override
 
virtual void Flush () override
 
wxString GetResponse ()
 
- Public Member Functions inherited from CommandMessageTarget
 CommandMessageTarget ()
 
virtual ~CommandMessageTarget ()
 
virtual void Update (const wxString &message)=0
 
virtual void StartArray ()
 
virtual void EndArray ()
 
virtual void StartStruct ()
 
virtual void EndStruct ()
 
virtual void AddItem (const wxString &value, const wxString &name={})
 
virtual void AddBool (const bool value, const wxString &name={})
 
virtual void AddItem (const double value, const wxString &name={})
 
virtual void StartField (const wxString &name={})
 
virtual void EndField ()
 
virtual void Flush ()
 
wxString Escaped (const wxString &str)
 

Private Attributes

wxSemaphore mSemaphore
 
wxString mBuffer
 

Additional Inherited Members

- Public Attributes inherited from CommandMessageTarget
std::vector< int > mCounts
 

Detailed Description

Constructs a response (to be sent back to a script)

Definition at line 199 of file CommandTargets.h.

Constructor & Destructor Documentation

◆ ResponseTarget()

ResponseTarget::ResponseTarget ( )
inline

Definition at line 205 of file CommandTargets.h.

206 : mSemaphore(0, 1),
207 mBuffer(wxEmptyString)
208 {
209 // Cater for handling long responses quickly.
210 mBuffer.Alloc(40000);
211 }
wxSemaphore mSemaphore

◆ ~ResponseTarget()

ResponseTarget::~ResponseTarget ( )
overridedefault

Member Function Documentation

◆ Flush()

virtual void ResponseTarget::Flush ( )
inlineoverridevirtual

Reimplemented from CommandMessageTarget.

Definition at line 217 of file CommandTargets.h.

218 {
219 mSemaphore.Post();
220 }

◆ GetResponse()

wxString ResponseTarget::GetResponse ( )
inline

Definition at line 221 of file CommandTargets.h.

222 {
223 mSemaphore.Wait();
224 return mBuffer;
225 }

◆ Update()

void ResponseTarget::Update ( const wxString &  message)
inlineoverridevirtual

Implements CommandMessageTarget.

Definition at line 213 of file CommandTargets.h.

214 {
215 mBuffer += message;
216 }

Member Data Documentation

◆ mBuffer

wxString ResponseTarget::mBuffer
private

Definition at line 203 of file CommandTargets.h.

◆ mSemaphore

wxSemaphore ResponseTarget::mSemaphore
private

Definition at line 202 of file CommandTargets.h.


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