8#include "../config/NetworkConfig.hpp"
50 bool writeBytes(
const std::uint8_t *data, std::size_t size);
67 const std::vector<std::uint8_t> &
getData()
const;
76 bool canWrite(std::size_t size)
const;
77 std::vector<std::uint8_t> _buffer;
Growable buffer of big-endian values, capped at MAX_PAYLOAD_SIZE.
Definition PacketWriter.hpp:16
PacketWriter()
Creates an empty writer with the full capacity reserved.
Definition PacketWriter.cpp:6
bool writeUInt8(std::uint8_t value)
Appends one byte.
Definition PacketWriter.cpp:12
bool writeBytes(const std::uint8_t *data, std::size_t size)
Appends raw bytes.
Definition PacketWriter.cpp:40
void clear()
Discards every written byte.
Definition PacketWriter.cpp:63
const std::vector< std::uint8_t > & getData() const
Returns the written bytes.
Definition PacketWriter.cpp:55
std::size_t getSize() const
Returns the number of written bytes.
Definition PacketWriter.cpp:61
bool writeUInt16(std::uint16_t value)
Appends a 16-bit unsigned integer in big-endian order.
Definition PacketWriter.cpp:20
bool empty() const
Tells whether nothing has been written yet.
Definition PacketWriter.cpp:59
bool writeUInt32(std::uint32_t value)
Appends a 32-bit unsigned integer in big-endian order.
Definition PacketWriter.cpp:29