diff options
Diffstat (limited to 'src/feature.cc')
-rw-r--r-- | src/feature.cc | 38 |
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} + }); + } +} |