16#ifndef AEONGAMES_STRINGID_H
17#define AEONGAMES_STRINGID_H
21#include "aeongames/CRC.hpp"
37 template<u
int32_t aStringSize>
38 constexpr StringId (
const char ( &aString ) [aStringSize] ) :
39 mString{aString}, mStringSize{aStringSize}, mId{crc32r ( aString ) } {}
41 constexpr StringId() noexcept = default;
52 constexpr uint32_t
GetId()
const
77 constexpr operator uint32_t()
const
82 operator std::string()
const
84 return std::string{mString};
87 const char* mString{};
88 uint32_t mStringSize{};
CRC-based compile-time string identifier.
constexpr const char * GetString() const
Get the underlying string pointer.
constexpr uint32_t GetId() const
Get the CRC32 identifier.
constexpr StringId(const char(&aString)[aStringSize])
Construct a StringId from a string literal.
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.
<- This is here just for the literals