25 #ifndef SFML_PACKET_HPP 26 #define SFML_PACKET_HPP 31 #include <SFML/Network/Export.hpp> 50 typedef bool (
Packet::*BoolType)(std::size_t);
77 void append(
const void* data, std::size_t sizeInBytes);
102 const void* getData()
const;
115 std::size_t getDataSize()
const;
129 bool endOfPacket()
const;
171 operator BoolType()
const;
177 Packet& operator >>(
bool& data);
182 Packet& operator >>(Int8& data);
187 Packet& operator >>(Uint8& data);
192 Packet& operator >>(Int16& data);
197 Packet& operator >>(Uint16& data);
202 Packet& operator >>(Int32& data);
207 Packet& operator >>(Uint32& data);
212 Packet& operator >>(Int64& data);
217 Packet& operator >>(Uint64& data);
222 Packet& operator >>(
float& data);
227 Packet& operator >>(
double& data);
232 Packet& operator >>(
char* data);
237 Packet& operator >>(std::string& data);
242 Packet& operator >>(
wchar_t* data);
247 Packet& operator >>(std::wstring& data);
258 Packet& operator <<(
bool data);
263 Packet& operator <<(Int8 data);
268 Packet& operator <<(Uint8 data);
273 Packet& operator <<(Int16 data);
278 Packet& operator <<(Uint16 data);
283 Packet& operator <<(Int32 data);
288 Packet& operator <<(Uint32 data);
293 Packet& operator <<(Int64 data);
298 Packet& operator <<(Uint64 data);
303 Packet& operator <<(
float data);
308 Packet& operator <<(
double data);
313 Packet& operator <<(
const char* data);
318 Packet& operator <<(
const std::string& data);
323 Packet& operator <<(
const wchar_t* data);
328 Packet& operator <<(
const std::wstring& data);
358 virtual const void* onSend(std::size_t& size);
377 virtual void onReceive(
const void* data, std::size_t size);
385 bool operator ==(
const Packet& right)
const;
386 bool operator !=(
const Packet& right)
const;
398 bool checkSize(std::size_t size);
403 std::vector<char> m_data;
404 std::size_t m_readPos;
405 std::size_t m_sendPos;
412 #endif // SFML_PACKET_HPP Specialized socket using the UDP protocol.
Utility class to build blocks of data to transfer over the network.
Specialized socket using the TCP protocol.
Utility string class that automatically handles conversions between types and encodings.