#ifndef PKMNLIB_SPECIESLIBRARY_HPP #define PKMNLIB_SPECIESLIBRARY_HPP #include #include "PokemonSpecies.hpp" namespace PkmnLib::Library { class SpeciesLibrary final : public CreatureLib::Library::SpeciesLibrary { ArbUt::Dictionary, ArbUt::BorrowedPtr> _preEvolutionCache; public: SpeciesLibrary(size_t initialCapacity = 32) : CreatureLib::Library::SpeciesLibrary(initialCapacity) {} inline std::optional> TryGet(const ArbUt::StringView& name) const { auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name); if (!res.has_value()) return {}; return res.value().ForceAs(); } inline std::optional> TryGetByHash(u32 hashedKey) const { auto res = CreatureLib::Library::SpeciesLibrary::TryGetByHash(hashedKey); if (!res.has_value()) return {}; return res.value().ForceAs(); } inline ArbUt::BorrowedPtr Get(const ArbUt::StringView& name) const { return CreatureLib::Library::SpeciesLibrary::Get(name).As(); } inline ArbUt::BorrowedPtr GetByHash(u32 hashedKey) const { return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As(); } ArbUt::BorrowedPtr operator[](const ArbUt::StringView& name) const { return Get(name); } std::optional> FindPreEvolution(const ArbUt::BorrowedPtr& species) const noexcept; }; } #endif // PKMNLIB_SPECIESLIBRARY_HPP