aboutsummaryrefslogtreecommitdiff
path: root/src/entry.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry.cc')
-rw-r--r--src/entry.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/entry.cc b/src/entry.cc
index 77cf144..663a40a 100644
--- a/src/entry.cc
+++ b/src/entry.cc
@@ -20,4 +20,31 @@ namespace entry {
}
throw std::invalid_argument("Invalid entry: " + std::string(data["entry"]));
}
+
+ struct entryImpl {
+ std::string entry;
+ std::string name;
+ std::string type;
+ std::string text;
+ };
+ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(entryImpl, entry, name, type, text);
+
+ NLOHMANN_FRIEND_DEFS_BASE(Entry, data);
+
+ Entry::Entry() : data(new entryImpl()) {}
+
+ Entry::Entry(const std::string& entry, const std::string& name, const std::string& type, const std::string& text) : data(new entryImpl()) {
+ data->entry = entry;
+ data->name = name;
+ data->type = type;
+ data->text = text;
+ }
+
+ std::string Entry::getName(void) const {return data->name;}
+ std::string Entry::getType(void) const {return data->type;}
+ std::string Entry::getText(void) const {return data->text;}
+ std::string Entry::getText(const creature::Creature& c) const {
+ return getName() + " (" + getType() + "): " + getText();
+ }
+ void Entry::setText(const std::string& t) {data->text = t;}
}