Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
serialize.hpp
Go to the documentation of this file.
1
11
12#ifndef ZOAPPSERIALIZE_H
13#define ZOAPPSERIALIZE_H
14
15#include <nlohmann/json.hpp>
16
17#include "model.hpp"
18
20NLOHMANN_JSON_SERIALIZE_ENUM(PieceTypeID, {
21 {PieceTypeID::EAGLE, "eagle"},
22 {PieceTypeID::ROOSTER, "rooster"},
23 {PieceTypeID::RAVEN, "raven"},
24 {PieceTypeID::STORMBIRD, "storm-bird"},
25 {PieceTypeID::SWALLOW, "swallow"},
26});
27
29NLOHMANN_JSON_SERIALIZE_ENUM(RoleID, {
30 {RoleID::BLACK, "black"},
31 {RoleID::WHITE, "white"},
32});
33
35NLOHMANN_JSON_SERIALIZE_ENUM(PlayerID, {
36 {PlayerID::PLAYER_A, "player-a"},
37 {PlayerID::PLAYER_B, "player-b"},
38});
39
41void from_json(const nlohmann::json& json, PieceIdentity& pieceIdentity);
43void to_json(nlohmann::json& json, const PieceIdentity& pieceIdentity);
44
46void from_json(const nlohmann::json& json, GameScoreData& gameScoreData);
48void to_json(nlohmann::json& json, const GameScoreData& gameScoreData);
49
51void from_json(const nlohmann::json& json, PlayerData& playerData);
53void to_json(nlohmann::json& json, const PlayerData& playerData);
54
55#endif
The class containing the interface to the data model for the whole game (Game of Ur).
PieceTypeID
Enum listing the different types of pieces present in the game.
Definition piece_type_id.hpp:22
PlayerID
The two players playing the game, as known to GameOfUrModel.
Definition model.hpp:40
RoleID
A value representing the various roles (or sets, if preferred) possible in this game.
Definition role_id.hpp:20
Data returned by GameOfUrModel when queried for scores.
Definition model.hpp:151
Data uniquely identifying a piece used in the game.
Definition piece.hpp:29
Data returned by GameOfUrModel when queried about a player.
Definition model.hpp:229