mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-06 18:08:31 +00:00
Remove dependency on ISourceHook** from MethodInvoker templates.
This commit is contained in:
parent
50772ffc46
commit
8abbfbb810
@ -671,19 +671,19 @@ namespace SourceHook
|
|||||||
* used when the core delegates receive different args than the root proto (eg, varargs!)
|
* used when the core delegates receive different args than the root proto (eg, varargs!)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template<ISourceHook** SourceHook, typename Result, typename... Args>
|
template<typename Result, typename... Args>
|
||||||
struct BaseMethodInvoker
|
struct BaseMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Result (EmptyClass::*EmptyDelegate)(Args...);
|
typedef Result (EmptyClass::*EmptyDelegate)(Args...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<ISourceHook** SourceHook, typename IDelegate, typename... Args>
|
template<typename IDelegate, typename... Args>
|
||||||
struct VoidMethodInvoker
|
struct VoidMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::bool_constant<false> has_return;
|
typedef std::bool_constant<false> has_return;
|
||||||
typedef BaseMethodInvoker<SourceHook, void, Args...> base;
|
typedef BaseMethodInvoker<void, Args...> base;
|
||||||
|
|
||||||
static void Invoke(IDelegate* delegate, void* result, Args... args)
|
static void Invoke(IDelegate* delegate, void* result, Args... args)
|
||||||
{
|
{
|
||||||
@ -710,12 +710,12 @@ namespace SourceHook
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<ISourceHook** SourceHook, typename IDelegate, typename Result, typename... Args>
|
template<typename IDelegate, typename Result, typename... Args>
|
||||||
struct ReturningMethodInvoker
|
struct ReturningMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::bool_constant<true> has_return;
|
typedef std::bool_constant<true> has_return;
|
||||||
typedef BaseMethodInvoker<SourceHook, Result, Args...> base;
|
typedef BaseMethodInvoker<Result, Args...> base;
|
||||||
|
|
||||||
|
|
||||||
static void Invoke(IDelegate* delegate, Result* result, Args... args)
|
static void Invoke(IDelegate* delegate, Result* result, Args... args)
|
||||||
@ -1010,8 +1010,8 @@ namespace SourceHook
|
|||||||
*/
|
*/
|
||||||
typedef typename metaprogramming::if_else<
|
typedef typename metaprogramming::if_else<
|
||||||
std::is_void<Result>::value,
|
std::is_void<Result>::value,
|
||||||
detail::VoidMethodInvoker<SH, IMyDelegate, Args...>,
|
detail::VoidMethodInvoker<IMyDelegate, Args...>,
|
||||||
detail::ReturningMethodInvoker<SH, IMyDelegate, Result, Args...>
|
detail::ReturningMethodInvoker<IMyDelegate, Result, Args...>
|
||||||
>::type Invoker;
|
>::type Invoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -671,19 +671,19 @@ namespace SourceHook
|
|||||||
* used when the core delegates receive different args than the root proto (eg, varargs!)
|
* used when the core delegates receive different args than the root proto (eg, varargs!)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template<ISourceHook** SourceHook, typename Result, typename... Args>
|
template<typename Result, typename... Args>
|
||||||
struct BaseMethodInvoker
|
struct BaseMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Result (EmptyClass::*EmptyDelegate)(Args...);
|
typedef Result (EmptyClass::*EmptyDelegate)(Args...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<ISourceHook** SourceHook, typename IDelegate, typename... Args>
|
template<typename IDelegate, typename... Args>
|
||||||
struct VoidMethodInvoker
|
struct VoidMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::bool_constant<false> has_return;
|
typedef std::bool_constant<false> has_return;
|
||||||
typedef BaseMethodInvoker<SourceHook, void, Args...> base;
|
typedef BaseMethodInvoker<void, Args...> base;
|
||||||
|
|
||||||
static void Invoke(IDelegate* delegate, void* result, Args... args)
|
static void Invoke(IDelegate* delegate, void* result, Args... args)
|
||||||
{
|
{
|
||||||
@ -710,12 +710,12 @@ namespace SourceHook
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<ISourceHook** SourceHook, typename IDelegate, typename Result, typename... Args>
|
template<typename IDelegate, typename Result, typename... Args>
|
||||||
struct ReturningMethodInvoker
|
struct ReturningMethodInvoker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::bool_constant<true> has_return;
|
typedef std::bool_constant<true> has_return;
|
||||||
typedef BaseMethodInvoker<SourceHook, Result, Args...> base;
|
typedef BaseMethodInvoker<Result, Args...> base;
|
||||||
|
|
||||||
|
|
||||||
static void Invoke(IDelegate* delegate, Result* result, Args... args)
|
static void Invoke(IDelegate* delegate, Result* result, Args... args)
|
||||||
@ -1010,8 +1010,8 @@ namespace SourceHook
|
|||||||
*/
|
*/
|
||||||
typedef typename metaprogramming::if_else<
|
typedef typename metaprogramming::if_else<
|
||||||
std::is_void<Result>::value,
|
std::is_void<Result>::value,
|
||||||
detail::VoidMethodInvoker<SH, IMyDelegate, Args...>,
|
detail::VoidMethodInvoker<IMyDelegate, Args...>,
|
||||||
detail::ReturningMethodInvoker<SH, IMyDelegate, Result, Args...>
|
detail::ReturningMethodInvoker<IMyDelegate, Result, Args...>
|
||||||
>::type Invoker;
|
>::type Invoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user