sf::Packet Class Reference

Packet wraps data to send / to receive through the network. More...

#include <Packet.hpp>

List of all members.


Public Member Functions

 Packet ()
 Default constructor.
virtual ~Packet ()
 Virtual destructor.
void Append (const void *Data, std::size_t SizeInBytes)
 Append data to the end of the packet.
void Clear ()
 Clear the packet data.
const char * GetData () const
 Get a pointer to the data contained in the packet Warning : the returned pointer may be invalid after you append data to the packet.
Uint32 GetDataSize () const
 Get the size of the data contained in the packet.
 operator bool () const
 Tell if the packet is valid for reading.
Packetoperator>> (Int8 &Data)
 Operator >> overloads to extract data from the packet.
Packetoperator>> (Uint8 &Data)
Packetoperator>> (Int16 &Data)
Packetoperator>> (Uint16 &Data)
Packetoperator>> (Int32 &Data)
Packetoperator>> (Uint32 &Data)
Packetoperator>> (float &Data)
Packetoperator>> (double &Data)
Packetoperator>> (char *Data)
Packetoperator>> (std::string &Data)
Packetoperator>> (wchar_t *Data)
Packetoperator>> (std::wstring &Data)
Packetoperator<< (Int8 Data)
 Operator << overloads to put data into the packet.
Packetoperator<< (Uint8 Data)
Packetoperator<< (Int16 Data)
Packetoperator<< (Uint16 Data)
Packetoperator<< (Int32 Data)
Packetoperator<< (Uint32 Data)
Packetoperator<< (float Data)
Packetoperator<< (double Data)
Packetoperator<< (const char *Data)
Packetoperator<< (const std::string &Data)
Packetoperator<< (const wchar_t *Data)
Packetoperator<< (const std::wstring &Data)

Friends

class SocketTCP
class SocketUDP

Detailed Description

Packet wraps data to send / to receive through the network.

Definition at line 41 of file Packet.hpp.


Constructor & Destructor Documentation

sf::Packet::Packet (  ) 

Default constructor.

virtual sf::Packet::~Packet (  )  [virtual]

Virtual destructor.


Member Function Documentation

void sf::Packet::Append ( const void *  Data,
std::size_t  SizeInBytes 
)

Append data to the end of the packet.

Parameters:
Data : Pointer to the bytes to append
SizeInBytes : Number of bytes to append

void sf::Packet::Clear (  ) 

Clear the packet data.

const char* sf::Packet::GetData (  )  const

Get a pointer to the data contained in the packet Warning : the returned pointer may be invalid after you append data to the packet.

Returns:
Pointer to the data

Uint32 sf::Packet::GetDataSize (  )  const

Get the size of the data contained in the packet.

Returns:
Data size, in bytes

sf::Packet::operator bool (  )  const

Tell if the packet is valid for reading.

Returns:
True if data can be extracted from the packet

Packet& sf::Packet::operator>> ( Int8 &  Data  ) 

Operator >> overloads to extract data from the packet.

Packet& sf::Packet::operator<< ( Int8  Data  ) 

Operator << overloads to put data into the packet.


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