--- /dev/null
+#include "command.hpp"\r
+\r
+namespace openxc\r
+{\r
+ std::string command::name() const\r
+ {\r
+ return name_;\r
+ }\r
+ \r
+ bool command::enabled() const\r
+ {\r
+ return enabled_;\r
+ }\r
+ \r
+ std::string command::handler() const\r
+ {\r
+ return handler_;\r
+ }\r
+ \r
+ void command::from_json(const nlohmann::json& j)\r
+ {\r
+ name_ = j.count("name") ? j["name"].get<std::string>() : "";\r
+ enabled_ = j.count("enabled") ? j["enabled"].get<bool>() : true;\r
+ handler_ = j.count("handler") ? j["handler"].get<std::string>() : "";\r
+ }\r
+\r
+ nlohmann::json command::to_json() const\r
+ {\r
+ nlohmann::json j;\r
+ j["name"] = name_;\r
+ j["enabled"] = enabled_;\r
+ j["handler"] = handler_;\r
+ return j;\r
+ }\r
+\r
+ void to_json(nlohmann::json& j, const command& p)\r
+ {\r
+ j = p.to_json();\r
+ }\r
+\r
+ void from_json(const nlohmann::json& j, command& p)\r
+ {\r
+ p.from_json(j);\r
+ }\r
+}\r