This commit is contained in:
@@ -12,19 +12,28 @@ namespace PkmnLib::Library {
|
||||
public:
|
||||
SpeciesLibrary(size_t initialCapacity = 32) : CreatureLib::Library::SpeciesLibrary(initialCapacity) {}
|
||||
|
||||
inline std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>>
|
||||
TryGet(const ArbUt::BasicStringView& name) const {
|
||||
inline std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>> TryGet(const ArbUt::StringView& name) const {
|
||||
auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name);
|
||||
if (!res.has_value())
|
||||
return {};
|
||||
return res.value().ForceAs<const PokemonSpecies>();
|
||||
}
|
||||
|
||||
inline ArbUt::BorrowedPtr<const PokemonSpecies> Get(const ArbUt::BasicStringView& name) const {
|
||||
return CreatureLib::Library::SpeciesLibrary::Get(name).As<const PokemonSpecies>();
|
||||
inline std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>> TryGetByHash(u32 hashedKey) const {
|
||||
auto res = CreatureLib::Library::SpeciesLibrary::TryGetByHash(hashedKey);
|
||||
if (!res.has_value())
|
||||
return {};
|
||||
return res.value().ForceAs<const PokemonSpecies>();
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::BasicStringView& name) const {
|
||||
inline ArbUt::BorrowedPtr<const PokemonSpecies> Get(const ArbUt::StringView& name) const {
|
||||
return CreatureLib::Library::SpeciesLibrary::Get(name).As<const PokemonSpecies>();
|
||||
}
|
||||
inline ArbUt::BorrowedPtr<const PokemonSpecies> GetByHash(u32 hashedKey) const {
|
||||
return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As<const PokemonSpecies>();
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::StringView& name) const {
|
||||
return Get(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user