HashedString.h 570 B

12345678910111213141516171819202122232425262728
  1. #ifndef HASHEDSTRING_H
  2. #define HASHEDSTRING_H
  3. #include "common/utils/Types.h"
  4. class HashedString final {
  5. public:
  6. HashedString();
  7. HashedString(const char* str);
  8. bool operator==(const HashedString& other) const;
  9. bool operator!=(const HashedString& other) const;
  10. operator const char*() const;
  11. u32 hashCode() const;
  12. struct Hasher final {
  13. u32 operator()(const HashedString& key) const;
  14. };
  15. private:
  16. static constexpr uint LENGTH = 32 - sizeof (u8) - sizeof (u32);
  17. char data[LENGTH];
  18. u8 length;
  19. u32 hash;
  20. };
  21. #endif