Audacity 3.2.0
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 124 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 133 of file XMLMethodRegistry.h.

134 {
135 // Remember the functions, type-erased
136 auto &registry = Get();
137 registry.PushAccessor(
138 [ fn = std::move(fn) ] ( void *p ) {
139 // CallAttributeHandler will guarantee p is not null
140 return &fn( *static_cast<Host *>(p) ); }
141 );
142 for (auto &pair : pairs)
143 registry.Register( pair.first,
144 [ fn = move(pair.second) ]( auto p, auto value ){
145 fn( *static_cast<Substructure*>(p), value ); }
146 );
147 }
static const auto fn
static XMLMethodRegistry & Get()
Get the unique instance.

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: