summaryrefslogtreecommitdiff
path: root/lyt/binaryfilesection.cpp
blob: 59dd9a16f89d5924da1c8145a5286c31964f35b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "binaryfilesection.h"

LYTBinaryFileSection::LYTBinaryFileSection() {
}


void LYTBinaryFileSection::writeToDataStream(QDataStream &out) {
	out << (quint32)magic.value;
	out << (quint32)data.length() + 8;
	out.writeRawData(data.constData(), data.length());
}

void LYTBinaryFileSection::readFromDataStream(QDataStream &in) {
	quint32 length;

	in >> (quint32&)magic.value;
	in >> (quint32&)length;

	char *raw = new char[length - 8];
	in.readRawData(raw, length - 8);

	data = QByteArray(raw, length - 8);
}


int LYTBinaryFileSection::writtenSize() {
	return 8 + this->data.length();
}