MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / buildTree

Function buildTree

tests/test_context_menu.cpp:10–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace rcx;
9
10static void buildTree(NodeTree& tree) {
11 tree.baseAddress = 0x1000;
12
13 Node root;
14 root.kind = NodeKind::Struct;
15 root.structTypeName = "Player";
16 root.name = "Player";
17 root.parentId = 0;
18 root.offset = 0;
19 int ri = tree.addNode(root);
20 uint64_t rootId = tree.nodes[ri].id;
21
22 auto field = [&](int off, NodeKind k, const char* name) {
23 Node n;
24 n.kind = k;
25 n.name = name;
26 n.parentId = rootId;
27 n.offset = off;
28 tree.addNode(n);
29 };
30
31 field(0, NodeKind::Int32, "health");
32 field(4, NodeKind::Int32, "armor");
33 field(8, NodeKind::Float, "speed");
34 field(12, NodeKind::Hex32, "flags");
35}
36
37static QByteArray makeBuffer() {
38 QByteArray data(128, '\0');

Callers 1

initMethod · 0.85

Calls 1

addNodeMethod · 0.45

Tested by

no test coverage detected