bool OctreePacketData::appendValue(const QByteArray& bytes) { // TODO: make this a ByteCountCoded leading byte uint16_t length = bytes.size(); bool success = appendValue(length); if (success) { success = appendRawData((const unsigned char*)bytes.constData(), bytes.size()); } return success; }
bool OctreePacketData::appendValue(const QString& string) { // TODO: make this a ByteCountCoded leading byte uint16_t length = string.size() + 1; // include NULL bool success = appendValue(length); if (success) { success = appendRawData((const unsigned char*)qPrintable(string), length); } return success; }
bool OctreePacketData::appendValue(const QUuid& uuid) { QByteArray bytes = uuid.toRfc4122(); if (uuid.isNull()) { return appendValue((uint16_t)0); // zero length for null uuid } else { uint16_t length = bytes.size(); bool success = appendValue(length); if (success) { success = appendRawData((const unsigned char*)bytes.constData(), bytes.size()); } return success; } }
bool OctreePacketData::appendRawData(QByteArray data) { return appendRawData((unsigned char *)data.data(), data.size()); }
bool OctreePacketData::appendValue(const QByteArray& bytes) { bool success = appendRawData((const unsigned char*)bytes.constData(), bytes.size()); return success; }