Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
GbxRemote Class Reference

Handles communication with the ManiaPlanet server. More...

#include <GbxRemote.h>

Public Member Functions

 ~GbxRemote ()
 
bool Init (int port)
 Initializes connection with the local server. More...
 
bool InitWithIp (std::string address, int port)
 Initializes connection with the server. More...
 
void Terminate ()
 Closes the connection with the server.
 
bool Query (GbxMessage query)
 Sends a GbxMessage to the server. More...
 
bool ReadCallBacks ()
 Read callbacks from the server. More...
 
void HandleCallBack (std::string data)
 Handles callbacks (de-XML-fies them). More...
 
std::vector< GbxCallBackGetCBResponses ()
 Returns the callbacks that have been received since last call.
 
void ResetCBResponses ()
 Resets list of current callbacks.
 
GbxResponseGetResponse ()
 Returns the response from the server.
 
GbxError GetCurrentError ()
 Returns the current server error. More...
 
int GetProtocol ()
 Returns the current version number of the server protocol (1 or 2).
 
std::string GetApiVersion ()
 Returns the set API version.
 

Private Attributes

bool connected = false
 Is the client connected with the server?
 
int protocol = 0
 Protocol version (0 = uninitialized, 1 or 2 = version).
 
std::string apiVersion
 Server API version.
 
TcpClient server
 Socket connection with the server.
 
GbxError currentError = GbxError()
 Current server error.
 
GbxResponsecurrentResponse = new GbxResponse
 Current server response.
 
std::vector< GbxCallBackcurrentCallBacks = std::vector<GbxCallBack>()
 List of currently received callbacks.
 

Detailed Description

Handles communication with the ManiaPlanet server.

Todo:
Make it possible to set an API version without upsetting TinyXML2.

Constructor & Destructor Documentation

GbxRemote::~GbxRemote ( )

Deletes and nullifies the currentError and currentResponse.

Member Function Documentation

GbxError GbxRemote::GetCurrentError ( )

Returns the current server error.

Returns empty GbxError when there currently is no error.

void GbxRemote::HandleCallBack ( std::string  data)

Handles callbacks (de-XML-fies them).

Parameters
dataRaw response from the server.
bool GbxRemote::Init ( int  port)

Initializes connection with the local server.

Parameters
portXML-RPC port of the server.
bool GbxRemote::InitWithIp ( std::string  address,
int  port 
)

Initializes connection with the server.

Parameters
addressAddress of the server.
portXML-RPC port of the server.
bool GbxRemote::Query ( GbxMessage  query)

Sends a GbxMessage to the server.

Returns whether the query was successfully sent.

Parameters
queryQuery to be send.
bool GbxRemote::ReadCallBacks ( )

Read callbacks from the server.

Returns whether it found a callback.


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