| 1 | #include "mtx/events/topic.hpp" |
|---|---|
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | |
| 5 | using json = nlohmann::json; |
| 6 | |
| 7 | namespace mtx { |
| 8 | namespace events { |
| 9 | namespace state { |
| 10 | |
| 11 | void |
| 12 | from_json(const json &obj, Topic &event) |
| 13 | { |
| 14 | if (obj.find(key: "topic") != obj.end() && !obj.at(key: "topic").is_null()) |
| 15 | event.topic = obj.at(key: "topic").get<std::string>(); |
| 16 | } |
| 17 | |
| 18 | void |
| 19 | to_json(json &obj, const Topic &event) |
| 20 | { |
| 21 | obj["topic"] = event.topic; |
| 22 | } |
| 23 | |
| 24 | } // namespace state |
| 25 | } // namespace events |
| 26 | } // namespace mtx |
| 27 |