39 lines
1.5 KiB
C++
39 lines
1.5 KiB
C++
#ifndef PKMNLIB_SPECIESLIBRARY_HPP
|
|
#define PKMNLIB_SPECIESLIBRARY_HPP
|
|
|
|
#include <CreatureLib/Library/SpeciesLibrary.hpp>
|
|
#include "PokemonSpecies.hpp"
|
|
|
|
namespace PkmnLib::Library {
|
|
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary {
|
|
ArbUt::Dictionary<ArbUt::BorrowedPtr<const PokemonSpecies>, ArbUt::BorrowedPtr<const PokemonSpecies>>
|
|
_preEvolutionCache;
|
|
|
|
public:
|
|
inline bool TryGet(const ArbUt::BasicStringView& name,
|
|
ArbUt::BorrowedPtr<const PokemonSpecies>& outSpecies) const {
|
|
auto v = outSpecies.As<const PokemonSpecies::CreatureSpecies>();
|
|
auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name, v);
|
|
outSpecies = v.As<const PokemonSpecies>();
|
|
return res;
|
|
}
|
|
|
|
inline ArbUt::BorrowedPtr<const PokemonSpecies> Get(const ArbUt::BasicStringView& name) const {
|
|
return CreatureLib::Library::SpeciesLibrary::Get(name).As<const PokemonSpecies>();
|
|
}
|
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::BasicStringView& name) const {
|
|
return Get(name);
|
|
}
|
|
|
|
void Insert(const ArbUt::StringView& name, const PokemonSpecies* species) {
|
|
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
|
|
}
|
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies>
|
|
FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept;
|
|
};
|
|
}
|
|
|
|
#endif // PKMNLIB_SPECIESLIBRARY_HPP
|