CRC-based compile-time string identifier.
More...
#include <aeongames/StringId.hpp>
|
| template<uint32_t aStringSize> |
| constexpr | StringId (const char(&aString)[aStringSize]) |
| | Construct a StringId from a string literal.
|
|
constexpr | StringId (const StringId &) noexcept=default |
| | Copy constructor.
|
|
constexpr | StringId (StringId &&aString) noexcept=default |
| | Move constructor.
|
|
constexpr StringId & | operator= (const StringId &) noexcept=default |
| | Copy assignment operator.
|
|
constexpr StringId & | operator= (StringId &&) noexcept=default |
| | Move assignment operator.
|
| constexpr uint32_t | GetId () const |
| | Get the CRC32 identifier.
|
| constexpr const char * | GetString () const |
| | Get the underlying string pointer.
|
| constexpr uint32_t | GetStringSize () const |
| | Get the size of the string including null terminator.
|
| constexpr bool | operator== (const StringId &b) const |
| | Compare two StringId objects for equality.
|
| constexpr bool | operator== (uint32_t b) const |
| | Compare StringId with a raw uint32_t hash.
|
| constexpr | operator uint32_t () const |
| | Convert to uint32_t.
|
| | operator std::string () const |
| | Convert to std::string.
|
CRC-based compile-time string identifier.
Wraps a string literal and its CRC32 hash, enabling efficient compile-time string comparisons and hashing.
Definition at line 30 of file StringId.hpp.
◆ StringId()
template<uint32_t aStringSize>
| AeonGames::StringId::StringId |
( |
const char(&) | aString[aStringSize] | ) |
|
|
inlineconstexpr |
Construct a StringId from a string literal.
- Template Parameters
-
| aStringSize | Size of the string literal including null terminator. |
- Parameters
-
| aString | The string literal to wrap. |
Definition at line 38 of file StringId.hpp.
◆ GetId()
| uint32_t AeonGames::StringId::GetId |
( |
| ) |
const |
|
inlineconstexpr |
Get the CRC32 identifier.
- Returns
- The CRC32 hash of the string.
Definition at line 52 of file StringId.hpp.
◆ GetString()
| const char * AeonGames::StringId::GetString |
( |
| ) |
const |
|
inlineconstexpr |
Get the underlying string pointer.
- Returns
- Pointer to the string literal.
Definition at line 57 of file StringId.hpp.
◆ GetStringSize()
| uint32_t AeonGames::StringId::GetStringSize |
( |
| ) |
const |
|
inlineconstexpr |
Get the size of the string including null terminator.
- Returns
- String size.
Definition at line 62 of file StringId.hpp.
◆ operator std::string()
| AeonGames::StringId::operator std::string |
( |
| ) |
const |
|
inline |
Convert to std::string.
- Returns
- A string copy of the wrapped literal.
Definition at line 82 of file StringId.hpp.
◆ operator uint32_t()
| AeonGames::StringId::operator uint32_t |
( |
| ) |
const |
|
inlineconstexpr |
◆ operator==() [1/2]
| bool AeonGames::StringId::operator== |
( |
const StringId & | b | ) |
const |
|
inlineconstexpr |
Compare two StringId objects for equality.
- Parameters
-
- Returns
- True if IDs match.
Definition at line 67 of file StringId.hpp.
◆ operator==() [2/2]
| bool AeonGames::StringId::operator== |
( |
uint32_t | b | ) |
const |
|
inlineconstexpr |
Compare StringId with a raw uint32_t hash.
- Parameters
-
| b | The hash value to compare. |
- Returns
- True if IDs match.
Definition at line 72 of file StringId.hpp.
The documentation for this class was generated from the following file: