mcpp
C++ Minecraft Library
mcpp::SocketConnection Class Reference

#include <connection.h>

Public Member Functions

 SocketConnection (const std::string &address_str, uint16_t port)
 
void send (const std::string &dataString)
 
template<typename... Types>
void sendCommand (const std::string &prefix, const Types &... args)
 
template<typename T , typename... Types>
std::string sendReceiveCommand (const T &prefix, const Types &... args)
 
std::string recv () const
 

Constructor & Destructor Documentation

◆ SocketConnection()

mcpp::SocketConnection::SocketConnection ( const std::string &  address_str,
uint16_t  port 
)

Member Function Documentation

◆ recv()

std::string mcpp::SocketConnection::recv ( ) const

◆ send()

void mcpp::SocketConnection::send ( const std::string &  dataString)

◆ sendCommand()

template<typename... Types>
void mcpp::SocketConnection::sendCommand ( const std::string &  prefix,
const Types &...  args 
)
inline

Takes in parameters supporting std::stringstream conversion and a string prefix and transforms them into format "prefix(arg1,arg2,arg3)\n" e.g. "chat.post(test)\n)" and sends command to the server.

Template Parameters
Types
Parameters
prefix
args

◆ sendReceiveCommand()

template<typename T , typename... Types>
std::string mcpp::SocketConnection::sendReceiveCommand ( const T &  prefix,
const Types &...  args 
)
inline

Sends via sendCommand() and returns the result from endpoint

Template Parameters
T
Types
Parameters
prefix
args
Returns

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