mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(hash): add hash templates
This commit is contained in:
parent
399e3f02d6
commit
ac1be572c4
7 changed files with 374 additions and 0 deletions
42
storm/hash/Hashkey.cpp
Normal file
42
storm/hash/Hashkey.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "storm/hash/Hashkey.hpp"
|
||||
#include "storm/Memory.hpp"
|
||||
#include "storm/String.hpp"
|
||||
|
||||
bool HASHKEY_NONE::operator==(const HASHKEY_NONE& key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HASHKEY_PTR::operator==(const HASHKEY_PTR& key) {
|
||||
return this->m_key == key.m_key;
|
||||
}
|
||||
|
||||
HASHKEY_STR::~HASHKEY_STR() {
|
||||
if (this->m_str) {
|
||||
SMemFree(this->m_str, __FILE__, __LINE__, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
HASHKEY_STR& HASHKEY_STR::operator=(const char* str) {
|
||||
if (this->m_str != str) {
|
||||
if (this->m_str) {
|
||||
SMemFree(this->m_str, __FILE__, __LINE__, 0x0);
|
||||
}
|
||||
|
||||
this->m_str = SStrDupA(str, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool HASHKEY_STR::operator==(const char* str) {
|
||||
return SStrCmp(this->m_str, str, STORM_MAX_STR) == 0;
|
||||
}
|
||||
|
||||
HASHKEY_STRI& HASHKEY_STRI::operator=(const char* str) {
|
||||
static_cast<HASHKEY_STR&>(*this) = str;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool HASHKEY_STRI::operator==(const char* str) {
|
||||
return SStrCmpI(this->m_str, str, STORM_MAX_STR) == 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue