[+] Added a stupid AuNullCallback concept

This commit is contained in:
Reece Wilson 2021-10-25 18:06:42 +01:00
parent 6157535914
commit 8d0641ab00

View File

@ -93,6 +93,32 @@ static void inline SafeDelete(T *in)
#endif
struct IAuNullDelegate
{
virtual void OnCall() = 0;
};
struct AuNullCallback
{
const AuVoidFunc voidFunc;
const AuSPtr<IAuNullDelegate> callbackFunc;
AU_DEFINE_CTOR_ONE(AuNullCallback, (AuVoidFunc, voidFunc));
AU_DEFINE_CTOR_ONE(AuNullCallback, (AuSPtr<IAuNullDelegate>, callbackFunc));
inline void operator()()
{
if (voidFunc)
{
voidFunc();
}
else if (callbackFunc)
{
callbackFunc->OnCall();
}
}
};
static constexpr inline AuUInt32 AuConvertMagicTag32(const char buffer[4])
{
AuUInt32 magic {};
@ -546,6 +572,9 @@ static inline void AuClearBit(T &value, AuUInt8 idx)
#define AURORA_PERMIT_ARBITRARY_REF
#endif
// I'm sorry to anyone reading this. I wanted it to be verbose. I should've just used my old friends, macros :(
template<typename T>
static inline T AuReadGenericLE(const void *ptr, int offset)
{