PkmnLib/src/Library/Species/SpeciesLibrary.hpp

33 lines
1.2 KiB
C++
Raw Normal View History

2019-12-29 14:29:52 +00:00
#ifndef PKMNLIB_SPECIESLIBRARY_HPP
#define PKMNLIB_SPECIESLIBRARY_HPP
#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-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) {
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
2019-12-29 14:29:52 +00:00
}
};
}
#endif // PKMNLIB_SPECIESLIBRARY_HPP