sfPacket Class Reference

#include <Packet.hpp>

List of all members.

Public Member Functions

 sfPacket ()
 ~sfPacket ()
void Append (const void *Data, std::size_t SizeInBytes)
void Clear ()
const char * GetData () const
sfUint32 GetDataSize () const
sfPacketoperator>> (sfInt8 &Data)
sfPacketoperator>> (sfUint8 &Data)
sfPacketoperator>> (sfInt16 &Data)
sfPacketoperator>> (sfUint16 &Data)
sfPacketoperator>> (sfInt32 &Data)
sfPacketoperator>> (sfUint32 &Data)
sfPacketoperator>> (float &Data)
sfPacketoperator>> (double &Data)
sfPacketoperator>> (char *Data)
sfPacketoperator>> (std::string &Data)
sfPacketoperator<< (sfInt8 Data)
sfPacketoperator<< (sfUint8 Data)
sfPacketoperator<< (sfInt16 Data)
sfPacketoperator<< (sfUint16 Data)
sfPacketoperator<< (sfInt32 Data)
sfPacketoperator<< (sfUint32 Data)
sfPacketoperator<< (float Data)
sfPacketoperator<< (double Data)
sfPacketoperator<< (const char *Data)
sfPacketoperator<< (const std::string &Data)

Friends

class sfSocketTCP
class sfSocketUDP


Detailed Description

sfPacket wraps data to send / to receive through the network

Definition at line 39 of file Packet.hpp.


Constructor & Destructor Documentation

sfPacket::sfPacket (  ) 

Default constructor

Definition at line 35 of file Packet.cpp.

sfPacket::~sfPacket (  ) 

Virtual destructor

Definition at line 45 of file Packet.cpp.


Member Function Documentation

void sfPacket::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 54 of file Packet.cpp.

Referenced by operator<<(), sfSocketUDP::Receive(), and sfSocketTCP::Receive().

void sfPacket::Clear (  ) 

Clear the packet data

Definition at line 64 of file Packet.cpp.

Referenced by sfSocketUDP::Receive(), and sfSocketTCP::Receive().

const char * sfPacket::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 76 of file Packet.cpp.

Referenced by operator>>(), sfSocketUDP::Send(), and sfSocketTCP::Send().

sfUint32 sfPacket::GetDataSize (  )  const

Get the size of the data contained in the packet

Returns:
Data size, in bytes

Definition at line 85 of file Packet.cpp.

Referenced by sfSocketUDP::Receive(), sfSocketTCP::Receive(), sfSocketUDP::Send(), and sfSocketTCP::Send().

sfPacket & sfPacket::operator>> ( sfInt8 &  Data  ) 

Operator >> overloads to extract data from the packet

Definition at line 94 of file Packet.cpp.

References GetData().

sfPacket & sfPacket::operator<< ( sfInt8  Data  ) 

Operator << overloads to put data into the packet

Definition at line 176 of file Packet.cpp.

References Append().


The documentation for this class was generated from the following files:
Generated for SFML by  doxygen 1.5.2