aboutsummaryrefslogtreecommitdiff
path: root/src/feature.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-13 15:14:34 -0400
committerYour Name <you@example.com>2021-04-13 15:14:34 -0400
commit2ab51e507d620c4479e07ca0ec47d22c8c66bc90 (patch)
tree90906ecb043c01034280c767b83a88eb6df6956f /src/feature.cc
downloaddmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.gz
dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.bz2
dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.zip
Initial commit
Diffstat (limited to 'src/feature.cc')
-rw-r--r--src/feature.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/feature.cc b/src/feature.cc
new file mode 100644
index 0000000..352850b
--- /dev/null
+++ b/src/feature.cc
@@ -0,0 +1,38 @@
+#include "json.hpp"
+#include "feature.h"
+#include "creature.h"
+#include <sstream>
+#include <map>
+
+using namespace std;
+typedef nlohmann::json json;
+
+namespace feature {
+ shared_ptr<Feature> Feature::create(const json& data) {
+ return shared_ptr<Feature>(new Feature(data));
+ }
+
+ Feature::Feature(const json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {}
+
+ Feature::~Feature() {}
+
+ string Feature::getName() const {
+ return name;
+ }
+
+ string Feature::getType() const {
+ return type;
+ }
+
+ string Feature::getText() const {
+ return text;
+ }
+
+ json Feature::toJson() const {
+ return json({
+ {"name", name},
+ {"type", type},
+ {"text", text}
+ });
+ }
+}