libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
from::DLTX::string_hash Struct Reference

Simple structure that holds a string pointer and a hash of the string. More...

#include <text.hpp>

Public Member Functions

 string_hash ()
 Construct a new string hash object.
 
 string_hash (const wchar_t *str)
 Construct a new string hash object.
 
void may_change () noexcept
 Request a lazy rehash if the string may change.
 
template<typename T >
int get_hash (const T &str) noexcept
 Get the hash of the string.
 
template<typename T >
int hash_string (const T &str) noexcept
 Hash the string and get the hash.
 
void set_string_ptr (const wchar_t *new_ptr)
 Set the underlying string pointer of the hash.
 

Detailed Description

Simple structure that holds a string pointer and a hash of the string.

The string is rehashed after the string could have changed (non-const access). The hash is 32 bits in size.

Constructor & Destructor Documentation

◆ string_hash()

from::DLTX::string_hash::string_hash ( const wchar_t str)
inlineexplicit

Construct a new string hash object.

Parameters
strthe string

Member Function Documentation

◆ get_hash()

template<typename T >
int from::DLTX::string_hash::get_hash ( const T &  str)
inlinenoexcept

Get the hash of the string.

Returns
int hash of the string
Template Parameters
Ttype of the string

◆ hash_string()

template<typename T >
int from::DLTX::string_hash::hash_string ( const T &  str)
inlinenoexcept

Hash the string and get the hash.

Differs from get_hash in that it always rehashes the string, while get_hash may return a cached result if the string has not changed.

The implementation mirrors ELDEN RING's string hashing and produces equivalent hashes for the same strings.

Returns
int hash of the string
Template Parameters
Ttype of the string

◆ set_string_ptr()

void from::DLTX::string_hash::set_string_ptr ( const wchar_t new_ptr)
inline

Set the underlying string pointer of the hash.

Parameters
new_ptrnew pointer to use

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