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

181 lines, 112 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 constexpr int sum_type_id() {
39 return 0;
40 }
41 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
42 DISALLOW_COPY_AND_ASSIGN(value_t)
43};
44
45class value__Str : public value_t {
46 public:
47 value__Str() {}
48
49 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
50
51 static constexpr ObjHeader obj_header() {
52 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 0);
53 }
54
55
56 DISALLOW_COPY_AND_ASSIGN(value__Str)
57};
58
59class value__Array : public value_t {
60 public:
61 value__Array(int a)
62 : a(a) {
63 }
64
65 static value__Array* CreateNull(bool alloc_lists = false) {
66 return Alloc<value__Array>(-1);
67 }
68
69 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
70
71 static constexpr ObjHeader obj_header() {
72 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Array), 0);
73 }
74
75 int a;
76
77 DISALLOW_COPY_AND_ASSIGN(value__Array)
78};
79
80extern GcGlobal<value__Str> gvalue__Str;
81ASDL_NAMES value {
82 static value__Str* Str;
83 typedef value__Array Array;
84};
85
86class t2 {
87 public:
88 t2(int a, int b)
89 : a(a),
90 b(b) {
91 }
92
93 static t2* CreateNull(bool alloc_lists = false) {
94 return Alloc<t2>(-1, -1);
95 }
96
97 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
98
99 static constexpr ObjHeader obj_header() {
100 return ObjHeader::AsdlClass(64, 0);
101 }
102
103 int a;
104 int b;
105
106 DISALLOW_COPY_AND_ASSIGN(t2)
107};
108
109class t3 {
110 public:
111 t3(int a, int b)
112 : a(a),
113 b(b) {
114 }
115
116 static t3* CreateNull(bool alloc_lists = false) {
117 return Alloc<t3>(-1, -1);
118 }
119
120 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
121
122 static constexpr ObjHeader obj_header() {
123 return ObjHeader::AsdlClass(65, 0);
124 }
125
126 int a;
127 int b;
128
129 DISALLOW_COPY_AND_ASSIGN(t3)
130};
131
132class t4 {
133 public:
134 t4(int a, int b)
135 : a(a),
136 b(b) {
137 }
138
139 static t4* CreateNull(bool alloc_lists = false) {
140 return Alloc<t4>(-1, -1);
141 }
142
143 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
144
145 static constexpr ObjHeader obj_header() {
146 return ObjHeader::AsdlClass(66, 0);
147 }
148
149 int a;
150 int b;
151
152 DISALLOW_COPY_AND_ASSIGN(t4)
153};
154
155class LibToken {
156 public:
157 LibToken(BigStr* s, int i)
158 : s(s),
159 i(i) {
160 }
161
162 static LibToken* CreateNull(bool alloc_lists = false) {
163 return Alloc<LibToken>(kEmptyString, -1);
164 }
165
166 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
167
168 static constexpr ObjHeader obj_header() {
169 return ObjHeader::AsdlClass(67, 1);
170 }
171
172 BigStr* s;
173 int i;
174
175 DISALLOW_COPY_AND_ASSIGN(LibToken)
176};
177
178
179} // namespace demo_lib_asdl
180
181#endif // DEMO_LIB_ASDL