Add the baselibrary classes to the C Interface.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -23,7 +23,10 @@ namespace CreatureLib::Library {
|
||||
inline void Insert(const Arbutils::CaseInsensitiveConstString& key, const T* value) {
|
||||
_values.insert({key.GetHash(), value});
|
||||
}
|
||||
inline void Insert(uint32_t hashedKey, const T* value) { _values.insert({hashedKey, value}); }
|
||||
|
||||
inline void Delete(const Arbutils::CaseInsensitiveConstString& key) { _values.erase(key.GetHash()); }
|
||||
inline void Delete(uint32_t hashedKey) { _values.erase({hashedKey}); }
|
||||
|
||||
bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const T*& out) const {
|
||||
auto find = this->_values.find(name.GetHash());
|
||||
@@ -34,10 +37,23 @@ namespace CreatureLib::Library {
|
||||
out = find->second;
|
||||
return true;
|
||||
}
|
||||
bool TryGet(uint32_t hashedKey, const T*& out) const {
|
||||
auto find = this->_values.find(hashedKey);
|
||||
if (find == this->_values.end()) {
|
||||
out = nullptr;
|
||||
return false;
|
||||
}
|
||||
out = find->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline const T* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||
return _values.at(name.GetHash());
|
||||
}
|
||||
inline const T* Get(uint32_t hashedKey) const { return _values.at(hashedKey); }
|
||||
|
||||
inline const T* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
||||
inline const T* operator[](uint32_t hashedKey) const { return Get(hashedKey); }
|
||||
inline const std::unordered_map<uint32_t, const T*>& GetIterator() const { return _values; }
|
||||
|
||||
size_t GetCount() const { return _values.size(); }
|
||||
|
||||
Reference in New Issue
Block a user