File: namespace_test1_namespace_a.namespace_b_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 (295 lines) | stat: -rw-r--r-- 7,227 bytes parent folder | download | duplicates (11)
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
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable

library namespace_a.namespace_b;

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


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

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

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

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

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

  static const fb.Reader<UnionInNestedNSTypeId> reader = _UnionInNestedNSTypeIdReader();

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

class _UnionInNestedNSTypeIdReader extends fb.Reader<UnionInNestedNSTypeId> {
  const _UnionInNestedNSTypeIdReader();

  @override
  int get size => 1;

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

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

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

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

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

  static const EnumInNestedNS A = EnumInNestedNS._(0);
  static const EnumInNestedNS B = EnumInNestedNS._(1);
  static const EnumInNestedNS C = EnumInNestedNS._(2);
  static const Map<int, EnumInNestedNS> values = {
    0: A,
    1: B,
    2: C};

  static const fb.Reader<EnumInNestedNS> reader = _EnumInNestedNSReader();

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

class _EnumInNestedNSReader extends fb.Reader<EnumInNestedNS> {
  const _EnumInNestedNSReader();

  @override
  int get size => 1;

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

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

  static const fb.Reader<TableInNestedNS> reader = _TableInNestedNSReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  int get foo => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0);

  @override
  String toString() {
    return 'TableInNestedNS{foo: $foo}';
  }

  TableInNestedNST unpack() => TableInNestedNST(
      foo: foo);

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

class TableInNestedNST implements fb.Packable {
  int foo;

  TableInNestedNST({
      this.foo = 0});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.startTable(1);
    fbBuilder.addInt32(0, foo);
    return fbBuilder.endTable();
  }

  @override
  String toString() {
    return 'TableInNestedNST{foo: $foo}';
  }
}

class _TableInNestedNSReader extends fb.TableReader<TableInNestedNS> {
  const _TableInNestedNSReader();

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

class TableInNestedNSBuilder {
  TableInNestedNSBuilder(this.fbBuilder);

  final fb.Builder fbBuilder;

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

  int addFoo(int? foo) {
    fbBuilder.addInt32(0, foo);
    return fbBuilder.offset;
  }

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

class TableInNestedNSObjectBuilder extends fb.ObjectBuilder {
  final int? _foo;

  TableInNestedNSObjectBuilder({
    int? foo,
  })
      : _foo = foo;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    fbBuilder.startTable(1);
    fbBuilder.addInt32(0, _foo);
    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 StructInNestedNS {
  StructInNestedNS._(this._bc, this._bcOffset);

  static const fb.Reader<StructInNestedNS> reader = _StructInNestedNSReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  int get a => const fb.Int32Reader().read(_bc, _bcOffset + 0);
  int get b => const fb.Int32Reader().read(_bc, _bcOffset + 4);

  @override
  String toString() {
    return 'StructInNestedNS{a: $a, b: $b}';
  }

  StructInNestedNST unpack() => StructInNestedNST(
      a: a,
      b: b);

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

class StructInNestedNST implements fb.Packable {
  int a;
  int b;

  StructInNestedNST({
      required this.a,
      required this.b});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.putInt32(b);
    fbBuilder.putInt32(a);
    return fbBuilder.offset;
  }

  @override
  String toString() {
    return 'StructInNestedNST{a: $a, b: $b}';
  }
}

class _StructInNestedNSReader extends fb.StructReader<StructInNestedNS> {
  const _StructInNestedNSReader();

  @override
  int get size => 8;

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

class StructInNestedNSBuilder {
  StructInNestedNSBuilder(this.fbBuilder);

  final fb.Builder fbBuilder;

  int finish(int a, int b) {
    fbBuilder.putInt32(b);
    fbBuilder.putInt32(a);
    return fbBuilder.offset;
  }

}

class StructInNestedNSObjectBuilder extends fb.ObjectBuilder {
  final int _a;
  final int _b;

  StructInNestedNSObjectBuilder({
    required int a,
    required int b,
  })
      : _a = a,
        _b = b;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    fbBuilder.putInt32(_b);
    fbBuilder.putInt32(_a);
    return fbBuilder.offset;
  }

  /// 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;
  }
}