mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 09:54:14 +02:00
add QByteArray data uppacking
This commit is contained in:
parent
d71921fd03
commit
ed6fdcfb31
2 changed files with 10 additions and 0 deletions
|
@ -573,3 +573,12 @@ int OctreePacketData::uppackDataFromBytes(const unsigned char* dataBytes, xColor
|
|||
result.blue = dataBytes[BLUE_INDEX];
|
||||
return sizeof(rgbColor);
|
||||
}
|
||||
|
||||
int OctreePacketData::uppackDataFromBytes(const unsigned char* dataBytes, QByteArray& result) {
|
||||
uint16_t length;
|
||||
memcpy(&length, dataBytes, sizeof(length));
|
||||
dataBytes += sizeof(length);
|
||||
QByteArray value((const char*)dataBytes, length);
|
||||
result = value;
|
||||
return sizeof(length) + length;
|
||||
}
|
||||
|
|
|
@ -240,6 +240,7 @@ public:
|
|||
static int uppackDataFromBytes(const unsigned char* dataBytes, QString& result);
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, QUuid& result);
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, xColor& result);
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, QByteArray& result);
|
||||
|
||||
private:
|
||||
/// appends raw bytes, might fail if byte would cause packet to be too large
|
||||
|
|
Loading…
Reference in a new issue