Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type Struct Reference
Inheritance diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type:
[legend]
Collaboration diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type:
[legend]

Public Types

using Serializer = std::function< std::optional< wxArrayStringEx >(const wxEvent &) >
 
using Deserializer = std::function< std::unique_ptr< wxEvent >(wxEventType, const wxArrayStringEx &) >
 

Public Member Functions

template<typename Tag , typename SerialFn >
Serializer makeSerializer (SerialFn fn)
 
template<typename Tag , typename Fn >
Deserializer checkDeserializer (wxEventTypeTag< Tag > type, Fn fn)
 
template<typename Tag , typename SerialFn , typename DeserialFn >
 Type (wxEventTypeTag< Tag > type, const Code &code, SerialFn serialFn, DeserialFn deserialFn)
 
- Public Member Functions inherited from Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType
 RegisteredEventType (Code code)
 
- Public Member Functions inherited from Journal::RegisteredCommand
 RegisteredCommand (const wxString &name, Dispatcher dispatcher)
 

Public Attributes

wxEventType type
 Just an int! More...
 
Code code
 Persistent cross-platform name corresponding to the int. More...
 
Serializer serializer
 
Deserializer deserializer
 

Additional Inherited Members

- Static Public Member Functions inherited from Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType
static bool DispatchEvent (wxArrayStringEx fields)
 

Detailed Description

An entry in a catalog describing the types of events that are intercepted and recorded, and simulated when playing back.

Definition at line 78 of file JournalEvents.cpp.

Member Typedef Documentation

◆ Deserializer

using Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::Deserializer = std::function< std::unique_ptr<wxEvent>( wxEventType, const wxArrayStringEx& ) >

Definition at line 87 of file JournalEvents.cpp.

◆ Serializer

using Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::Serializer = std::function< std::optional<wxArrayStringEx>( const wxEvent& ) >

Definition at line 83 of file JournalEvents.cpp.

Constructor & Destructor Documentation

◆ Type()

template<typename Tag , typename SerialFn , typename DeserialFn >
Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::Type ( wxEventTypeTag< Tag >  type,
const Code code,
SerialFn  serialFn,
DeserialFn  deserialFn 
)
inline
Parameters
typesuch as wxEVT_BUTTON Tag is deduced at compile time, the int value is fixed at runtime

Definition at line 125 of file JournalEvents.cpp.

131 , type{ type }
132 , code{ code }
133 , serializer{ makeSerializer<Tag>( std::move( serialFn ) ) }
134 , deserializer{ checkDeserializer( type, std::move( deserialFn ) ) }
135 {
136 }
Deserializer checkDeserializer(wxEventTypeTag< Tag > type, Fn fn)
Code code
Persistent cross-platform name corresponding to the int.

Member Function Documentation

◆ checkDeserializer()

template<typename Tag , typename Fn >
Deserializer Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::checkDeserializer ( wxEventTypeTag< Tag >  type,
Fn  fn 
)
inline

Definition at line 106 of file JournalEvents.cpp.

107 {
108 // Check consistency of the deduced template parameters
109 // The deserializer should produce unique pointer to Tag
110 using DeserializerResult =
111 decltype( *fn( wxEVT_NULL, wxArrayStringEx{} ) );
112 static_assert( std::is_same_v< Tag&, DeserializerResult >,
113 "deserializer produces the wrong type" );
114
115 return std::move( fn );
116 }
static const auto fn
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

References fn.

◆ makeSerializer()

template<typename Tag , typename SerialFn >
Serializer Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::makeSerializer ( SerialFn  fn)
inline

Definition at line 93 of file JournalEvents.cpp.

94 {
95 // Return an adaptor taking wxEvent
96 return [fn = std::move( fn )]( const wxEvent &e ){
97 return fn(dynamic_cast<const Tag&>(e));
98 };
99 }

References fn.

Member Data Documentation

◆ code

Code Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::code

Persistent cross-platform name corresponding to the int.

Definition at line 140 of file JournalEvents.cpp.

◆ deserializer

Deserializer Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::deserializer

Definition at line 142 of file JournalEvents.cpp.

◆ serializer

Serializer Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::serializer

Definition at line 141 of file JournalEvents.cpp.

◆ type

wxEventType Journal::Events::anonymous_namespace{JournalEvents.cpp}::Type::type

Just an int!

Definition at line 139 of file JournalEvents.cpp.


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