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

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. 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.
Public Member Functions inherited from Engine::BasicId< StringId, entt::hashed_string >
constexpr bool IsNull (void) const
 Checks if the ID is null/invalid by comparing its value to the null value defined by the derived class.

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().
Static Public Member Functions inherited from Engine::BasicId< StringId, entt::hashed_string >
static constexpr StringId Null (void)
 Get the null value for this ID type. This should be defined by the derived class to specify what constitutes a null/invalid ID.

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

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())
constexpr

Constructor for StringId.

Parameters
vThe value to initialize the StringId with. Defaults to the null value defined by the NullValue() method.

Member Function Documentation

◆ Null()

StringId Engine::StringId::Null ( void )
staticconstexpr

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

Returns
A null instance of StringId.

◆ NullValue()

StringId::ValueType Engine::StringId::NullValue ( )
staticconstexpr

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.

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