mirror of https://github.com/zeldaret/botw.git
ksys/util: Add StrTreeMapKey(const SafeString&) for convenience
This commit is contained in:
parent
cb1b70bb03
commit
cdf27ca63c
|
@ -10,12 +10,12 @@ class StrTreeMapKey {
|
||||||
public:
|
public:
|
||||||
StrTreeMapKey() = default;
|
StrTreeMapKey() = default;
|
||||||
StrTreeMapKey(u32 key_hash, const sead::SafeString& key) : mKeyHash(key_hash), mKey(key) {}
|
StrTreeMapKey(u32 key_hash, const sead::SafeString& key) : mKeyHash(key_hash), mKey(key) {}
|
||||||
|
explicit StrTreeMapKey(const sead::SafeString& key)
|
||||||
|
: StrTreeMapKey(sead::HashCRC32::calcStringHash(key.cstr()), key) {}
|
||||||
|
|
||||||
const sead::SafeString& key() const { return mKey; }
|
const sead::SafeString& key() const { return mKey; }
|
||||||
|
|
||||||
void setKey(const sead::SafeString& key) {
|
void setKey(const sead::SafeString& key) { *this = StrTreeMapKey{key}; }
|
||||||
*this = {sead::HashCRC32::calcStringHash(key.cstr()), key};
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 compare(const StrTreeMapKey& rhs) const {
|
s32 compare(const StrTreeMapKey& rhs) const {
|
||||||
if (mKeyHash < rhs.mKeyHash)
|
if (mKeyHash < rhs.mKeyHash)
|
||||||
|
|
Loading…
Reference in New Issue