-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStlHelper.cpp
More file actions
88 lines (75 loc) · 3.01 KB
/
StlHelper.cpp
File metadata and controls
88 lines (75 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "Base.h"
#include "StlHelper.h"
#include "CityHash.h"
NS_BEGIN
//#################################################################################################
uint64_t CStr8HashTraits::operator()(const CStr8 &str) const
{
return CityHash64((PCBYTE)(PCSTR)str, str.GetSize());
}
//#################################################################################################
uint64_t CStrWHashTraits::operator()(const CStrW &str) const
{
return CityHash64((PCBYTE)(PCWSTR)str, str.GetSize());
}
//#################################################################################################
uint64_t CStr8IgnoreCaseTraits::operator()(const CStr8 &str) const
{
CStr8 strLower(str);
strLower.MakeLower();
return CityHash64((PCBYTE)(PCSTR)strLower, strLower.GetSize());
}
//#################################################################################################
bool CStr8IgnoreCaseTraits::operator()(const CStr8 &str1, const CStr8 &str2) const
{
return (str1.Compare(str2, true) == 0);
}
//#################################################################################################
uint64_t CStrWIgnoreCaseTraits::operator()(const CStrW &str) const
{
CStrW strLower(str);
strLower.MakeLower();
return CityHash64((PCBYTE)(PCWSTR)strLower, strLower.GetSize());
}
//#################################################################################################
bool CStrWIgnoreCaseTraits::operator()(const CStrW &str1, const CStrW &str2) const
{
return (str1.Compare(str2, true) == 0);
}
//#################################################################################################
uint64_t CFilePathSegment8HashTraits::operator()(const CFilePathSegment8 &path) const
{
CStr8 strPath(path);
strPath.MakeLower();
return CityHash64((PCBYTE)(PCSTR)strPath, strPath.GetSize());
}
//#################################################################################################
uint64_t CFilePathSegmentWHashTraits::operator()(const CFilePathSegmentW &path) const
{
CStrW strPath(path);
strPath.MakeLower();
return CityHash64((PCBYTE)(PCWSTR)strPath, strPath.GetSize());
}
//#################################################################################################
uint64_t CFilePath8HashTraits::operator()(const CFilePath8 &path) const
{
CStr8 strPath(path);
strPath.MakeLower();
return CityHash64((PCBYTE)(PCSTR)strPath, strPath.GetSize());
}
//#################################################################################################
uint64_t CFilePathWHashTraits::operator()(const CFilePathW &path) const
{
CStrW strPath(path);
strPath.MakeLower();
return CityHash64((PCBYTE)(PCWSTR)strPath, strPath.GetSize());
}
#ifdef _WIN32
//#################################################################################################
uint64_t CUuidHashTraits::operator()(const uuid_t &id) const
{
CStr strId = UuidToString(id);
return CityHash64((PCBYTE)(PCNSTR)strId, strId.GetSize());
}
#endif
NS_END