44#include <StormByte/safe/function.hxx>
75 template<
typename Callable>
78 using CallableType = std::remove_cvref_t<Callable>;
79 auto* context =
new CallableType(std::forward<Callable>(callable));
84 (*
static_cast<CallableType*
>(state))(std::move(root));
85 return StormByte::Safe::Status::Success;
87 [](
const void* state)
noexcept ->
void* {
89 return new CallableType(*
static_cast<const CallableType*
>(state));
94 [](
void* state)
noexcept {
95 delete static_cast<CallableType*
>(state);
109 template<
typename Callable>
112 using CallableType = std::remove_cvref_t<Callable>;
113 auto* context =
new CallableType(std::forward<Callable>(callable));
118 *result = (*
static_cast<CallableType*
>(state))(std::move(root));
119 return StormByte::Safe::Status::Success;
121 [](
const void* state)
noexcept ->
void* {
123 return new CallableType(*
static_cast<const CallableType*
>(state));
128 [](
void* state)
noexcept {
129 delete static_cast<CallableType*
>(state);
Config module of the StormByte suite.
Definition alias.hxx:51
StormByte::Safe::Function< void(StormByte::Safe::Shared< Item::Group >)> ReadHook
Safe read callback receiving a Base-owned mutable group handle.
Definition hook.hxx:62
FailureHook MakeFailureHook(Callable &&callable)
Creates a failure hook whose callable context is cloned and released by its creator.
Definition hook.hxx:111
ReadHook MakeReadHook(Callable &&callable)
Creates a read hook whose callable context is cloned and released by its creator.
Definition hook.hxx:77
StormByte::Safe::Function< bool(StormByte::Safe::Shared< const Item::Group >)> FailureHook
Safe parse-failure callback receiving a Base-owned read-only group handle.
Definition hook.hxx:67
Root namespace of the StormByte suite.