VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::HookResult< Ret > Class Template Reference

A hook before-handler's verdict. More...

#include <HookResult.hpp>

Public Member Functions

 HookResult ()=default
 
HookAction Action () const noexcept
 
const Ret & Value () const &noexcept
 
Ret Value () &&
 

Static Public Member Functions

static HookResult Replace (Ret value)
 
static HookResult Block (Ret value)
 

Detailed Description

template<class Ret>
class VoltMod::HookResult< Ret >

A hook before-handler's verdict.

Default-constructs to HookAction::Allow, so return {}; passes the call through. A handler that returns nothing at all is treated the same way.

Names no hooking machinery, so a header may return one without reaching <VoltMod/Unsafe/Hook.hpp>.

Definition at line 28 of file HookResult.hpp.

Constructor & Destructor Documentation

◆ HookResult()

template<class Ret >
VoltMod::HookResult< Ret >::HookResult ( )
default

Member Function Documentation

◆ Action()

template<class Ret >
HookAction VoltMod::HookResult< Ret >::Action ( ) const
inlinenoexcept

Definition at line 42 of file HookResult.hpp.

◆ Block()

template<class Ret >
static HookResult VoltMod::HookResult< Ret >::Block ( Ret  value)
inlinestatic

Do not run the original at all; return value instead.

Definition at line 40 of file HookResult.hpp.

References VoltMod::Block.

Referenced by VoltMod::AdmitClient(), VoltMod::FilterTextMessage(), and VoltMod::RunCommand().

◆ Replace()

template<class Ret >
static HookResult VoltMod::HookResult< Ret >::Replace ( Ret  value)
inlinestatic

Run the original, then return value rather than what it produced.

Definition at line 37 of file HookResult.hpp.

References VoltMod::Replace.

◆ Value() [1/2]

template<class Ret >
Ret VoltMod::HookResult< Ret >::Value ( ) &&
inline

Definition at line 46 of file HookResult.hpp.

◆ Value() [2/2]

template<class Ret >
const Ret & VoltMod::HookResult< Ret >::Value ( ) const &
inlinenoexcept

Meaningless unless Action is Replace or Block.

Definition at line 45 of file HookResult.hpp.


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