#include "packetwriter.h" PacketWriter::PacketWriter(int reservedSize) { m_buffer.reserve(reservedSize); } void PacketWriter::writeU32(quint32 value) { writeBytes((const quint8 *)(&value), 4); } void PacketWriter::writeBytes(const quint8 *input, int size) { m_buffer.append((const char *)input, size); } void PacketWriter::writeString(const QString &string) { writeU32(string.length() * 2); writeBytes((const quint8 *)string.constData(), string.length() * 2); } /* inline void writeU32(quint8 *buf, quint32 value) { buf[0] = (value & 0xFF); buf[1] = ((value >> 8) & 0xFF); buf[2] = ((value >> 16) & 0xFF); buf[3] = ((value >> 24) & 0xFF); } */