From b27700a7e0b281ece3dea23060c17e0cae28715d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 20 May 2021 17:00:53 -0400 Subject: Reduced exposure of implementation details --- src/spell.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/spell.cc') diff --git a/src/spell.cc b/src/spell.cc index 0294956..83ec9da 100644 --- a/src/spell.cc +++ b/src/spell.cc @@ -6,6 +6,28 @@ using namespace std; namespace entry { + struct spellImpl { + int level; + std::vector classes; + std::string casting_time; + std::string range; + std::string components; + std::string duration; + }; + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(spellImpl, level, classes, casting_time, range, components, duration); + + NLOHMANN_FRIEND_DEFS(Entry, Spell, data); + + Spell::Spell() : data(new spellImpl()) {} + + int Spell::getLevel(void) const {return data->level;} + std::string Spell::getSchool(void) const {return getType();} + std::vector Spell::getClasses(void) const {return data->classes;} + std::string Spell::getCastingTime(void) const {return data->casting_time;} + std::string Spell::getRange(void) const {return data->range;} + std::string Spell::getComponents(void) const {return data->components;} + std::string Spell::getDuration(void) const {return data->duration;} + string Spell::getText() const { stringstream text; text << utils::toOrdinal(getLevel()) << " level " << getSchool() << " spell." << endl; -- cgit v1.2.3