-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeData.cpp
More file actions
executable file
·44 lines (36 loc) · 971 Bytes
/
TreeData.cpp
File metadata and controls
executable file
·44 lines (36 loc) · 971 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "TreeData.h"
TreeData::TreeData(QString title, Axis axis, Layout layout, QRect bounds, HWND hwnd):
title(title),
axis(axis),
layout(layout),
bounds(bounds),
hwnd(hwnd)
{
}
QDataStream &operator<<(QDataStream &out, const TreeData &treeData)
{
out << treeData.title << quint32(treeData.axis) << quint32(treeData.layout) << treeData.bounds << quint64(treeData.hwnd) << quint8(treeData.children.length());
for(int i = 0; i < treeData.children.length(); ++i)
{
out << treeData.children.at(i);
}
return out;
}
QDataStream &operator>>(QDataStream &in, TreeData &treeData)
{
QString title;
quint32 axis;
quint32 layout;
QRect bounds;
quint64 hwnd;
qint8 childCount;
in >> title >> axis >> layout >> bounds >> hwnd >> childCount;
treeData = TreeData(title, (Axis)axis, (Layout)layout, bounds, (HWND)hwnd);
for(int i = 0; i < childCount; ++i)
{
TreeData treeChild;
in >> treeChild;
treeData.children.append(treeChild);
}
return in;
}