diff options
author | Treeki <treeki@gmail.com> | 2010-10-07 15:56:13 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2010-10-07 15:56:13 +0200 |
commit | 5f6dad55d75cbe146ff7fefc899a02ccd39078ba (patch) | |
tree | 0822df14cc6d2c0329810c9ae7b4a4a638fe82b1 /lyt/binaryfilesection.cpp | |
download | LayoutStudio-5f6dad55d75cbe146ff7fefc899a02ccd39078ba.tar.gz LayoutStudio-5f6dad55d75cbe146ff7fefc899a02ccd39078ba.zip |
initial commit -- everything compiles except for material.cpp. the material system still needs quite a bit of work; this will come in due time
Diffstat (limited to '')
-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(); +} |