4#include <entt/entt.hpp>
18template <
typename TDerived,
typename TValue>
struct BasicId {
29 constexpr bool IsNull(
void)
const;
36 constexpr explicit(
false)
BasicId(TValue value_ = TDerived::NullValue());
65 static constexpr Id Null(
void);
68static_assert(
sizeof(
Id) ==
sizeof(
Id::ValueType),
"Id size must be equal to entt::id_type size");
102 "StringId size must be equal to entt::hashed_string size");
109template <>
struct entt::entt_traits<
Engine::Id> : entt::entt_traits<entt::id_type> {
114template <>
struct fmt::formatter<
Engine::Id> : fmt::formatter<entt::id_type> {
121 template <
typename FormatContext>
auto format(
const Engine::Id &
id, FormatContext &context)
const;
128template <>
struct fmt::formatter<
Engine::StringId> : fmt::formatter<std::string_view> {
An Id class for creating strongly-typed ID wrappers. This template provides a common interface for ID...
Definition Id.hpp:18
static constexpr TDerived Null(void)
Get the null value for this ID type. This should be defined by the derived class to specify what cons...
Definition Id.ipp:8
constexpr bool IsNull(void) const
Checks if the ID is null/invalid by comparing its value to the null value defined by the derived clas...
Definition Id.ipp:12
TValue value
The underlying value of the ID.
Definition Id.hpp:20
friend TDerived
Definition Id.hpp:37
A strongly-typed identifier wrapper based on entt::id_type. This structure provides a type-safe wrapp...
Definition Id.hpp:47
constexpr Id(ValueType value_=NullValue())
Constructor for Id.
Definition Id.ipp:17
static constexpr Id Null(void)
Get a null instance of Id, which has its value set to the null value defined by NullValue().
Definition Id.ipp:23
entt::id_type ValueType
Definition Id.hpp:48
static constexpr ValueType NullValue(void)
Get the null value for this ID type. This returns the null value defined by EnTT's id_type,...
Definition Id.ipp:21
A strongly-typed string identifier wrapper based on entt::hashed_string. This structure provides a ty...
Definition Id.hpp:79
static constexpr StringId Null()
Get a null instance of StringId, which has its value set to the null value defined by NullValue().
Definition Id.ipp:29
static constexpr ValueType NullValue()
Get the null value for this StringId type. This returns a default-constructed entt::hashed_string.
Definition Id.ipp:27
constexpr StringId(ValueType v=NullValue())
Constructor for StringId.
Definition Id.ipp:25
entt::hashed_string ValueType
The underlying value type for StringId, which is entt::hashed_string. This type encapsulates the stri...
Definition Id.hpp:83
Engine::Id value_type
Definition Id.hpp:110