Update to new Arbutils
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-26 17:08:23 +02:00
parent f50f76e993
commit 48639eeee5
44 changed files with 177 additions and 200 deletions

View File

@@ -4,9 +4,9 @@
#include <Arbutils/Assert.hpp>
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/ConstString.hpp>
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include <Arbutils/Random.hpp>
#include <Arbutils/StringView.hpp>
#include <algorithm>
#include <memory>
#include <string>
@@ -22,7 +22,7 @@ namespace CreatureLib::Library {
virtual ~BaseLibrary() noexcept { _values.Clear(); }
inline void Insert(const ArbUt::CaseInsensitiveConstString& key, const T* value) {
inline void Insert(const ArbUt::StringView& key, const T* value) {
AssertNotNull(value)
_values.GetStdMap().insert({key.GetHash(), std::unique_ptr<const T>(value)});
_listValues.Append(key);
@@ -33,7 +33,7 @@ namespace CreatureLib::Library {
_listValues.Append(hashedKey);
}
inline void Delete(const ArbUt::CaseInsensitiveConstString& key) noexcept {
inline void Delete(const ArbUt::StringView& key) noexcept {
_values.erase(key.GetHash());
auto k = _listValues.IndexOf(key);
_listValues.Remove(k);
@@ -44,7 +44,7 @@ namespace CreatureLib::Library {
_listValues.Remove(k);
}
bool TryGet(const ArbUt::CaseInsensitiveConstString& name, ArbUt::BorrowedPtr<const T>& out) const noexcept {
bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr<const T>& out) const noexcept {
return TryGet(name.GetHash(), out);
}
bool TryGet(uint32_t hashedKey, ArbUt::BorrowedPtr<const T>& out) const noexcept {
@@ -55,15 +55,14 @@ namespace CreatureLib::Library {
return true;
}
[[nodiscard]] inline ArbUt::BorrowedPtr<const T> Get(const ArbUt::CaseInsensitiveConstString& name) const {
[[nodiscard]] inline ArbUt::BorrowedPtr<const T> Get(const ArbUt::BasicStringView& name) const {
return _values.Get(name.GetHash());
}
[[nodiscard]] inline ArbUt::BorrowedPtr<const T> Get(uint32_t hashedKey) const {
return _values.Get(hashedKey);
}
[[nodiscard]] inline ArbUt::BorrowedPtr<const T>
operator[](const ArbUt::CaseInsensitiveConstString& name) const {
[[nodiscard]] inline ArbUt::BorrowedPtr<const T> operator[](const ArbUt::BasicStringView& name) const {
return Get(name);
}
[[nodiscard]] inline ArbUt::BorrowedPtr<const T> operator[](uint32_t hashedKey) const { return Get(hashedKey); }