• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2// ignore_for_file: unused_import, unused_field, unused_local_variable
3
4library namespace_c;
5
6import 'dart:typed_data' show Uint8List;
7import 'package:flat_buffers/flat_buffers.dart' as fb;
8
9import 'namespace_test1_namespace_c_generated.dart';
10import './namespace_test2_namespace_a_generated.dart' as namespace_a;
11
12class TableInC {
13  TableInC._(this._bc, this._bcOffset);
14  factory TableInC(List<int> bytes) {
15    fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
16    return reader.read(rootRef, 0);
17  }
18
19  static const fb.Reader<TableInC> reader = const _TableInCReader();
20
21  final fb.BufferContext _bc;
22  final int _bcOffset;
23
24  namespace_a.TableInFirstNS get referToA1 => namespace_a.TableInFirstNS.reader.vTableGet(_bc, _bcOffset, 4, null);
25  namespace_a.SecondTableInA get referToA2 => namespace_a.SecondTableInA.reader.vTableGet(_bc, _bcOffset, 6, null);
26
27  @override
28  String toString() {
29    return 'TableInC{referToA1: $referToA1, referToA2: $referToA2}';
30  }
31}
32
33class _TableInCReader extends fb.TableReader<TableInC> {
34  const _TableInCReader();
35
36  @override
37  TableInC createObject(fb.BufferContext bc, int offset) =>
38    new TableInC._(bc, offset);
39}
40
41class TableInCBuilder {
42  TableInCBuilder(this.fbBuilder) {
43    assert(fbBuilder != null);
44  }
45
46  final fb.Builder fbBuilder;
47
48  void begin() {
49    fbBuilder.startTable();
50  }
51
52  int addReferToA1Offset(int offset) {
53    fbBuilder.addOffset(0, offset);
54    return fbBuilder.offset;
55  }
56  int addReferToA2Offset(int offset) {
57    fbBuilder.addOffset(1, offset);
58    return fbBuilder.offset;
59  }
60
61  int finish() {
62    return fbBuilder.endTable();
63  }
64}
65
66class TableInCObjectBuilder extends fb.ObjectBuilder {
67  final namespace_a.TableInFirstNSObjectBuilder _referToA1;
68  final namespace_a.SecondTableInAObjectBuilder _referToA2;
69
70  TableInCObjectBuilder({
71    namespace_a.TableInFirstNSObjectBuilder referToA1,
72    namespace_a.SecondTableInAObjectBuilder referToA2,
73  })
74      : _referToA1 = referToA1,
75        _referToA2 = referToA2;
76
77  /// Finish building, and store into the [fbBuilder].
78  @override
79  int finish(
80    fb.Builder fbBuilder) {
81    assert(fbBuilder != null);
82    final int referToA1Offset = _referToA1?.getOrCreateOffset(fbBuilder);
83    final int referToA2Offset = _referToA2?.getOrCreateOffset(fbBuilder);
84
85    fbBuilder.startTable();
86    if (referToA1Offset != null) {
87      fbBuilder.addOffset(0, referToA1Offset);
88    }
89    if (referToA2Offset != null) {
90      fbBuilder.addOffset(1, referToA2Offset);
91    }
92    return fbBuilder.endTable();
93  }
94
95  /// Convenience method to serialize to byte list.
96  @override
97  Uint8List toBytes([String fileIdentifier]) {
98    fb.Builder fbBuilder = new fb.Builder();
99    int offset = finish(fbBuilder);
100    return fbBuilder.finish(offset, fileIdentifier);
101  }
102}
103