MCPcopy Create free account
hub / github.com/Illation/ETEngine / HashString

Class HashString

Engine/source/EtCore/Hashing/HashString.h:29–101  ·  view source on GitHub ↗

------------------------ HashString Utility hash that registers its name in a database for debugging purposes and is serialized / deserialized as an atomic type

Source from the content-addressed store, hash-verified

27// Utility hash that registers its name in a database for debugging purposes and is serialized / deserialized as an atomic type
28//
29class HashString final
30{
31 // definitions
32 //-------------
33 DECLARE_FORCED_LINKING()
34
35#if ET_HASH_STRING_ENABLED
36 static HashStringRegistry* const s_GlobalHashStringRegistry;
37#endif
38
39 static std::string s_LastStringResult;
40
41 // construct destruct
42 //--------------------
43public:
44 HashString() = default;
45 explicit HashString(T_Hash const val);
46#if ET_HASH_STRING_ENABLED
47 explicit HashString(char const* const source);
48#else
49 constexpr explicit HashString(char const* const source) : m_Hash(GetHash(source)) {}
50
51 template <unsigned int TCount>
52 constexpr explicit HashString(char const(&str)[TCount]) : m_Hash(detail::hash_gen(str, TCount)) {}
53#endif
54
55 HashString& operator=(T_Hash const val);
56 HashString& operator=(char const* const source);
57
58 // functionality
59 //----------------
60 void Reset() { m_Hash = 0u; }
61 void Set(T_Hash const val) { m_Hash = val; }
62 void Set(char const* const source);
63
64 // operators
65 //-----------
66 bool operator== (T_Hash const other) const { return (m_Hash == other); }
67 bool operator== (HashString const other) const { return (m_Hash == other.Get()); }
68
69 bool operator<= (T_Hash const other) const { return (m_Hash <= other); }
70 bool operator<= (HashString const other) const { return (m_Hash <= other.Get()); }
71
72 bool operator>= (T_Hash const other) const { return (m_Hash >= other); }
73 bool operator>= (HashString const other) const { return (m_Hash >= other.Get()); }
74
75 bool operator!= (T_Hash const other) const { return (m_Hash != other); }
76 bool operator!= (HashString const other) const { return (m_Hash != other.Get()); }
77
78 bool operator< (T_Hash const other) const { return (m_Hash < other); }
79 bool operator< (HashString const other) const { return (m_Hash < other.Get()); }
80
81 bool operator> (T_Hash const other) const { return (m_Hash > other); }
82 bool operator> (HashString const other) const { return (m_Hash > other.Get()); }
83
84 // accessors
85 //-----------
86 T_Hash Get() const { return m_Hash; }

Callers 15

OnInitMethod · 0.85
InitializeMethod · 0.85
SetSceneMethod · 0.85
HashString.cppFile · 0.85
LoadFromPackageMethod · 0.85
UnloadSceneMethod · 0.85
InitMethod · 0.85
GetIdMethod · 0.85
InitMethod · 0.85
InitializeMethod · 0.85
InitMethod · 0.85
LoadDataMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected