Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Engine::StringId Struct Reference

Static assertion to ensure that the size of Id matches the size of entt::id_type, guaranteeing that there is no additional overhead from the wrapper and that it can be used interchangeably with entt::id_type without penalties. More...

#include <Id.hpp>

Inheritance diagram for Engine::StringId:
Engine::BasicId< StringId, entt::hashed_string >

Public Types

using ValueType = entt::hashed_string
 The underlying value type for StringId, which is entt::hashed_string. This type encapsulates the string data and its hash, allowing for efficient comparisons and lookups while maintaining the original string for debugging purposes.

Public Member Functions

constexpr StringId (ValueType v=NullValue())
 Constructor for StringId.

Static Public Member Functions

static constexpr ValueType NullValue ()
 Get the null value for this StringId type. This returns a default-constructed entt::hashed_string.
static constexpr StringId Null ()
 Get a null instance of StringId, which has its value set to the null value defined by NullValue().

Additional Inherited Members

Public Attributes inherited from Engine::BasicId< StringId, entt::hashed_string >
entt::hashed_string value
 The underlying value of the ID.

Detailed Description

Static assertion to ensure that the size of Id matches the size of entt::id_type, guaranteeing that there is no additional overhead from the wrapper and that it can be used interchangeably with entt::id_type without penalties.

A strongly-typed string identifier wrapper based on entt::hashed_string. This structure provides a type-safe wrapper around EnTT's hashed_string, designed for efficient compile-time and runtime string hashing. Unlike Id, this is specifically for string-based identifiers and does not provide implicit conversion to the underlying type. String hashing allows for fast comparisons while maintaining human-readable identifiers during development and debugging.

Note
Supports implicit construction from entt::hashed_string values
Size is guaranteed to match entt::hashed_string through static assertion
Useful for named resources, tags, and other string-based identification schemes

Member Typedef Documentation

◆ ValueType

using Engine::StringId::ValueType = entt::hashed_string

The underlying value type for StringId, which is entt::hashed_string. This type encapsulates the string data and its hash, allowing for efficient comparisons and lookups while maintaining the original string for debugging purposes.

Constructor & Destructor Documentation

◆ StringId()

Engine::StringId::StringId ( ValueType v = NullValue())
inlineconstexpr

Constructor for StringId.

Parameters
vThe value to initialize the StringId with. Defaults to the null value defined by the NullValue() method.
Todo
Put the implementation in the cpp file if possible

Member Function Documentation

◆ Null()

constexpr StringId Engine::StringId::Null ( )
inlinestaticconstexpr

Get a null instance of StringId, which has its value set to the null value defined by NullValue().

Returns
A null instance of StringId.
Todo
Put the implementation in the cpp file if possible

◆ NullValue()

constexpr ValueType Engine::StringId::NullValue ( )
inlinestaticconstexpr

Get the null value for this StringId type. This returns a default-constructed entt::hashed_string.

Returns
The value representing a null/invalid StringId for this type.
Todo
Put the implementation in the cpp file if possible

The documentation for this struct was generated from the following file: