File: keyword_test_keyword_test_generated.dart

package info (click to toggle)
golang-github-google-flatbuffers 24.3.25-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 17,364 kB
  • sloc: cpp: 49,726; python: 6,901; cs: 5,566; java: 4,370; ansic: 2,512; php: 1,460; javascript: 1,053; xml: 1,016; sh: 870; makefile: 13
file content (399 lines) | stat: -rw-r--r-- 10,234 bytes parent folder | download | duplicates (8)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable

library keyword_test;

import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;


class Abc {
  final int value;
  const Abc._(this.value);

  factory Abc.fromValue(int value) {
    final result = values[value];
    if (result == null) {
        throw StateError('Invalid value $value for bit flag enum Abc');
    }
    return result;
  }

  static Abc? _createOrNull(int? value) => 
      value == null ? null : Abc.fromValue(value);

  static const int minValue = 0;
  static const int maxValue = 2;
  static bool containsValue(int value) => values.containsKey(value);

  static const Abc $void = Abc._(0);
  static const Abc where = Abc._(1);
  static const Abc stackalloc = Abc._(2);
  static const Map<int, Abc> values = {
    0: $void,
    1: where,
    2: stackalloc};

  static const fb.Reader<Abc> reader = _AbcReader();

  @override
  String toString() {
    return 'Abc{value: $value}';
  }
}

class _AbcReader extends fb.Reader<Abc> {
  const _AbcReader();

  @override
  int get size => 4;

  @override
  Abc read(fb.BufferContext bc, int offset) =>
      Abc.fromValue(const fb.Int32Reader().read(bc, offset));
}

class Public {
  final int value;
  const Public._(this.value);

  factory Public.fromValue(int value) {
    final result = values[value];
    if (result == null) {
        throw StateError('Invalid value $value for bit flag enum Public');
    }
    return result;
  }

  static Public? _createOrNull(int? value) => 
      value == null ? null : Public.fromValue(value);

  static const int minValue = 0;
  static const int maxValue = 0;
  static bool containsValue(int value) => values.containsKey(value);

  static const Public NONE = Public._(0);
  static const Map<int, Public> values = {
    0: NONE};

  static const fb.Reader<Public> reader = _PublicReader();

  @override
  String toString() {
    return 'Public{value: $value}';
  }
}

class _PublicReader extends fb.Reader<Public> {
  const _PublicReader();

  @override
  int get size => 4;

  @override
  Public read(fb.BufferContext bc, int offset) =>
      Public.fromValue(const fb.Int32Reader().read(bc, offset));
}

class KeywordsInUnionTypeId {
  final int value;
  const KeywordsInUnionTypeId._(this.value);

  factory KeywordsInUnionTypeId.fromValue(int value) {
    final result = values[value];
    if (result == null) {
        throw StateError('Invalid value $value for bit flag enum KeywordsInUnionTypeId');
    }
    return result;
  }

  static KeywordsInUnionTypeId? _createOrNull(int? value) => 
      value == null ? null : KeywordsInUnionTypeId.fromValue(value);

  static const int minValue = 0;
  static const int maxValue = 2;
  static bool containsValue(int value) => values.containsKey(value);

  static const KeywordsInUnionTypeId NONE = KeywordsInUnionTypeId._(0);
  static const KeywordsInUnionTypeId $static = KeywordsInUnionTypeId._(1);
  static const KeywordsInUnionTypeId internal = KeywordsInUnionTypeId._(2);
  static const Map<int, KeywordsInUnionTypeId> values = {
    0: NONE,
    1: $static,
    2: internal};

  static const fb.Reader<KeywordsInUnionTypeId> reader = _KeywordsInUnionTypeIdReader();

  @override
  String toString() {
    return 'KeywordsInUnionTypeId{value: $value}';
  }
}

class _KeywordsInUnionTypeIdReader extends fb.Reader<KeywordsInUnionTypeId> {
  const _KeywordsInUnionTypeIdReader();

  @override
  int get size => 1;

  @override
  KeywordsInUnionTypeId read(fb.BufferContext bc, int offset) =>
      KeywordsInUnionTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
}

class KeywordsInTable {
  KeywordsInTable._(this._bc, this._bcOffset);
  factory KeywordsInTable(List<int> bytes) {
    final rootRef = fb.BufferContext.fromBytes(bytes);
    return reader.read(rootRef, 0);
  }

  static const fb.Reader<KeywordsInTable> reader = _KeywordsInTableReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  Abc get $is => Abc.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0));
  Public get private => Public.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 6, 0));
  int get type => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 8, 0);
  bool get $default => const fb.BoolReader().vTableGet(_bc, _bcOffset, 10, false);

  @override
  String toString() {
    return 'KeywordsInTable{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}';
  }

  KeywordsInTableT unpack() => KeywordsInTableT(
      $is: $is,
      private: private,
      type: type,
      $default: $default);

  static int pack(fb.Builder fbBuilder, KeywordsInTableT? object) {
    if (object == null) return 0;
    return object.pack(fbBuilder);
  }
}

class KeywordsInTableT implements fb.Packable {
  Abc $is;
  Public private;
  int type;
  bool $default;

  KeywordsInTableT({
      this.$is = Abc.$void,
      this.private = Public.NONE,
      this.type = 0,
      this.$default = false});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.startTable(4);
    fbBuilder.addInt32(0, $is.value);
    fbBuilder.addInt32(1, private.value);
    fbBuilder.addInt32(2, type);
    fbBuilder.addBool(3, $default);
    return fbBuilder.endTable();
  }

  @override
  String toString() {
    return 'KeywordsInTableT{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}';
  }
}

class _KeywordsInTableReader extends fb.TableReader<KeywordsInTable> {
  const _KeywordsInTableReader();

  @override
  KeywordsInTable createObject(fb.BufferContext bc, int offset) => 
    KeywordsInTable._(bc, offset);
}

class KeywordsInTableBuilder {
  KeywordsInTableBuilder(this.fbBuilder);

  final fb.Builder fbBuilder;

  void begin() {
    fbBuilder.startTable(4);
  }

  int addIs(Abc? $is) {
    fbBuilder.addInt32(0, $is?.value);
    return fbBuilder.offset;
  }
  int addPrivate(Public? private) {
    fbBuilder.addInt32(1, private?.value);
    return fbBuilder.offset;
  }
  int addType(int? type) {
    fbBuilder.addInt32(2, type);
    return fbBuilder.offset;
  }
  int addDefault(bool? $default) {
    fbBuilder.addBool(3, $default);
    return fbBuilder.offset;
  }

  int finish() {
    return fbBuilder.endTable();
  }
}

class KeywordsInTableObjectBuilder extends fb.ObjectBuilder {
  final Abc? _$is;
  final Public? _private;
  final int? _type;
  final bool? _$default;

  KeywordsInTableObjectBuilder({
    Abc? $is,
    Public? private,
    int? type,
    bool? $default,
  })
      : _$is = $is,
        _private = private,
        _type = type,
        _$default = $default;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    fbBuilder.startTable(4);
    fbBuilder.addInt32(0, _$is?.value);
    fbBuilder.addInt32(1, _private?.value);
    fbBuilder.addInt32(2, _type);
    fbBuilder.addBool(3, _$default);
    return fbBuilder.endTable();
  }

  /// Convenience method to serialize to byte list.
  @override
  Uint8List toBytes([String? fileIdentifier]) {
    final fbBuilder = fb.Builder(deduplicateTables: false);
    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
    return fbBuilder.buffer;
  }
}
class Table2 {
  Table2._(this._bc, this._bcOffset);
  factory Table2(List<int> bytes) {
    final rootRef = fb.BufferContext.fromBytes(bytes);
    return reader.read(rootRef, 0);
  }

  static const fb.Reader<Table2> reader = _Table2Reader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  KeywordsInUnionTypeId? get typeType => KeywordsInUnionTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 4));
  dynamic get type {
    switch (typeType?.value) {
      case 1: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
      case 2: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
      default: return null;
    }
  }

  @override
  String toString() {
    return 'Table2{typeType: ${typeType}, type: ${type}}';
  }

  Table2T unpack() => Table2T(
      typeType: typeType,
      type: type);

  static int pack(fb.Builder fbBuilder, Table2T? object) {
    if (object == null) return 0;
    return object.pack(fbBuilder);
  }
}

class Table2T implements fb.Packable {
  KeywordsInUnionTypeId? typeType;
  dynamic type;

  Table2T({
      this.typeType,
      this.type});

  @override
  int pack(fb.Builder fbBuilder) {
    final int? typeOffset = type?.pack(fbBuilder);
    fbBuilder.startTable(2);
    fbBuilder.addUint8(0, typeType?.value);
    fbBuilder.addOffset(1, typeOffset);
    return fbBuilder.endTable();
  }

  @override
  String toString() {
    return 'Table2T{typeType: ${typeType}, type: ${type}}';
  }
}

class _Table2Reader extends fb.TableReader<Table2> {
  const _Table2Reader();

  @override
  Table2 createObject(fb.BufferContext bc, int offset) => 
    Table2._(bc, offset);
}

class Table2Builder {
  Table2Builder(this.fbBuilder);

  final fb.Builder fbBuilder;

  void begin() {
    fbBuilder.startTable(2);
  }

  int addTypeType(KeywordsInUnionTypeId? typeType) {
    fbBuilder.addUint8(0, typeType?.value);
    return fbBuilder.offset;
  }
  int addTypeOffset(int? offset) {
    fbBuilder.addOffset(1, offset);
    return fbBuilder.offset;
  }

  int finish() {
    return fbBuilder.endTable();
  }
}

class Table2ObjectBuilder extends fb.ObjectBuilder {
  final KeywordsInUnionTypeId? _typeType;
  final dynamic _type;

  Table2ObjectBuilder({
    KeywordsInUnionTypeId? typeType,
    dynamic type,
  })
      : _typeType = typeType,
        _type = type;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    final int? typeOffset = _type?.getOrCreateOffset(fbBuilder);
    fbBuilder.startTable(2);
    fbBuilder.addUint8(0, _typeType?.value);
    fbBuilder.addOffset(1, typeOffset);
    return fbBuilder.endTable();
  }

  /// Convenience method to serialize to byte list.
  @override
  Uint8List toBytes([String? fileIdentifier]) {
    final fbBuilder = fb.Builder(deduplicateTables: false);
    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
    return fbBuilder.buffer;
  }
}