summaryrefslogtreecommitdiff
path: root/tests/namespace_test/namespace_test2_namespace_a_generated.dart
blob: 8c08420cf6c7f7e83ef9c77015c499bac0b76936 (plain)
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
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_local_variable

library namespace_a;

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

import './namespace_test2_namespace_c_generated.dart' as namespace_c;

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

  static const fb.Reader<TableInFirstNS> reader = const _TableInFirstNSReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  namespace_a_namespace_b.TableInNestedNS get fooTable => namespace_a_namespace_b.TableInNestedNS.reader.vTableGet(_bc, _bcOffset, 4, null);
  EnumInNestedNS get fooEnum => new EnumInNestedNS.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 6, 0));
  UnionInNestedNSTypeId get fooUnionType => new UnionInNestedNSTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 8, 0));
  dynamic get fooUnion {
    switch (fooUnionType?.value) {
      case 1: return TableInNestedNS.reader.vTableGet(_bc, _bcOffset, 10, null);
      default: return null;
    }
  }
  namespace_a_namespace_b.StructInNestedNS get fooStruct => namespace_a_namespace_b.StructInNestedNS.reader.vTableGet(_bc, _bcOffset, 12, null);

  @override
  String toString() {
    return 'TableInFirstNS{fooTable: $fooTable, fooEnum: $fooEnum, fooUnionType: $fooUnionType, fooUnion: $fooUnion, fooStruct: $fooStruct}';
  }
}

class _TableInFirstNSReader extends fb.TableReader<TableInFirstNS> {
  const _TableInFirstNSReader();

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

class TableInFirstNSBuilder {
  TableInFirstNSBuilder(this.fbBuilder) {
    assert(fbBuilder != null);
  }

  final fb.Builder fbBuilder;

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

  int addFooTableOffset(int offset) {
    fbBuilder.addOffset(0, offset);
    return fbBuilder.offset;
  }
  int addFooEnum(EnumInNestedNS fooEnum) {
    fbBuilder.addInt8(1, fooEnum?.value);
    return fbBuilder.offset;
  }
  int addFooUnionType(UnionInNestedNSTypeId fooUnionType) {
    fbBuilder.addUint8(2, fooUnionType?.value);
    return fbBuilder.offset;
  }
  int addFooUnionOffset(int offset) {
    fbBuilder.addOffset(3, offset);
    return fbBuilder.offset;
  }
  int addFooStruct(int offset) {
    fbBuilder.addStruct(4, offset);
    return fbBuilder.offset;
  }

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

class TableInFirstNSObjectBuilder extends fb.ObjectBuilder {
  final namespace_a_namespace_b.TableInNestedNSObjectBuilder _fooTable;
  final EnumInNestedNS _fooEnum;
  final UnionInNestedNSTypeId _fooUnionType;
  final dynamic _fooUnion;
  final namespace_a_namespace_b.StructInNestedNSObjectBuilder _fooStruct;

  TableInFirstNSObjectBuilder({
    namespace_a_namespace_b.TableInNestedNSObjectBuilder fooTable,
    EnumInNestedNS fooEnum,
    UnionInNestedNSTypeId fooUnionType,
    dynamic fooUnion,
    namespace_a_namespace_b.StructInNestedNSObjectBuilder fooStruct,
  })
      : _fooTable = fooTable,
        _fooEnum = fooEnum,
        _fooUnionType = fooUnionType,
        _fooUnion = fooUnion,
        _fooStruct = fooStruct;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(
    fb.Builder fbBuilder) {
    assert(fbBuilder != null);
    final int fooTableOffset = _fooTable?.getOrCreateOffset(fbBuilder);
    final int fooUnionOffset = _fooUnion?.getOrCreateOffset(fbBuilder);

    fbBuilder.startTable();
    if (fooTableOffset != null) {
      fbBuilder.addOffset(0, fooTableOffset);
    }
    fbBuilder.addInt8(1, _fooEnum?.value);
    fbBuilder.addUint8(2, _fooUnionType?.value);
    if (fooUnionOffset != null) {
      fbBuilder.addOffset(3, fooUnionOffset);
    }
    if (_fooStruct != null) {
      fbBuilder.addStruct(4, _fooStruct.finish(fbBuilder));
    }
    return fbBuilder.endTable();
  }

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

  static const fb.Reader<SecondTableInA> reader = const _SecondTableInAReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  namespace_c.TableInC get referToC => namespace_c.TableInC.reader.vTableGet(_bc, _bcOffset, 4, null);

  @override
  String toString() {
    return 'SecondTableInA{referToC: $referToC}';
  }
}

class _SecondTableInAReader extends fb.TableReader<SecondTableInA> {
  const _SecondTableInAReader();

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

class SecondTableInABuilder {
  SecondTableInABuilder(this.fbBuilder) {
    assert(fbBuilder != null);
  }

  final fb.Builder fbBuilder;

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

  int addReferToCOffset(int offset) {
    fbBuilder.addOffset(0, offset);
    return fbBuilder.offset;
  }

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

class SecondTableInAObjectBuilder extends fb.ObjectBuilder {
  final namespace_c.TableInCObjectBuilder _referToC;

  SecondTableInAObjectBuilder({
    namespace_c.TableInCObjectBuilder referToC,
  })
      : _referToC = referToC;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(
    fb.Builder fbBuilder) {
    assert(fbBuilder != null);
    final int referToCOffset = _referToC?.getOrCreateOffset(fbBuilder);

    fbBuilder.startTable();
    if (referToCOffset != null) {
      fbBuilder.addOffset(0, referToCOffset);
    }
    return fbBuilder.endTable();
  }

  /// Convenience method to serialize to byte list.
  @override
  Uint8List toBytes([String fileIdentifier]) {
    fb.Builder fbBuilder = new fb.Builder();
    int offset = finish(fbBuilder);
    return fbBuilder.finish(offset, fileIdentifier);
  }
}