MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / DictionaryKey

Class DictionaryKey

LuaSTGPlus/Dictionary.hpp:59–118  ·  view source on GitHub ↗

@brief �ֵ��

Source from the content-addressed store, hash-verified

57
58 /// @brief �ֵ��
59 struct DictionaryKey
60 {
61 uint32_t HashKey;
62 uint32_t Hash1, Hash2;
63#ifdef LDEBUG
64 std::string Key;
65#endif
66
67 bool operator==(const DictionaryKey& right)const
68 {
69#ifdef LDEBUG
70 if (HashKey == right.HashKey && Hash1 == right.Hash1 &&
71 Hash2 == right.Hash2)
72 {
73 LASSERT(Key == right.Key);
74 return true;
75 }
76 LASSERT(Key != right.Key);
77 return false;
78#else
79 return (HashKey == right.HashKey && Hash1 == right.Hash1 &&
80 Hash2 == right.Hash2);
81#endif
82 }
83
84 DictionaryKey()
85 : HashKey(0), Hash1(0), Hash2(0) {}
86 DictionaryKey(fcStr KeyStr)
87 {
88 HashKey = MPQHash<0>(KeyStr);
89 Hash1 = MPQHash<1>(KeyStr);
90 Hash2 = MPQHash<2>(KeyStr);
91#ifdef LDEBUG
92 Key = KeyStr;
93#endif
94 }
95 explicit DictionaryKey(const std::string& KeyStr)
96 {
97 HashKey = MPQHash<0>(KeyStr.c_str());
98 Hash1 = MPQHash<1>(KeyStr.c_str());
99 Hash2 = MPQHash<2>(KeyStr.c_str());
100#ifdef LDEBUG
101 Key = KeyStr;
102#endif
103 }
104 DictionaryKey(const DictionaryKey& org)
105 : HashKey(org.HashKey), Hash1(org.Hash1), Hash2(org.Hash2)
106 {
107#ifdef LDEBUG
108 Key = org.Key;
109#endif
110 }
111 DictionaryKey(DictionaryKey&& org)
112 : HashKey(org.HashKey), Hash1(org.Hash1), Hash2(org.Hash2)
113 {
114#ifdef LDEBUG
115 Key = std::move(org.Key);
116#endif

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected