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.
std::size_t GetDataSize () const
 Get the size of the data contained in the packet.
bool EndOfPacket () const
 Tell if the reading position has reached the end of the packet.
 operator bool () const
 Return the validity of packet.
Packetoperator>> (bool &data)
 Operator >> overloads to extract data from the packet.
Packetoperator>> (Int8 &data)
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>> (String &data)
Packetoperator<< (bool data)
 Operator << overloads to put data into the packet.
Packetoperator<< (Int8 data)
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)
Packetoperator<< (const String &data)

Friends

class SocketTCP
class SocketUDP

Detailed Description

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

Definition at line 43 of file Packet.hpp.


Constructor & Destructor Documentation

sf::Packet::Packet (  ) 

Default constructor.

Definition at line 39 of file Packet.cpp.

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

Virtual destructor.

Definition at line 50 of file Packet.cpp.


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

Definition at line 59 of file Packet.cpp.

void sf::Packet::Clear (  ) 

Clear the packet data.

Definition at line 73 of file Packet.cpp.

bool sf::Packet::EndOfPacket (  )  const

Tell if the reading position has reached the end of the packet.

Returns:
True if all data have been read into the packet

Definition at line 104 of file Packet.cpp.

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

Definition at line 86 of file Packet.cpp.

std::size_t sf::Packet::GetDataSize (  )  const

Get the size of the data contained in the packet.

Returns:
Data size, in bytes

Definition at line 95 of file Packet.cpp.

sf::Packet::operator bool (  )  const

Return the validity of packet.

Tell if the packet is valid for reading.

Returns:
True if last data extraction from packet was successful

Definition at line 113 of file Packet.cpp.

Packet & sf::Packet::operator<< ( bool  data  ) 

Operator << overloads to put data into the packet.

Definition at line 311 of file Packet.cpp.

Packet & sf::Packet::operator>> ( bool &  data  ) 

Operator >> overloads to extract data from the packet.

Definition at line 122 of file Packet.cpp.


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