-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcast_nested.cpp
130 lines (109 loc) · 3.67 KB
/
cast_nested.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
#include "cast_nested.h"
cast_nested_t::cast_nested_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, cast_nested_t* p__root) : kaitai::kstruct(p__io) {
m__parent = p__parent;
m__root = this;
m_opcodes = nullptr;
f_opcodes_0_str = false;
f_opcodes_0_str_value = false;
f_opcodes_1_int = false;
f_opcodes_1_int_value = false;
_read();
}
void cast_nested_t::_read() {
m_opcodes = std::unique_ptr<std::vector<std::unique_ptr<opcode_t>>>(new std::vector<std::unique_ptr<opcode_t>>());
{
int i = 0;
while (!m__io->is_eof()) {
m_opcodes->push_back(std::move(std::unique_ptr<opcode_t>(new opcode_t(m__io, this, m__root))));
i++;
}
}
}
cast_nested_t::~cast_nested_t() {
_clean_up();
}
void cast_nested_t::_clean_up() {
}
cast_nested_t::opcode_t::opcode_t(kaitai::kstream* p__io, cast_nested_t* p__parent, cast_nested_t* p__root) : kaitai::kstruct(p__io) {
m__parent = p__parent;
m__root = p__root;
_read();
}
void cast_nested_t::opcode_t::_read() {
m_code = m__io->read_u1();
n_body = true;
switch (code()) {
case 73: {
n_body = false;
m_body = std::unique_ptr<intval_t>(new intval_t(m__io, this, m__root));
break;
}
case 83: {
n_body = false;
m_body = std::unique_ptr<strval_t>(new strval_t(m__io, this, m__root));
break;
}
}
}
cast_nested_t::opcode_t::~opcode_t() {
_clean_up();
}
void cast_nested_t::opcode_t::_clean_up() {
if (!n_body) {
}
}
cast_nested_t::opcode_t::intval_t::intval_t(kaitai::kstream* p__io, cast_nested_t::opcode_t* p__parent, cast_nested_t* p__root) : kaitai::kstruct(p__io) {
m__parent = p__parent;
m__root = p__root;
_read();
}
void cast_nested_t::opcode_t::intval_t::_read() {
m_value = m__io->read_u1();
}
cast_nested_t::opcode_t::intval_t::~intval_t() {
_clean_up();
}
void cast_nested_t::opcode_t::intval_t::_clean_up() {
}
cast_nested_t::opcode_t::strval_t::strval_t(kaitai::kstream* p__io, cast_nested_t::opcode_t* p__parent, cast_nested_t* p__root) : kaitai::kstruct(p__io) {
m__parent = p__parent;
m__root = p__root;
_read();
}
void cast_nested_t::opcode_t::strval_t::_read() {
m_value = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("ASCII"));
}
cast_nested_t::opcode_t::strval_t::~strval_t() {
_clean_up();
}
void cast_nested_t::opcode_t::strval_t::_clean_up() {
}
cast_nested_t::opcode_t::strval_t* cast_nested_t::opcodes_0_str() {
if (f_opcodes_0_str)
return m_opcodes_0_str;
m_opcodes_0_str = static_cast<cast_nested_t::opcode_t::strval_t*>(opcodes()->at(0)->body());
f_opcodes_0_str = true;
return m_opcodes_0_str;
}
std::string cast_nested_t::opcodes_0_str_value() {
if (f_opcodes_0_str_value)
return m_opcodes_0_str_value;
m_opcodes_0_str_value = static_cast<cast_nested_t::opcode_t::strval_t*>(opcodes()->at(0)->body())->value();
f_opcodes_0_str_value = true;
return m_opcodes_0_str_value;
}
cast_nested_t::opcode_t::intval_t* cast_nested_t::opcodes_1_int() {
if (f_opcodes_1_int)
return m_opcodes_1_int;
m_opcodes_1_int = static_cast<cast_nested_t::opcode_t::intval_t*>(opcodes()->at(1)->body());
f_opcodes_1_int = true;
return m_opcodes_1_int;
}
uint8_t cast_nested_t::opcodes_1_int_value() {
if (f_opcodes_1_int_value)
return m_opcodes_1_int_value;
m_opcodes_1_int_value = static_cast<cast_nested_t::opcode_t::intval_t*>(opcodes()->at(1)->body())->value();
f_opcodes_1_int_value = true;
return m_opcodes_1_int_value;
}