virthttp  0.0
libvirt http interface
Typedefs | Functions
subq_impl Namespace Reference

Typedefs

template<class T , class A >
using ToJson = decltype(to_json(std::declval< T && >(), std::declval< A & >()))
 
template<class T , class A >
using GetToJson = decltype(get_to_json(std::declval< T && >(), std::declval< A & >()))
 

Functions

template<class T , class A >
decltype(auto) constexpr auto_serialize (T &&v, A &al)
 
template<class TI , class F , class VC , class TJ >
auto subquery (std::string_view name, std::string_view opt_tag, [[maybe_unused]] TI ti, F &&lifted, VC &&valid_check, TJ &&to_json) noexcept(std::is_nothrow_move_constructible_v< F > &&std::is_nothrow_move_constructible_v< VC > &&std::is_nothrow_move_constructible_v< TJ >)
 subquery overload for functions taking a single flag and without automatically deduced JSON serialization More...
 
template<class F , class VC , class TI >
auto subquery (std::string_view name, std::string_view opt_tag, TI ti, F &&lifted, VC &&valid_check) noexcept(std::is_nothrow_move_constructible_v< F > &&std::is_nothrow_move_constructible_v< VC >) -> decltype(auto)
 subquery overload for functions taking no flag and with automatically deduced JSON serialization More...
 
template<class F , class VC , class TJ , class = std::enable_if_t<!std::is_same_v<F, std::string_view>>>
auto subquery (std::string_view name, F &&lifted, VC &&valid_check, TJ &&to_json) noexcept(std::is_nothrow_move_constructible_v< F > &&std::is_nothrow_move_constructible_v< VC > &&std::is_nothrow_move_constructible_v< TJ >)
 subquery overload for functions taking no flag and without automatically deduced JSON serialization More...
 
template<class F , class VC , class = std::enable_if_t<!std::is_same_v<F, std::string_view>>>
auto subquery (std::string_view name, F &&lifted, VC &&valid_check) noexcept(std::is_nothrow_move_constructible_v< F > &&std::is_nothrow_move_constructible_v< VC >) -> decltype(auto)
 subquery overload for functions taking no flag and with automatically deduced JSON serialization More...
 

Detailed Description

Subquerying implementation details

Typedef Documentation

template<class T , class A >
using subq_impl::GetToJson = typedef decltype(get_to_json(std::declval<T&&>(), std::declval<A&>()))

SFINAE detection helper for the get_to_json function overload set

Template Parameters
Tthe type of the object to be serialized
Athe allocator type
template<class T , class A >
using subq_impl::ToJson = typedef decltype(to_json(std::declval<T&&>(), std::declval<A&>()))

SFINAE detection helper for the to_json function overload set

Template Parameters
Tthe type of the object to be serialized
Athe allocator type

Function Documentation

template<class T , class A >
decltype(auto) constexpr subq_impl::auto_serialize ( T &&  v,
A &  al 
)

SFINAE detection wrapper to select the correct serialization function The function template instanciation will fail to compile by static_assert if the object has no way of being automatically serialized

Template Parameters
T,A(deduced)
Parameters
[in]vthe object to be JSON-serialized; perfect-forwarded
[in]ala reference to the allocator to be used during serialization
Returns
(decltype(auto)) the perfectly forwarded result of the serialization function call
template<class TI , class F , class VC , class TJ >
auto subq_impl::subquery ( std::string_view  name,
std::string_view  opt_tag,
[[maybe_unused] ] TI  ti,
F &&  lifted,
VC &&  valid_check,
TJ &&  to_json 
)
noexcept

subquery overload for functions taking a single flag and without automatically deduced JSON serialization

Note: all three callable parameters are perfectly forwarded to their point of call

Template Parameters
TI,F,VC,TJ(deduced)
Parameters
[in]namethe name of the subquery
[in]opt_tagthe key of the flag value(s) in the query string
[in]tia TypeIdentity<Flag> object where Flag is the type of flag that lifted takes as parameter
[in]liftedthe lifted overload set or function
[in]valid_checka callable used to check the result of the call to lifted; must have a return type contextually convertible to bool
[in]to_jsona callable used to serialize the result of the call to lifted when valid_check has returned an contextual equivalent of true
Returns
a callable able to process the specified subquery
template<class F , class VC , class TI >
auto subq_impl::subquery ( std::string_view  name,
std::string_view  opt_tag,
TI  ti,
F &&  lifted,
VC &&  valid_check 
) -> decltype(auto)
noexcept

subquery overload for functions taking no flag and with automatically deduced JSON serialization

Note: both callable parameters are perfectly forwarded to their point of call

Template Parameters
F,VC,TI(deduced)
Parameters
[in]namethe name of the subquery
[in]opt_tagthe key of the flag value(s) in the query string
[in]tia TypeIdentity<Flag> object where Flag is the type of flag that lifted takes as parameter
[in]liftedthe lifted overload set or function
[in]valid_checka callable used to check the result of the call to lifted; must have a return type contextually convertible to bool
Returns
a callable able to process the specified subquery
template<class F , class VC , class TJ , class = std::enable_if_t<!std::is_same_v<F, std::string_view>>>
auto subq_impl::subquery ( std::string_view  name,
F &&  lifted,
VC &&  valid_check,
TJ &&  to_json 
)
noexcept

subquery overload for functions taking no flag and without automatically deduced JSON serialization

Note: all three callable parameters are perfectly forwarded to their point of call

Template Parameters
F,VC,TJ(deduced)
Parameters
[in]namethe name of the subquery
[in]liftedthe lifted overload set or function
[in]valid_checka callable used to check the result of the call to lifted; must have a return type contextually convertible to bool
[in]to_jsona callable used to serialize the result of the call to lifted when valid_check has returned an contextual equivalent of true
Returns
a callable able to process the specified subquery
template<class F , class VC , class = std::enable_if_t<!std::is_same_v<F, std::string_view>>>
auto subq_impl::subquery ( std::string_view  name,
F &&  lifted,
VC &&  valid_check 
) -> decltype(auto)
noexcept

subquery overload for functions taking no flag and with automatically deduced JSON serialization

Note: both callable parameters are perfectly forwarded to their point of call

Template Parameters
F,VC(deduced)
Parameters
[in]namethe name of the subquery
[in]liftedthe lifted overload set or function
[in]valid_checka callable used to check the result of the call to lifted; must have a return type contextually convertible to bool
Returns
a callable able to process the specified subquery