Mana
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ManaServ::Connection Class Reference

#include <connection.h>

Public Types

enum  State { OK , NET_ERROR }
 

Public Member Functions

 ~Connection ()
 
bool connect (const std::string &address, enet_uint16 port)
 Connects to the given server with the specified address and port.
 
void disconnect ()
 Disconnects from the given server.
 
State getState ()
 
bool isConnected ()
 Returns whether the server is connected.
 
void send (const ManaServ::MessageOut &msg)
 Sends a message.
 

Private Member Functions

 Connection (ENetHost *client)
 

Private Attributes

short mPort = 0
 
ENetPeer * mConnection = nullptr
 
ENetHost * mClient
 
State mState = OK
 

Friends

ConnectionManaServ::getConnection ()
 

Detailed Description

Definition at line 34 of file connection.h.

Member Enumeration Documentation

◆ State

Enumerator
OK 
NET_ERROR 

Definition at line 37 of file connection.h.

Constructor & Destructor Documentation

◆ ~Connection()

ManaServ::Connection::~Connection ( )

Definition at line 40 of file connection.cpp.

◆ Connection()

ManaServ::Connection::Connection ( ENetHost *  client)
private

Definition at line 34 of file connection.cpp.

Member Function Documentation

◆ connect()

bool ManaServ::Connection::connect ( const std::string &  address,
enet_uint16  port 
)

Connects to the given server with the specified address and port.

This method is non-blocking, use isConnected to check whether the server is connected.

Definition at line 45 of file connection.cpp.

◆ disconnect()

void ManaServ::Connection::disconnect ( )

Disconnects from the given server.

Definition at line 78 of file connection.cpp.

◆ getState()

State ManaServ::Connection::getState ( )
inline

Definition at line 56 of file connection.h.

◆ isConnected()

bool ManaServ::Connection::isConnected ( )

Returns whether the server is connected.

Definition at line 90 of file connection.cpp.

◆ send()

void ManaServ::Connection::send ( const ManaServ::MessageOut msg)

Sends a message.

Definition at line 95 of file connection.cpp.

Friends And Related Symbol Documentation

◆ ManaServ::getConnection

Member Data Documentation

◆ mClient

ENetHost* ManaServ::Connection::mClient
private

Definition at line 74 of file connection.h.

◆ mConnection

ENetPeer* ManaServ::Connection::mConnection = nullptr
private

Definition at line 73 of file connection.h.

◆ mPort

short ManaServ::Connection::mPort = 0
private

Definition at line 72 of file connection.h.

◆ mState

State ManaServ::Connection::mState = OK
private

Definition at line 75 of file connection.h.


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