Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
sessioninfo.h
1#ifndef CAVOKE_SESSIONINFO_H
2#define CAVOKE_SESSIONINFO_H
3
4#include <QtCore/QJsonArray>
5#include <QtCore/QJsonObject>
6#include <QtCore/QString>
7#include <QtCore/QVector>
8#include "player.h"
9struct SessionInfo {
10 enum class Status { NOT_STARTED, RUNNING, FINISHED };
11
12public:
14 SessionInfo(QString _session_id,
15 QString _game_id,
16 SessionInfo::Status _status,
17 QString _host_id,
18 QVector<Player> _players);
19
20 void read(const QJsonObject &json);
21 void write(QJsonObject &json) const;
22
23 QString session_id;
24 QString game_id;
25 SessionInfo::Status status = Status::FINISHED;
26 QString host_id;
27 QVector<Player> players;
28 bool isHost = false;
29
30private:
31 static inline const QString SESSION_ID = "session_id";
32 static inline const QString GAME_ID = "game_id";
33 static inline const QString STATUS = "status";
34 static inline const QString HOST_ID = "host_id";
35 static inline const QString PLAYERS = "players";
36};
37
38#endif // CAVOKE_SESSIONINFO_H