2019-12-29 14:29:52 +00:00
|
|
|
#ifndef PKMNLIB_SPECIESLIBRARY_HPP
|
|
|
|
#define PKMNLIB_SPECIESLIBRARY_HPP
|
|
|
|
|
2020-02-08 18:22:29 +00:00
|
|
|
#include <CreatureLib/Library/SpeciesLibrary.hpp>
|
2019-12-29 14:29:52 +00:00
|
|
|
#include "PokemonSpecies.hpp"
|
|
|
|
|
|
|
|
namespace PkmnLib::Library {
|
|
|
|
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary {
|
|
|
|
public:
|
2020-07-04 13:50:30 +00:00
|
|
|
inline bool TryGet(const ArbUt::BasicStringView& name,
|
2020-05-27 15:26:25 +00:00
|
|
|
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;
|
2020-02-01 15:56:09 +00:00
|
|
|
}
|
|
|
|
|
2020-07-04 13:50:30 +00:00
|
|
|
inline ArbUt::BorrowedPtr<const PokemonSpecies> Get(const ArbUt::BasicStringView& name) const {
|
2020-05-27 15:26:25 +00:00
|
|
|
return CreatureLib::Library::SpeciesLibrary::Get(name).As<const PokemonSpecies>();
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
|
2020-07-04 13:50:30 +00:00
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::BasicStringView& name) const {
|
2020-05-27 15:26:25 +00:00
|
|
|
return Get(name);
|
|
|
|
}
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2020-07-04 13:50:30 +00:00
|
|
|
void Insert(const ArbUt::StringView& name, const PokemonSpecies* species) {
|
2020-02-15 18:04:06 +00:00
|
|
|
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_SPECIESLIBRARY_HPP
|