Audacity 3.2.0
Public Types | Static Public Member Functions | List of all members
GlobalHook< Tag, Signature, Options > Class Template Reference

Global function-valued variable, adding a convenient Call() More...

#include <GlobalVariable.h>

Inheritance diagram for GlobalHook< Tag, Signature, Options >:
[legend]
Collaboration diagram for GlobalHook< Tag, Signature, Options >:
[legend]

Public Types

using result_type = typename std::function< Signature >::result_type
 
- Public Types inherited from GlobalVariable< Tag, const std::function< Signature >, Options... >
using variable_type = GlobalVariable
 
using stored_type = const std::function< Signature >
 
using mutable_type = std::remove_const_t< const std::function< Signature > >
 

Static Public Member Functions

template<typename... Arguments>
static result_type Call (Arguments &&...arguments)
 Null check of the installed function is done for you. More...
 
- Static Public Member Functions inherited from GlobalVariable< Tag, const std::function< Signature >, Options... >
static stored_typeGet ()
 Get the installed value. More...
 
static auto Set (std::conditional_t< true, dummy, mutable_type > replacement) -> std::conditional_t< true, void, mutable_type >
 Move in a new value, move out and return the previous. More...
 

Detailed Description

template<typename Tag, typename Signature, auto... Options>
class GlobalHook< Tag, Signature, Options >

Global function-valued variable, adding a convenient Call()

Definition at line 148 of file GlobalVariable.h.

Member Typedef Documentation

◆ result_type

template<typename Tag , typename Signature , auto... Options>
using GlobalHook< Tag, Signature, Options >::result_type = typename std::function<Signature>::result_type

Definition at line 152 of file GlobalVariable.h.

Member Function Documentation

◆ Call()

template<typename Tag , typename Signature , auto... Options>
template<typename... Arguments>
static result_type GlobalHook< Tag, Signature, Options >::Call ( Arguments &&...  arguments)
inlinestatic

Null check of the installed function is done for you.

Requires that the return type of the function is void or default-constructible

Definition at line 158 of file GlobalVariable.h.

159 {
160 auto &fn = GlobalHook::Get();
161 if (fn)
162 return fn(std::forward<Arguments>(arguments)...);
163 else if constexpr (std::is_void_v<result_type>)
164 return;
165 else
166 return result_type{};
167 }
static const auto fn
typename std::function< Signature >::result_type result_type
static stored_type & Get()
Get the installed value.

References fn, and GlobalVariable< Tag, const std::function< Signature >, Options... >::Get().

Here is the call graph for this function:

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