OILS / _gen / asdl / examples / demo_lib.asdl.h View on Github | oils.pub

178 lines, 110 significant
1// _gen/asdl/examples/demo_lib.asdl.h is generated by asdl_main.py
2
3#ifndef DEMO_LIB_ASDL
4#define DEMO_LIB_ASDL
5
6#include <cstdint>
7
8#include "mycpp/runtime.h"
9#include "asdl/cpp_runtime.h"
10namespace demo_lib_asdl {
11
12// use struct instead of namespace so 'using' works consistently
13#define ASDL_NAMES struct
14
15class value_t;
16class t2;
17class t3;
18class t4;
19class LibToken;
20
21ASDL_NAMES value_e {
22 enum no_name {
23 Str = 1,
24 Array = 2,
25 };
26};
27
28BigStr* value_str(int tag, bool dot = true);
29
30class value_t {
31 protected:
32 value_t() {
33 }
34 public:
35 int tag() const {
36 return ObjHeader::FromObject(this)->type_tag;
37 }
38 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
39 DISALLOW_COPY_AND_ASSIGN(value_t)
40};
41
42class value__Str : public value_t {
43 public:
44 value__Str() {}
45
46 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
47
48 static constexpr ObjHeader obj_header() {
49 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 0);
50 }
51
52
53 DISALLOW_COPY_AND_ASSIGN(value__Str)
54};
55
56class value__Array : public value_t {
57 public:
58 value__Array(int a)
59 : a(a) {
60 }
61
62 static value__Array* CreateNull(bool alloc_lists = false) {
63 return Alloc<value__Array>(-1);
64 }
65
66 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
67
68 static constexpr ObjHeader obj_header() {
69 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Array), 0);
70 }
71
72 int a;
73
74 DISALLOW_COPY_AND_ASSIGN(value__Array)
75};
76
77extern GcGlobal<value__Str> gvalue__Str;
78ASDL_NAMES value {
79 static value__Str* Str;
80 typedef value__Array Array;
81};
82
83class t2 {
84 public:
85 t2(int a, int b)
86 : a(a),
87 b(b) {
88 }
89
90 static t2* CreateNull(bool alloc_lists = false) {
91 return Alloc<t2>(-1, -1);
92 }
93
94 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
95
96 static constexpr ObjHeader obj_header() {
97 return ObjHeader::AsdlClass(64, 0);
98 }
99
100 int a;
101 int b;
102
103 DISALLOW_COPY_AND_ASSIGN(t2)
104};
105
106class t3 {
107 public:
108 t3(int a, int b)
109 : a(a),
110 b(b) {
111 }
112
113 static t3* CreateNull(bool alloc_lists = false) {
114 return Alloc<t3>(-1, -1);
115 }
116
117 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
118
119 static constexpr ObjHeader obj_header() {
120 return ObjHeader::AsdlClass(65, 0);
121 }
122
123 int a;
124 int b;
125
126 DISALLOW_COPY_AND_ASSIGN(t3)
127};
128
129class t4 {
130 public:
131 t4(int a, int b)
132 : a(a),
133 b(b) {
134 }
135
136 static t4* CreateNull(bool alloc_lists = false) {
137 return Alloc<t4>(-1, -1);
138 }
139
140 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
141
142 static constexpr ObjHeader obj_header() {
143 return ObjHeader::AsdlClass(66, 0);
144 }
145
146 int a;
147 int b;
148
149 DISALLOW_COPY_AND_ASSIGN(t4)
150};
151
152class LibToken {
153 public:
154 LibToken(BigStr* s, int i)
155 : s(s),
156 i(i) {
157 }
158
159 static LibToken* CreateNull(bool alloc_lists = false) {
160 return Alloc<LibToken>(kEmptyString, -1);
161 }
162
163 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
164
165 static constexpr ObjHeader obj_header() {
166 return ObjHeader::AsdlClass(67, 1);
167 }
168
169 BigStr* s;
170 int i;
171
172 DISALLOW_COPY_AND_ASSIGN(LibToken)
173};
174
175
176} // namespace demo_lib_asdl
177
178#endif // DEMO_LIB_ASDL