Elaztek Developer Hub
Blamite Game Engine - Strings  00456.10.01.26.0053.blamite
A library containing general purpose utilities and classes for use in multiple projects.
HashedString.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <stdint.h>
5 #include <assert.h>
6 
7 #ifdef STRINGS_EXPORTS
8 #define STRINGS_API __declspec(dllexport)
9 #else
10 #define STRINGS_API __declspec(dllimport)
11 #endif
12 
14 {
15 private:
16  uint32_t hash;
17 
18  uint32_t HashText(std::string_view text);
19  uint32_t HashTextSecondary(std::string_view view_text);
20 
21 public:
22  BlamHashedString(std::string_view text);
23  std::string GetText() const;
24  uint32_t GetHash() const;
25 
26  bool operator==(const BlamHashedString& other) const;
27  bool operator!=(const BlamHashedString& other) const;
28  bool operator<(const BlamHashedString& other) const;
29  bool operator<=(const BlamHashedString& other) const;
30  bool operator>(const BlamHashedString& other) const;
31  bool operator>=(const BlamHashedString& other) const;
32 };
33 
34 namespace std
35 {
36  template<>
37  struct hash<BlamHashedString>
38  {
48  size_t operator()(const BlamHashedString& id) const
49  {
50  return static_cast<size_t>(id.GetHash());
51  }
52  };
53 }
logger.h
BlamHashedString::operator!=
bool operator!=(const BlamHashedString &other) const
Definition: HashedString.cpp:83
BlamHashedString::BlamHashedString
BlamHashedString(std::string_view text)
Definition: HashedString.cpp:10
uuids::operator<
bool operator<(uuid const &lhs, uuid const &rhs) noexcept
Definition: uuid.h:573
known_hashes
std::unordered_map< uint32_t, std::string > known_hashes
Definition: HashedString.cpp:8
BlamHashedString::operator==
bool operator==(const BlamHashedString &other) const
Definition: HashedString.cpp:78
STRINGS_API
#define STRINGS_API
Definition: HashedString.h:10
BlamHashedString::operator<
bool operator<(const BlamHashedString &other) const
Definition: HashedString.cpp:88
BlamStrings::Logger::LogEvent
STRINGS_API void LogEvent(BlamBasicLogMessage message)
Logs an event to the logger.
Definition: logger.cpp:41
BlamHashedString::GetHash
uint32_t GetHash() const
Definition: HashedString.cpp:35
BlamHashedString::GetText
std::string GetText() const
Definition: HashedString.cpp:40
BlamHashedString::operator>
bool operator>(const BlamHashedString &other) const
Definition: HashedString.cpp:98
WSV_WARNING
#define WSV_WARNING
Macro for 'Warning' log seveirty.
Definition: logger.h:24
BlamHashedString::operator>=
bool operator>=(const BlamHashedString &other) const
Definition: HashedString.cpp:103
std::hash< BlamHashedString >::operator()
size_t operator()(const BlamHashedString &id) const
Produces a standard library-compatible hash of a BlamHashedString.
Definition: HashedString.h:48
uuids::operator!=
bool operator!=(uuid const &lhs, uuid const &rhs) noexcept
Definition: uuid.h:568
std
Definition: uuid.h:915
uuids::operator==
bool operator==(uuid const &lhs, uuid const &rhs) noexcept
Definition: uuid.h:563
BlamHashedString
Definition: HashedString.h:13
BlamHashedString::operator<=
bool operator<=(const BlamHashedString &other) const
Definition: HashedString.cpp:93
HashedString.h