diff options
author | Your Name <you@example.com> | 2021-04-15 15:23:23 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-04-15 15:23:23 -0400 |
commit | dfce4d0398a8bafbb7ad7a31345af181c0269c09 (patch) | |
tree | 695162ff8cc25e146f52d9e26fe19ffa9934b3d6 /src/feature.h | |
parent | 9034c3d2533177f7cb7a7ce939ec53f7fa63f60e (diff) | |
download | dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.gz dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.bz2 dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.zip |
Added spells
Diffstat (limited to 'src/feature.h')
-rw-r--r-- | src/feature.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/feature.h b/src/feature.h index c433f32..01802bf 100644 --- a/src/feature.h +++ b/src/feature.h @@ -8,16 +8,22 @@ namespace feature { public: static std::shared_ptr<Feature> create(const nlohmann::json& data); - virtual ~Feature(); + virtual ~Feature() {} - std::string getName(void) const; - std::string getType(void) const; - std::string getText(void) const; + std::string getName(void) const {return name;} + std::string getType(void) const {return type;} + virtual std::string getText(void) const {return text;} - virtual nlohmann::json toJson(void) const; + virtual nlohmann::json toJson(void) const { + return nlohmann::json({ + {"name", name}, + {"type", type}, + {"text", text} + }); + } protected: - Feature(const nlohmann::json& data); + Feature(const nlohmann::json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {}; private: const std::string name; |