/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuroraTypedefs.hpp Date: 2021-6-10 Author: Reece ***/ #pragma once #if !defined(AURORA_RUNTINE_TYPEDEFS_INCLUDE) #include #include #include #include #include #include #include #include #else #if defined(AURORA_RUNTINE_TYPEDEFS_INCLUDE_HEADER) #include #endif #endif template struct AuBoolType { static constexpr bool value = v; using value_type = bool; using type = AuBoolType; constexpr operator value_type() const noexcept { return value; } constexpr value_type operator()() const noexcept { return value; } }; using AuFalseType = AuBoolType; using AuTrueType = AuBoolType; template struct AuIsSame : AuFalseType {}; template struct AuIsSame : AuTrueType {}; template< class T, class U > inline constexpr bool AuIsSame_v = AuIsSame::value; namespace _audetail { template AuBoolType::value> test(int T:: *); template AuFalseType test(...); template std::true_type test_pre_ptr_convertible(const volatile B *); template std::false_type test_pre_ptr_convertible(const volatile void *); template auto test_pre_is_base_of(...)->std::true_type; template auto test_pre_is_base_of(int) -> decltype(test_pre_ptr_convertible(static_cast(nullptr))); } template struct AuIsClass : decltype(_audetail::test(nullptr)) {}; template inline constexpr bool AuIsClass_v = AuIsClass::value; template struct AuIsBaseOf : AuBoolType< AuIsClass_v && AuIsClass_v && decltype(_audetail::test_pre_is_base_of(0))::value > {}; template inline constexpr bool AuIsBaseOf_v = AuIsBaseOf::value; template inline constexpr bool AuIsPointer_v = false; template inline constexpr bool AuIsPointer_v<_Ty *> = true; template inline constexpr bool AuIsPointer_v<_Ty *const> = true; template inline constexpr bool AuIsPointer_v<_Ty *volatile> = true; template inline constexpr bool AuIsPointer_v<_Ty *const volatile> = true; template struct AuRemovePointer {typedef T type;}; template struct AuRemovePointer {typedef T type;}; template struct AuRemovePointer {typedef T type;}; template struct AuRemovePointer {typedef T type;}; template struct AuRemovePointer {typedef T type;}; template using AuRemovePointer_t = typename AuRemovePointer::type; template using AuIsVoid = AuIsSame; template inline constexpr bool AuIsVoid_v = AuIsVoid::value; template struct AuRemoveReference { using type = T; }; template struct AuRemoveReference { using type = T; }; template struct AuRemoveReference { using type = T; }; template using AuRemoveReference_t = typename AuRemoveReference::type; template constexpr AuRemoveReference_t &&AuMove(T &&arg) noexcept { return static_cast &&>(arg); } template struct AuEnableIf { }; template struct AuEnableIf { using type = T; }; template using AuEnableIf_t = typename AuEnableIf::type; template struct AuConditional { using type = T; }; template struct AuConditional { using type = T2; }; template using AuConditional_t = typename AuConditional::type; #if !defined(AURORA_RUNTIME_AU_LIST) #define AURORA_RUNTIME_AU_LIST std::vector #endif #if defined(_CPPSHARP) template using AuList = AURORA_RUNTIME_AU_LIST; #else namespace Aurora::Memory { template struct SpeedyArrayAllocator; } template using AuList = typename std::conditional, AURORA_RUNTIME_AU_LIST, AURORA_RUNTIME_AU_LIST>>::type; #endif #if !defined(AURORA_RUNTIME_AU_ARRAY) #define AURORA_RUNTIME_AU_ARRAY std::array #endif template using AuArray = AURORA_RUNTIME_AU_ARRAY; #if !defined(AURORA_RUNTIME_AU_FUNC) #define AURORA_RUNTIME_AU_FUNC std::function #endif template using AuFunction = AURORA_RUNTIME_AU_FUNC; #if !defined(AURORA_RUNTIME_AU_HASH_MAP) #define AURORA_RUNTIME_AU_HASH_MAP std::unordered_map #endif template using AuHashMap = AURORA_RUNTIME_AU_HASH_MAP; template using AuHashMapEx = AURORA_RUNTIME_AU_HASH_MAP; #if !defined(AURORA_RUNTIME_AU_BST) #define AURORA_RUNTIME_AU_BST std::map #endif template using AuBST = AURORA_RUNTIME_AU_BST; template using AuBSTEx = AURORA_RUNTIME_AU_BST; #if !defined(AURORA_RUNTIME_AU_SHARED_PTR) #define AURORA_RUNTIME_AU_SHARED_PTR std::shared_ptr #endif template using AuSPtr = AURORA_RUNTIME_AU_SHARED_PTR; #if !defined(AURORA_RUNTIME_AU_WEAK_PTR) #define AURORA_RUNTIME_AU_WEAK_PTR std::weak_ptr #endif template using AuWPtr = AURORA_RUNTIME_AU_WEAK_PTR; #if !defined(AURORA_RUNTIME_AU_UNIQUE_PTR) #define AURORA_RUNTIME_AU_UNIQUE_PTR std::unique_ptr #endif #if !defined(AURORA_RUNTIME_AU_DEFAULT_DELETER) #define AURORA_RUNTIME_AU_DEFAULT_DELETER = std::default_delete #endif template using AuUPtr = AURORA_RUNTIME_AU_UNIQUE_PTR; #if !defined(AURORA_RUNTIME_AU_PAIR) #define AURORA_RUNTIME_AU_PAIR std::pair #endif template using AuPair = AURORA_RUNTIME_AU_PAIR; #if !defined(AURORA_RUNTIME_AU_TUPLE) #define AURORA_RUNTIME_AU_TUPLE std::tuple #endif template using AuTuple = AURORA_RUNTIME_AU_TUPLE; #if defined(AURORA_COMPILER_MSVC) using AuAtomicInt = long; #else using AuAtomicInt = int; #endif #if !defined(AURORA_RUNTIME_AU_OPTIONAL) #define AURORA_RUNTIME_AU_OPTIONAL std::optional #endif template using AuOptional = AURORA_RUNTIME_AU_OPTIONAL; template using AuPredicate = AuFunction; using AuVoidFunc = AuFunction; template using AuConsumer = AuFunction; template using AuSupplier = AuFunction; template using AuSupplierConsumer = AuFunction; //#include "tinyutf8.h" using AuString = std::string;// tiny_utf8::utf8_string; using AuUInt64 = Aurora::Types::uint64_t; using AuUInt32 = Aurora::Types::uint32_t; using AuUInt16 = Aurora::Types::uint16_t; using AuUInt8 = Aurora::Types::uint8_t; using AuInt64 = Aurora::Types::int64_t; using AuInt32 = Aurora::Types::int32_t; using AuInt16 = Aurora::Types::int16_t; #if defined(_CPPSHARP) using AuInt8 = Aurora::Types::uint8_t; #else using AuInt8 = Aurora::Types::int8_t; #endif using AuMach = Aurora::Types::size_t; using AuSMach = Aurora::Types::ssize_t; using AuSInt = AuSMach; using AuUInt = AuMach; using AuStreamReadWrittenPair_t = AuPair; using AuThreadId_t = AuUInt64; static const AuThreadId_t kThreadIdSpecialMask = AuThreadId_t(1) << AuThreadId_t(63); #if defined(__has_include) && !defined(_AUHAS_GLM) && defined(_AU_DETECT_GLM) #if __has_include() #define _AUHAS_GLM #endif #endif #if !defined(_AUHAS_GLM) template struct AuFVec { float elements[N]; float operator [](int idx) const { return elements[N]; } float &operator [](int idx) { return elements[N]; } }; using AuVec3 = AuFVec<3>; using AuVec4 = AuFVec<4>; #else #include using AuVec3 = glm::vec3; using AuVec4 = glm::vec4; #endif