diff options
Diffstat (limited to 'lyt/binaryfilesection.cpp')
-rw-r--r-- | lyt/binaryfilesection.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lyt/binaryfilesection.cpp b/lyt/binaryfilesection.cpp new file mode 100644 index 0000000..59dd9a1 --- /dev/null +++ b/lyt/binaryfilesection.cpp @@ -0,0 +1,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(); +} |