summaryrefslogtreecommitdiff
path: root/lyt/binaryfilesection.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2010-10-07 15:56:13 +0200
committerTreeki <treeki@gmail.com>2010-10-07 15:56:13 +0200
commit5f6dad55d75cbe146ff7fefc899a02ccd39078ba (patch)
tree0822df14cc6d2c0329810c9ae7b4a4a638fe82b1 /lyt/binaryfilesection.cpp
downloadLayoutStudio-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 'lyt/binaryfilesection.cpp')
-rw-r--r--lyt/binaryfilesection.cpp28
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();
+}