Audacity 3.2.0
Public Member Functions | List of all members
Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher Struct Reference

Singleton object listens to global wxEvent stream. More...

Inheritance diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher:
[legend]
Collaboration diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher:
[legend]

Public Member Functions

 Watcher ()
 
 ~Watcher ()
 
int FilterEvent (wxEvent &event) override
 

Detailed Description

Singleton object listens to global wxEvent stream.

Definition at line 380 of file JournalEvents.cpp.

Constructor & Destructor Documentation

◆ Watcher()

Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher::Watcher ( )
inline

Definition at line 382 of file JournalEvents.cpp.

383 {
384 wxEvtHandler::AddFilter( this );
385 }

◆ ~Watcher()

Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher::~Watcher ( )
inline

Definition at line 387 of file JournalEvents.cpp.

388 {
389 wxEvtHandler::RemoveFilter( this );
390 }

Member Function Documentation

◆ FilterEvent()

int Journal::Events::anonymous_namespace{JournalEvents.cpp}::Watcher::FilterEvent ( wxEvent &  event)
inlineoverride

Definition at line 392 of file JournalEvents.cpp.

393 {
394 if (!IsWatching())
395 // Previously encountered error stopped recording of any more events
396 return Event_Skip;
397
398 static const auto &catalog = Events::ByType();
399 const auto type = event.GetEventType();
400 if (const auto iter = catalog.find(type); iter != catalog.end()) {
401 // Try to write a representation to the journal
402 const auto &info = iter->second;
403 auto pStrings = info.serializer(event);
404 if (!pStrings)
405 return Event_Skip;
406 else {
407 pStrings->insert(pStrings->begin(), info.code.GET());
408 Journal::Output(*pStrings);
409 }
410 }
411 else
412 // Just ignore this un-catalogued event type
413 ;
414
415 return Event_Skip;
416 }
void Output(const wxString &string)

References Journal::Events::anonymous_namespace{JournalEvents.cpp}::ByType(), Journal::Events::IsWatching(), and Journal::Output().

Here is the call graph for this function:

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