| 1 | #include "mtx/identifiers.hpp" |
|---|---|
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | |
| 5 | namespace mtx { |
| 6 | namespace identifiers { |
| 7 | |
| 8 | void |
| 9 | from_json(const nlohmann::json &obj, User &user) |
| 10 | { |
| 11 | user = parse<User>(id: obj.get<std::string>()); |
| 12 | } |
| 13 | |
| 14 | void |
| 15 | to_json(nlohmann::json &obj, const User &user) |
| 16 | { |
| 17 | obj = user.to_string(); |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | from_json(const nlohmann::json &obj, Room &room) |
| 22 | |
| 23 | { |
| 24 | room = parse<Room>(id: obj.get<std::string>()); |
| 25 | } |
| 26 | |
| 27 | void |
| 28 | to_json(nlohmann::json &obj, const Room &room) |
| 29 | { |
| 30 | obj = room.to_string(); |
| 31 | } |
| 32 | |
| 33 | void |
| 34 | from_json(const nlohmann::json &obj, Event &event) |
| 35 | { |
| 36 | event = parse<Event>(id: obj.get<std::string>()); |
| 37 | } |
| 38 | |
| 39 | void |
| 40 | to_json(nlohmann::json &obj, const Event &event) |
| 41 | { |
| 42 | obj = event.to_string(); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 |