#pragma once #include "json.hpp" #include "jsonable.h" #include namespace feature { class Feature : public Jsonable { public: static std::shared_ptr create(const nlohmann::json& data); virtual ~Feature() {} 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 { return nlohmann::json({ {"name", name}, {"type", type}, {"text", text} }); } protected: Feature(const nlohmann::json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {}; private: const std::string name; const std::string type; const std::string text; }; }