1// automatically generated by the FlatBuffers compiler, do not modify
2// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
3
4library keyword_test;
5
6import 'dart:typed_data' show Uint8List;
7import 'package:flat_buffers/flat_buffers.dart' as fb;
8
9
10class Abc {
11 final int value;
12 const Abc._(this.value);
13
14 factory Abc.fromValue(int value) {
15 final result = values[value];
16 if (result == null) {
17 throw StateError('Invalid value $value for bit flag enum Abc');
18 }
19 return result;
20 }
21
22 static Abc? _createOrNull(int? value) =>
23 value == null ? null : Abc.fromValue(value);
24
25 static const int minValue = 0;
26 static const int maxValue = 2;
27 static bool containsValue(int value) => values.containsKey(value);
28
29 static const Abc $void = Abc._(0);
30 static const Abc where = Abc._(1);
31 static const Abc stackalloc = Abc._(2);
32 static const Map<int, Abc> values = {
33 0: $void,
34 1: where,
35 2: stackalloc};
36
37 static const fb.Reader<Abc> reader = _AbcReader();
38
39 @override
40 String toString() {
41 return 'Abc{value: $value}';
42 }
43}
44
45class _AbcReader extends fb.Reader<Abc> {
46 const _AbcReader();
47
48 @override
49 int get size => 4;
50
51 @override
52 Abc read(fb.BufferContext bc, int offset) =>
53 Abc.fromValue(const fb.Int32Reader().read(bc, offset));
54}
55
56class Public {
57 final int value;
58 const Public._(this.value);
59
60 factory Public.fromValue(int value) {
61 final result = values[value];
62 if (result == null) {
63 throw StateError('Invalid value $value for bit flag enum Public');
64 }
65 return result;
66 }
67
68 static Public? _createOrNull(int? value) =>
69 value == null ? null : Public.fromValue(value);
70
71 static const int minValue = 0;
72 static const int maxValue = 0;
73 static bool containsValue(int value) => values.containsKey(value);
74
75 static const Public NONE = Public._(0);
76 static const Map<int, Public> values = {
77 0: NONE};
78
79 static const fb.Reader<Public> reader = _PublicReader();
80
81 @override
82 String toString() {
83 return 'Public{value: $value}';
84 }
85}
86
87class _PublicReader extends fb.Reader<Public> {
88 const _PublicReader();
89
90 @override
91 int get size => 4;
92
93 @override
94 Public read(fb.BufferContext bc, int offset) =>
95 Public.fromValue(const fb.Int32Reader().read(bc, offset));
96}
97
98class KeywordsInUnionTypeId {
99 final int value;
100 const KeywordsInUnionTypeId._(this.value);
101
102 factory KeywordsInUnionTypeId.fromValue(int value) {
103 final result = values[value];
104 if (result == null) {
105 throw StateError('Invalid value $value for bit flag enum KeywordsInUnionTypeId');
106 }
107 return result;
108 }
109
110 static KeywordsInUnionTypeId? _createOrNull(int? value) =>
111 value == null ? null : KeywordsInUnionTypeId.fromValue(value);
112
113 static const int minValue = 0;
114 static const int maxValue = 2;
115 static bool containsValue(int value) => values.containsKey(value);
116
117 static const KeywordsInUnionTypeId NONE = KeywordsInUnionTypeId._(0);
118 static const KeywordsInUnionTypeId $static = KeywordsInUnionTypeId._(1);
119 static const KeywordsInUnionTypeId internal = KeywordsInUnionTypeId._(2);
120 static const Map<int, KeywordsInUnionTypeId> values = {
121 0: NONE,
122 1: $static,
123 2: internal};
124
125 static const fb.Reader<KeywordsInUnionTypeId> reader = _KeywordsInUnionTypeIdReader();
126
127 @override
128 String toString() {
129 return 'KeywordsInUnionTypeId{value: $value}';
130 }
131}
132
133class _KeywordsInUnionTypeIdReader extends fb.Reader<KeywordsInUnionTypeId> {
134 const _KeywordsInUnionTypeIdReader();
135
136 @override
137 int get size => 1;
138
139 @override
140 KeywordsInUnionTypeId read(fb.BufferContext bc, int offset) =>
141 KeywordsInUnionTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
142}
143
144class KeywordsInTable {
145 KeywordsInTable._(this._bc, this._bcOffset);
146 factory KeywordsInTable(List<int> bytes) {
147 final rootRef = fb.BufferContext.fromBytes(bytes);
148 return reader.read(rootRef, 0);
149 }
150
151 static const fb.Reader<KeywordsInTable> reader = _KeywordsInTableReader();
152
153 final fb.BufferContext _bc;
154 final int _bcOffset;
155
156 Abc get $is => Abc.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0));
157 Public get private => Public.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 6, 0));
158 int get type => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 8, 0);
159 bool get $default => const fb.BoolReader().vTableGet(_bc, _bcOffset, 10, false);
160
161 @override
162 String toString() {
163 return 'KeywordsInTable{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}';
164 }
165
166 KeywordsInTableT unpack() => KeywordsInTableT(
167 $is: $is,
168 private: private,
169 type: type,
170 $default: $default);
171
172 static int pack(fb.Builder fbBuilder, KeywordsInTableT? object) {
173 if (object == null) return 0;
174 return object.pack(fbBuilder);
175 }
176}
177
178class KeywordsInTableT implements fb.Packable {
179 Abc $is;
180 Public private;
181 int type;
182 bool $default;
183
184 KeywordsInTableT({
185 this.$is = Abc.$void,
186 this.private = Public.NONE,
187 this.type = 0,
188 this.$default = false});
189
190 @override
191 int pack(fb.Builder fbBuilder) {
192 fbBuilder.startTable(4);
193 fbBuilder.addInt32(0, $is.value);
194 fbBuilder.addInt32(1, private.value);
195 fbBuilder.addInt32(2, type);
196 fbBuilder.addBool(3, $default);
197 return fbBuilder.endTable();
198 }
199
200 @override
201 String toString() {
202 return 'KeywordsInTableT{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}';
203 }
204}
205
206class _KeywordsInTableReader extends fb.TableReader<KeywordsInTable> {
207 const _KeywordsInTableReader();
208
209 @override
210 KeywordsInTable createObject(fb.BufferContext bc, int offset) =>
211 KeywordsInTable._(bc, offset);
212}
213
214class KeywordsInTableBuilder {
215 KeywordsInTableBuilder(this.fbBuilder);
216
217 final fb.Builder fbBuilder;
218
219 void begin() {
220 fbBuilder.startTable(4);
221 }
222
223 int addIs(Abc? $is) {
224 fbBuilder.addInt32(0, $is?.value);
225 return fbBuilder.offset;
226 }
227 int addPrivate(Public? private) {
228 fbBuilder.addInt32(1, private?.value);
229 return fbBuilder.offset;
230 }
231 int addType(int? type) {
232 fbBuilder.addInt32(2, type);
233 return fbBuilder.offset;
234 }
235 int addDefault(bool? $default) {
236 fbBuilder.addBool(3, $default);
237 return fbBuilder.offset;
238 }
239
240 int finish() {
241 return fbBuilder.endTable();
242 }
243}
244
245class KeywordsInTableObjectBuilder extends fb.ObjectBuilder {
246 final Abc? _$is;
247 final Public? _private;
248 final int? _type;
249 final bool? _$default;
250
251 KeywordsInTableObjectBuilder({
252 Abc? $is,
253 Public? private,
254 int? type,
255 bool? $default,
256 })
257 : _$is = $is,
258 _private = private,
259 _type = type,
260 _$default = $default;
261
262 /// Finish building, and store into the [fbBuilder].
263 @override
264 int finish(fb.Builder fbBuilder) {
265 fbBuilder.startTable(4);
266 fbBuilder.addInt32(0, _$is?.value);
267 fbBuilder.addInt32(1, _private?.value);
268 fbBuilder.addInt32(2, _type);
269 fbBuilder.addBool(3, _$default);
270 return fbBuilder.endTable();
271 }
272
273 /// Convenience method to serialize to byte list.
274 @override
275 Uint8List toBytes([String? fileIdentifier]) {
276 final fbBuilder = fb.Builder(deduplicateTables: false);
277 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
278 return fbBuilder.buffer;
279 }
280}
281class Table2 {
282 Table2._(this._bc, this._bcOffset);
283 factory Table2(List<int> bytes) {
284 final rootRef = fb.BufferContext.fromBytes(bytes);
285 return reader.read(rootRef, 0);
286 }
287
288 static const fb.Reader<Table2> reader = _Table2Reader();
289
290 final fb.BufferContext _bc;
291 final int _bcOffset;
292
293 KeywordsInUnionTypeId? get typeType => KeywordsInUnionTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 4));
294 dynamic get type {
295 switch (typeType?.value) {
296 case 1: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
297 case 2: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
298 default: return null;
299 }
300 }
301
302 @override
303 String toString() {
304 return 'Table2{typeType: ${typeType}, type: ${type}}';
305 }
306
307 Table2T unpack() => Table2T(
308 typeType: typeType,
309 type: type);
310
311 static int pack(fb.Builder fbBuilder, Table2T? object) {
312 if (object == null) return 0;
313 return object.pack(fbBuilder);
314 }
315}
316
317class Table2T implements fb.Packable {
318 KeywordsInUnionTypeId? typeType;
319 dynamic type;
320
321 Table2T({
322 this.typeType,
323 this.type});
324
325 @override
326 int pack(fb.Builder fbBuilder) {
327 final int? typeOffset = type?.pack(fbBuilder);
328 fbBuilder.startTable(2);
329 fbBuilder.addUint8(0, typeType?.value);
330 fbBuilder.addOffset(1, typeOffset);
331 return fbBuilder.endTable();
332 }
333
334 @override
335 String toString() {
336 return 'Table2T{typeType: ${typeType}, type: ${type}}';
337 }
338}
339
340class _Table2Reader extends fb.TableReader<Table2> {
341 const _Table2Reader();
342
343 @override
344 Table2 createObject(fb.BufferContext bc, int offset) =>
345 Table2._(bc, offset);
346}
347
348class Table2Builder {
349 Table2Builder(this.fbBuilder);
350
351 final fb.Builder fbBuilder;
352
353 void begin() {
354 fbBuilder.startTable(2);
355 }
356
357 int addTypeType(KeywordsInUnionTypeId? typeType) {
358 fbBuilder.addUint8(0, typeType?.value);
359 return fbBuilder.offset;
360 }
361 int addTypeOffset(int? offset) {
362 fbBuilder.addOffset(1, offset);
363 return fbBuilder.offset;
364 }
365
366 int finish() {
367 return fbBuilder.endTable();
368 }
369}
370
371class Table2ObjectBuilder extends fb.ObjectBuilder {
372 final KeywordsInUnionTypeId? _typeType;
373 final dynamic _type;
374
375 Table2ObjectBuilder({
376 KeywordsInUnionTypeId? typeType,
377 dynamic type,
378 })
379 : _typeType = typeType,
380 _type = type;
381
382 /// Finish building, and store into the [fbBuilder].
383 @override
384 int finish(fb.Builder fbBuilder) {
385 final int? typeOffset = _type?.getOrCreateOffset(fbBuilder);
386 fbBuilder.startTable(2);
387 fbBuilder.addUint8(0, _typeType?.value);
388 fbBuilder.addOffset(1, typeOffset);
389 return fbBuilder.endTable();
390 }
391
392 /// Convenience method to serialize to byte list.
393 @override
394 Uint8List toBytes([String? fileIdentifier]) {
395 final fbBuilder = fb.Builder(deduplicateTables: false);
396 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
397 return fbBuilder.buffer;
398 }
399}
View as plain text