Audacity 3.2.0
Static Public Member Functions | Static Public Attributes | List of all members
audacity::sqlite::details::SQLiteFunction< std::function< R(Args...)> > Struct Template Reference

#include <Function.h>

Static Public Member Functions

static SQLiteFunctorWithArgs ToSQLiteFunctorWithArgs (std::function< R(Args...)> callback)
 

Static Public Attributes

static constexpr std::size_t Arity = sizeof...(Args)
 

Detailed Description

template<typename R, typename... Args>
struct audacity::sqlite::details::SQLiteFunction< std::function< R(Args...)> >

Definition at line 73 of file Function.h.

Member Function Documentation

◆ ToSQLiteFunctorWithArgs()

template<typename R , typename... Args>
static SQLiteFunctorWithArgs audacity::sqlite::details::SQLiteFunction< std::function< R(Args...)> >::ToSQLiteFunctorWithArgs ( std::function< R(Args...)>  callback)
inlinestatic

Definition at line 77 of file Function.h.

78 {
79 return [function = std::move(callback)](
80 sqlite3_context* context, int argc, sqlite3_value** argv)
81 {
82 if (argc != sizeof...(Args))
83 {
84 SetSQLiteFunctionError(context, "Invalid number of arguments");
85 return;
86 }
87
88 if constexpr (std::is_same_v<R, void>)
89 {
90 std::apply(
91 function, SQLiteValuesToTuple<Args...>(
92 argv, std::make_index_sequence<sizeof...(Args)>()));
93 }
94 else
95 {
97 context,
98 std::apply(
99 function,
100 SQLiteValuesToTuple<Args...>(
101 argv, std::make_index_sequence<sizeof...(Args)>())));
102 }
103 };
104 }
UTILITY_API const char *const * argv
A copy of argv; responsibility of application startup to assign it.
UTILITY_API int argc
A copy of argc; responsibility of application startup to assign it.
void SetSQLiteFunctionError(sqlite3_context *context, const std::string_view &error)
Definition: Function.cpp:146
void SetSQLiteFunctionResult(sqlite3_context *context, bool value)
Definition: Function.cpp:84

References CommandLineArgs::argc, CommandLineArgs::argv, audacity::sqlite::details::SetSQLiteFunctionError(), and audacity::sqlite::details::SetSQLiteFunctionResult().

Here is the call graph for this function:

Member Data Documentation

◆ Arity

template<typename R , typename... Args>
constexpr std::size_t audacity::sqlite::details::SQLiteFunction< std::function< R(Args...)> >::Arity = sizeof...(Args)
staticconstexpr

Definition at line 75 of file Function.h.


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