ksys/util: Add StrTreeMapKey(const SafeString&) for convenience

This commit is contained in:
Léo Lam 2020-09-26 15:47:58 +02:00
parent cb1b70bb03
commit cdf27ca63c
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 3 additions and 3 deletions

View File

@ -10,12 +10,12 @@ class StrTreeMapKey {
public:
StrTreeMapKey() = default;
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; }
void setKey(const sead::SafeString& key) {
*this = {sead::HashCRC32::calcStringHash(key.cstr()), key};
}
void setKey(const sead::SafeString& key) { *this = StrTreeMapKey{key}; }
s32 compare(const StrTreeMapKey& rhs) const {
if (mKeyHash < rhs.mKeyHash)