aboutsummaryrefslogtreecommitdiff
path: root/src/spell.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-20 17:00:53 -0400
committerYour Name <you@example.com>2021-05-20 17:00:53 -0400
commitb27700a7e0b281ece3dea23060c17e0cae28715d (patch)
treeef13e98281dd0183c4fb1e32cdf371ea1f6c1794 /src/spell.cc
parentbe88609c825e18201f240415fe74a31c1a789484 (diff)
downloaddmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip
Reduced exposure of implementation details
Diffstat (limited to 'src/spell.cc')
-rw-r--r--src/spell.cc22
1 files changed, 22 insertions, 0 deletions
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<std::string> 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<std::string> 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;