Rebel Fork Framework
Urho3D::StringHash Class Reference

32-bit hash value for a string. More...

#include <Urho3D/Math/StringHash.h>

Public Member Functions

 StringHash () noexcept
 Construct with zero value.
 StringHash (unsigned value) noexcept
 Construct with an initial value.
 StringHash (const char *str) noexcept
 Construct from a C string.
 StringHash (const ea::string &str) noexcept
 Construct from a string.
 StringHash (const ea::string_view &str) noexcept
 Construct from a string.
bool operator== (const StringHash &rhs) const
 Test for equality with another hash.
bool operator!= (const StringHash &rhs) const
 Test for inequality with another hash.
bool operator< (const StringHash &rhs) const
 Test if less than another hash.
bool operator> (const StringHash &rhs) const
 Test if greater than another hash.
bool IsEmpty () const
 Return true if nonempty hash value.
 operator bool () const
 Return true if nonempty hash value.
unsigned Value () const
unsigned & MutableValue ()
 Return mutable hash value. For internal use only.
ea::string ToString () const
 Return as string.
ea::string ToDebugString () const
 Return debug string that contains hash value, and reversed hash string if possible.
ea::string Reverse () const
unsigned ToHash () const
 Return hash value for HashSet & HashMap.

Static Public Member Functions

static unsigned Calculate (const char *str)
 Calculate hash value from a C string.
static unsigned Calculate (const void *data, unsigned length)
 Calculate hash value from binary data.
static StringHashRegisterGetGlobalStringHashRegister ()
 Get global StringHashRegister. Use for debug purposes only. Return nullptr if URHO3D_HASH_DEBUG is off.

Static Public Attributes

static const StringHash Empty {""}
 Hash of empty string. Is not zero!

Private Attributes

unsigned value_
 Hash value.

Detailed Description

32-bit hash value for a string.

Member Function Documentation

◆ Reverse()

ea::string Urho3D::StringHash::Reverse ( ) const

Return string which has specific hash value. Return first string if many (in order of calculation). Use for debug purposes only. Return empty string if URHO3D_HASH_DEBUG is off.

◆ Value()

unsigned Urho3D::StringHash::Value ( ) const

Return hash value.

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