22 #ifndef AGS_SHARED_UTIL_STRING_TYPES_H 23 #define AGS_SHARED_UTIL_STRING_TYPES_H 25 #include "common/std/map.h" 26 #include "common/std/vector.h" 27 #include "ags/shared/util/string.h" 28 #include "common/hash-str.h" 33 const uint32_t PRIME_NUMBER = 2166136261U;
34 const uint32_t SECONDARY_NUMBER = 16777619U;
36 inline size_t Hash(
const char *data,
const size_t len) {
37 uint32_t hash = PRIME_NUMBER;
38 for (
size_t i = 0; i < len; ++i)
39 hash = (SECONDARY_NUMBER * hash) ^ (uint8_t)(data[i]);
43 inline size_t Hash_LowerCase(
const char *data,
const size_t len) {
44 uint32_t hash = PRIME_NUMBER;
45 for (
size_t i = 0; i < len; ++i)
46 hash = (SECONDARY_NUMBER * hash) ^ (uint8_t)(tolower(data[i]));
56 bool operator()(const ::AGS3::AGS::Shared::String &x, const ::AGS3::AGS::Shared::String &y)
const {
57 return x.Compare(y) == 0;
62 uint operator()(const ::AGS3::AGS::Shared::String &x)
const {
63 return Common::hashit(x.GetCStr());
68 bool operator()(const ::AGS3::AGS::Shared::String &x, const ::AGS3::AGS::Shared::String &y)
const {
69 return x.CompareNoCase(y) == 0;
74 uint operator()(const ::AGS3::AGS::Shared::String &x)
const {
75 return Common::hashit_lower(x.GetCStr());
80 bool operator()(const ::AGS3::AGS::Shared::String &x, const ::AGS3::AGS::Shared::String &y)
const {
81 return x.CompareNoCase(y) < 0;
98 return Common::hashit(s.GetCStr());
Definition: achievements_tables.h:27
Definition: string_types.h:55
Definition: string_types.h:67
Definition: string_types.h:79
Definition: algorithm.h:29
Definition: string_types.h:61
Definition: string_types.h:73