Eile Mit Weile
Loading...
Searching...
No Matches
move_figure_request Class Reference

This class represents a move_figure_request from the client. More...

#include <move_figure_request.hpp>

Inheritance diagram for move_figure_request:
ClientRequest Serializable

Public Member Functions

 move_figure_request (std::string game_id, std::string player_id, unsigned figure_idx, unsigned space_id)
 
unsigned GetFigureId () const
 
unsigned GetSpaceId () const
 
void WriteIntoJson (rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override
 
- Public Member Functions inherited from ClientRequest
RequestType GetType () const
 
std::string GetReqId () const
 
std::string GetGameId () const
 
std::string GetPlayerId () const
 
- Public Member Functions inherited from Serializable
virtual rapidjson::DocumentToJson () const
 

Static Public Member Functions

static move_figure_requestFromJson (const rapidjson::Value &json)
 

Private Member Functions

 move_figure_request (BaseClassProperties, unsigned figure_idx, unsigned space_id)
 

Private Attributes

unsigned _figure_idx
 
unsigned _space_idx
 

Additional Inherited Members

- Static Public Attributes inherited from ClientRequest
static const std::unordered_map< std::string, RequestType_string_to_request_type
 
static const std::unordered_map< RequestType, std::string > _request_type_to_string
 
- Protected Member Functions inherited from ClientRequest
 ClientRequest (const BaseClassProperties &)
 
- Static Protected Member Functions inherited from ClientRequest
static BaseClassProperties CreateBaseClassProperties (RequestType type, std::string req_id, std::string &player_id, std::string &game_id)
 
static BaseClassProperties ExtractBaseClassProperties (const rapidjson::Value &json)
 
- Protected Attributes inherited from ClientRequest
RequestType _type
 
std::string _req_id
 
std::string _player_id
 
std::string _game_id
 

Detailed Description

This class represents a move_figure_request from the client.

most importatly it contains the figure id and the space id and defines a WriteIntoJson and FromJson method.

Constructor & Destructor Documentation

◆ move_figure_request() [1/2]

move_figure_request::move_figure_request ( std::string  game_id,
std::string  player_id,
unsigned  figure_idx,
unsigned  space_id 
)

public constructor for a move_figure_request with a player id, a figure id and a space id

◆ move_figure_request() [2/2]

move_figure_request::move_figure_request ( ClientRequest::BaseClassProperties  props,
unsigned  figure_idx,
unsigned  space_id 
)
private

private constructor for serialization.

Member Function Documentation

◆ FromJson()

move_figure_request * move_figure_request::FromJson ( const rapidjson::Value json)
static

creates a move_figure_request from a json object

◆ GetFigureId()

unsigned move_figure_request::GetFigureId ( ) const

getter for the figure id, see _figure_idx

◆ GetSpaceId()

unsigned move_figure_request::GetSpaceId ( ) const

getter for the space id, see _space_idx

◆ WriteIntoJson()

void move_figure_request::WriteIntoJson ( rapidjson::Value json,
rapidjson::Document::AllocatorType &  allocator 
) const
overridevirtual

writes the move_figure_request into a json object

Reimplemented from ClientRequest.

Member Data Documentation

◆ _figure_idx

unsigned move_figure_request::_figure_idx
private

Value from 0 to 3 denotes which figure of the current player is to be moved. if the id is 4, it communicates that no figure is movable.

◆ _space_idx

unsigned move_figure_request::_space_idx
private

Denotes the index of the space the figure is to be moved to. See Board for which index represents which space.


The documentation for this class was generated from the following files: