diff options
Diffstat (limited to 'src/web_service/announce_room_json.h')
| -rw-r--r-- | src/web_service/announce_room_json.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/web_service/announce_room_json.h b/src/web_service/announce_room_json.h new file mode 100644 index 000000000..32c08858d --- /dev/null +++ b/src/web_service/announce_room_json.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <functional> | ||
| 7 | #include <string> | ||
| 8 | #include "common/announce_multiplayer_room.h" | ||
| 9 | #include "web_service/web_backend.h" | ||
| 10 | |||
| 11 | namespace WebService { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * Implementation of AnnounceMultiplayerRoom::Backend that (de)serializes room information into/from | ||
| 15 | * JSON, and submits/gets it to/from the yuzu web service | ||
| 16 | */ | ||
| 17 | class RoomJson : public AnnounceMultiplayerRoom::Backend { | ||
| 18 | public: | ||
| 19 | RoomJson(const std::string& host_, const std::string& username_, const std::string& token_) | ||
| 20 | : client(host_, username_, token_), host(host_), username(username_), token(token_) {} | ||
| 21 | ~RoomJson() = default; | ||
| 22 | void SetRoomInformation(const std::string& name, const std::string& description, const u16 port, | ||
| 23 | const u32 max_player, const u32 net_version, const bool has_password, | ||
| 24 | const AnnounceMultiplayerRoom::GameInfo& preferred_game) override; | ||
| 25 | void AddPlayer(const AnnounceMultiplayerRoom::Member& member) override; | ||
| 26 | WebResult Update() override; | ||
| 27 | WebResult Register() override; | ||
| 28 | void ClearPlayers() override; | ||
| 29 | AnnounceMultiplayerRoom::RoomList GetRoomList() override; | ||
| 30 | void Delete() override; | ||
| 31 | |||
| 32 | private: | ||
| 33 | AnnounceMultiplayerRoom::Room room; | ||
| 34 | Client client; | ||
| 35 | std::string host; | ||
| 36 | std::string username; | ||
| 37 | std::string token; | ||
| 38 | std::string room_id; | ||
| 39 | }; | ||
| 40 | |||
| 41 | } // namespace WebService | ||