103 lines
2.3 KiB
C++
103 lines
2.3 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuroraUtils.hpp
|
|
File: auROXTLUtils.hpp
|
|
Date: 2021-6-9
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#if defined(__has_include)
|
|
#if __has_include(<intrin.h>) && defined(AURORA_PLATFORM_WIN32)
|
|
#include <intrin.h>
|
|
#endif
|
|
#if __has_include(<emmintrin.h>)
|
|
#include <emmintrin.h>
|
|
#endif
|
|
#if __has_include(<xmmintrin.h>)
|
|
#include <xmmintrin.h>
|
|
#endif
|
|
#if __has_include(<immintrin.h>)
|
|
#include <immintrin.h>
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(AURORA_ARCH_X64)
|
|
#include <nmmintrin.h>
|
|
#endif
|
|
|
|
|
|
#include <auROXTL/auMemoryUtils.hpp>
|
|
#include <auROXTL/auCopyMoveUtils.hpp>
|
|
#include <auROXTL/auSwapExchangeUtils.hpp>
|
|
#include <auROXTL/auContainerUtils.hpp>
|
|
#include <auROXTL/auListUtils.hpp>
|
|
#include <auROXTL/auStringUtils.hpp>
|
|
#include <auROXTL/Iterators/auUTF8Iterator.ipp>
|
|
#include <auROXTL/Iterators/auReverseIterator.ipp>
|
|
#include <auROXTL/auTupleUtils.hpp>
|
|
#include <auROXTL/auNumberUtils.hpp>
|
|
#include <auROXTL/auEndianness.hpp>
|
|
#include <auROXTL/auAtomic.hpp>
|
|
#include <auROXTL/auBitsUtils.hpp>
|
|
#include <auROXTL/auMagicUtils.hpp>
|
|
#include <auROXTL/auWin32Utils.hpp>
|
|
|
|
// annoying
|
|
#include <auROXTL/auHashUtils.hpp>
|
|
|
|
namespace __audetail
|
|
{
|
|
template <class T>
|
|
AuUInt HashCode(const T &hashCode)
|
|
{
|
|
return AuHashCode(hashCode);
|
|
}
|
|
}
|
|
|
|
|
|
// annoying
|
|
#include <auROXTL/auCastUtils.hpp>
|
|
|
|
// cont
|
|
#include <auROXTL/auTypeUtils.hpp>
|
|
#include <auROXTL/auNumericLimits.hpp>
|
|
#include <auROXTL/auUnitUtils.hpp>
|
|
#include <auROXTL/auFNV1Utils.hpp>
|
|
#include <auROXTL/auTryConstructUtils.hpp>
|
|
#include <auROXTL/auTryCallUtils.hpp>
|
|
|
|
|
|
#include <auROXTL/Objects/SafeDestroy.hpp>
|
|
#include <auROXTL/Objects/ResetMember.hpp>
|
|
|
|
#include <auROXTL/auBuildTime.hpp>
|
|
|
|
#include <auROXTL/Objects/SOO.hpp>
|
|
|
|
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();
|
|
}
|
|
}
|
|
}; |