Rebel Fork Framework
Urho3D::StringHash Class Reference

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

#include <Urho3D/Math/StringHash.h>

Classes

struct  NoReverse
 Tag to disable population of hash reversal map. More...
 

Public Member Functions

constexpr StringHash () noexcept
 Construct with zero value.
 
constexpr StringHash (unsigned value) noexcept
 Construct with an initial value.
 
constexpr StringHash (const char *str, NoReverse) noexcept
 Construct from a C string (no side effects).
 
 StringHash (const ea::string &str, NoReverse) noexcept
 Construct from a string (no side effects).
 
constexpr StringHash (const ea::string_view &str, NoReverse) noexcept
 Construct from a string (no side effects).
 
 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.
 
constexpr bool operator== (const StringHash &rhs) const
 Test for equality with another hash.
 
constexpr bool operator!= (const StringHash &rhs) const
 Test for inequality with another hash.
 
constexpr bool operator< (const StringHash &rhs) const
 Test if less than another hash.
 
constexpr bool operator> (const StringHash &rhs) const
 Test if greater than another hash.
 
constexpr bool IsEmpty () const
 Return true if nonempty hash value.
 
constexpr operator bool () const
 Return true if nonempty hash value.
 
constexpr unsigned Value () const
 
constexpr 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
 
constexpr unsigned ToHash () const
 Return hash value for HashSet & HashMap.
 

Static Public Member Functions

static constexpr unsigned Calculate (const ea::string_view &view)
 Calculate hash value for string_view.
 
static constexpr unsigned Calculate (const char *str)
 Calculate hash value from a C string.
 
static constexpr unsigned Calculate (const char *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 constexpr auto EmptyValue = static_cast<unsigned>(Detail::CalculateEastlHash(ea::string_view{""}))
 Hash of empty string. Is not zero!
 
static const StringHash Empty {""}
 

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

constexpr unsigned Urho3D::StringHash::Value ( ) const
inlineconstexpr

Return hash value.


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