- More implementations and dependencies for Linux Wayland support
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
///
|
||||
///
|
||||
|
||||
#if _MSC_VER
|
||||
#if FENNEC_COMPILER_MSVC
|
||||
#define __PRETTY_FUNCTION__ __FUNCSIG__
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#ifndef FENNEC_LANG_CONSTANTS_H
|
||||
#define FENNEC_LANG_CONSTANTS_H
|
||||
|
||||
#include <fennec/lang/types.h>
|
||||
|
||||
///
|
||||
///
|
||||
/// \page fennec_lang_constants Constants
|
||||
@@ -61,8 +63,6 @@
|
||||
/// </table>
|
||||
///
|
||||
|
||||
#include <fennec/lang/types.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef FENNEC_LANG_DETAIL_INT_H
|
||||
#define FENNEC_LANG_DETAIL_INT_H
|
||||
|
||||
#if _MSC_VER
|
||||
#if FENNEC_COMPILER_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4117)
|
||||
|
||||
|
||||
35
include/fennec/lang/detail/__typeuuid.h
Normal file
35
include/fennec/lang/detail/__typeuuid.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#ifndef FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||
#define FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||
|
||||
#include <fennec/lang/types.h>
|
||||
|
||||
namespace fennec::detail
|
||||
{
|
||||
|
||||
template<typename RootT>
|
||||
FENNEC_NO_INLINE uint64_t __typeuuid() {
|
||||
static uint64_t i = 0;
|
||||
return ++i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||
@@ -54,8 +54,10 @@ struct hash<IntT> : hash<uint64_t> {
|
||||
|
||||
// Wrapper for pointers
|
||||
template<typename PtrT>
|
||||
requires is_pointer_v<PtrT>
|
||||
struct hash<PtrT> : hash<uintptr_t> {
|
||||
struct hash<PtrT*> : hash<uintptr_t> {
|
||||
constexpr size_t operator()(PtrT* ptr) const {
|
||||
return hash<uintptr_t>::operator()((uintptr_t)(const void*)ptr);
|
||||
}
|
||||
};
|
||||
|
||||
// Float
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
|
||||
// TODO: More compiler support
|
||||
|
||||
#if _MSC_VER
|
||||
#if FENNEC_COMPILER_MSVC
|
||||
|
||||
# define FENNEC_HAS_BUILTIN_ADDRESS_OF 1
|
||||
# define FENNEC_BUILTIN_ADDRESS_OF(arg) __builtin_addressof(arg)
|
||||
|
||||
@@ -119,6 +119,14 @@ template<typename T> auto declval() noexcept -> decltype(detail::__declval<T>(0)
|
||||
return detail::__declval<T>(0);
|
||||
}
|
||||
|
||||
constexpr inline bool is_constant_evaluated() noexcept {
|
||||
if consteval {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fennec::is_void =====================================================================================================
|
||||
|
||||
|
||||
@@ -263,15 +263,15 @@ namespace fennec
|
||||
/// \name Sized Integer Types
|
||||
/// @{
|
||||
|
||||
using int8_t = schar_t; ///< \brief Signed 8-bit integer
|
||||
using int16_t = short_t; ///< \brief Signed 16-bit integer
|
||||
using int32_t = conditional_t<sizeof(int_t) == 4, int_t, long_t>; ///< \brief Signed 32-bit integer
|
||||
using int64_t = conditional_t<sizeof(long_t) == 8, long_t, llong_t>; ///< \brief Signed 64-bit integer
|
||||
using int8_t = ::int8_t; ///< \brief Signed 8-bit integer
|
||||
using int16_t = ::int16_t; ///< \brief Signed 16-bit integer
|
||||
using int32_t = ::int32_t; ///< \brief Signed 32-bit integer
|
||||
using int64_t = ::int64_t; ///< \brief Signed 64-bit integer
|
||||
|
||||
using uint8_t = uchar_t; ///< \brief Unsigned 8-bit integer
|
||||
using uint16_t = ushort_t; ///< \brief Unsigned 16-bit integer
|
||||
using uint32_t = conditional_t<sizeof(uint_t) == 4, uint_t, ulong_t>; ///< \brief Unsigned 32-bit integer
|
||||
using uint64_t = conditional_t<sizeof(ulong_t) == 8, ulong_t, ullong_t>; ///< \brief Unsigned 64-bit integer
|
||||
using uint8_t = ::uint8_t; ///< \brief Unsigned 8-bit integer
|
||||
using uint16_t = ::uint16_t; ///< \brief Unsigned 16-bit integer
|
||||
using uint32_t = ::uint32_t; ///< \brief Unsigned 32-bit integer
|
||||
using uint64_t = ::uint64_t; ///< \brief Unsigned 64-bit integer
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
47
include/fennec/lang/typeuuid.h
Normal file
47
include/fennec/lang/typeuuid.h
Normal file
@@ -0,0 +1,47 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#ifndef FENNEC_LANG_TYPEUUID_H
|
||||
#define FENNEC_LANG_TYPEUUID_H
|
||||
|
||||
#include <fennec/lang/assert.h>
|
||||
#include <fennec/lang/types.h>
|
||||
#include <fennec/lang/type_traits.h>
|
||||
|
||||
#include <fennec/lang/detail/__typeuuid.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
constexpr uint64_t nullid = 0;
|
||||
|
||||
template<typename TypeT, typename RootT = void>
|
||||
FENNEC_NO_INLINE uint64_t typeuuid() {
|
||||
assertf(not is_constant_evaluated(), "Type UUIDs Cannot Be Obtained at Compile Time");
|
||||
|
||||
static bool init = false;
|
||||
static uint64_t id = nullid;
|
||||
|
||||
if (init) return id;
|
||||
init = true;
|
||||
return id = detail::__typeuuid<RootT>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_LANG_TYPEUUID_H
|
||||
Reference in New Issue
Block a user