Audacity  3.0.3
Public Member Functions | List of all members
XMLMethodRegistry< Host >::AttributeReaderEntries Struct Reference

#include <XMLMethodRegistry.h>

Public Member Functions

template<typename Accessor , typename Substructure = std::remove_reference_t< decltype( std::declval<Accessor>()( std::declval<Host &>() ) ) >>
 AttributeReaderEntries (Accessor fn, Mutators< Substructure > pairs)
 

Detailed Description

template<typename Host>
struct XMLMethodRegistry< Host >::AttributeReaderEntries

Typically statically constructed

Registers procedures to update the host for certain attributes, in two steps: first the accessor which fetches some substructure owned by the host, which is the common step; then, the mutators that rewrite the substructure, each of them associated with one attribute string, and taking a reference to the substructure and a value string.

Definition at line 116 of file XMLMethodRegistry.h.

Constructor & Destructor Documentation

◆ AttributeReaderEntries()

template<typename Host >
template<typename Accessor , typename Substructure = std::remove_reference_t< decltype( std::declval<Accessor>()( std::declval<Host &>() ) ) >>
XMLMethodRegistry< Host >::AttributeReaderEntries::AttributeReaderEntries ( Accessor  fn,
Mutators< Substructure >  pairs 
)
inline

Definition at line 125 of file XMLMethodRegistry.h.

126  {
127  // Remember the functions, type-erased
128  auto &registry = Get();
129  registry.PushAccessor(
130  [ fn = std::move(fn) ] ( void *p ) {
131  // CallAttributeHandler will guarantee p is not null
132  return &fn( *static_cast<Host *>(p) ); }
133  );
134  for (auto &pair : pairs)
135  registry.Register( pair.first,
136  [ fn = move(pair.second) ]( auto p, auto value ){
137  fn( *static_cast<Substructure*>(p), value ); }
138  );
139  }

References fn, and XMLMethodRegistry< Host >::Get().

Here is the call graph for this function:

The documentation for this struct was generated from the following file:
fn
static const auto fn
Definition: WaveformView.cpp:1108
XMLMethodRegistry::Get
static XMLMethodRegistry & Get()
Get the unique instance.