Home | History | Annotate | Download | only in namespace_test
      1 // automatically generated by the FlatBuffers compiler, do not modify
      2 // ignore_for_file: unused_import, unused_field, unused_local_variable
      3 
      4 library namespace_a;
      5 
      6 import 'dart:typed_data' show Uint8List;
      7 import 'package:flat_buffers/flat_buffers.dart' as fb;
      8 
      9 import 'namespace_test1_namespace_a_generated.dart';
     10 import './namespace_test2_namespace_c_generated.dart' as namespace_c;
     11 
     12 class TableInFirstNS {
     13   TableInFirstNS._(this._bc, this._bcOffset);
     14   factory TableInFirstNS(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<TableInFirstNS> reader = const _TableInFirstNSReader();
     20 
     21   final fb.BufferContext _bc;
     22   final int _bcOffset;
     23 
     24   namespace_a_namespace_b.TableInNestedNS get fooTable => namespace_a_namespace_b.TableInNestedNS.reader.vTableGet(_bc, _bcOffset, 4, null);
     25   EnumInNestedNS get fooEnum => new EnumInNestedNS.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 6, 0));
     26   namespace_a_namespace_b.StructInNestedNS get fooStruct => namespace_a_namespace_b.StructInNestedNS.reader.vTableGet(_bc, _bcOffset, 8, null);
     27 
     28   @override
     29   String toString() {
     30     return 'TableInFirstNS{fooTable: $fooTable, fooEnum: $fooEnum, fooStruct: $fooStruct}';
     31   }
     32 }
     33 
     34 class _TableInFirstNSReader extends fb.TableReader<TableInFirstNS> {
     35   const _TableInFirstNSReader();
     36 
     37   @override
     38   TableInFirstNS createObject(fb.BufferContext bc, int offset) => 
     39     new TableInFirstNS._(bc, offset);
     40 }
     41 
     42 class TableInFirstNSBuilder {
     43   TableInFirstNSBuilder(this.fbBuilder) {
     44     assert(fbBuilder != null);
     45   }
     46 
     47   final fb.Builder fbBuilder;
     48 
     49   void begin() {
     50     fbBuilder.startTable();
     51   }
     52 
     53   int addFooTableOffset(int offset) {
     54     fbBuilder.addOffset(0, offset);
     55     return fbBuilder.offset;
     56   }
     57   int addFooEnum(EnumInNestedNS fooEnum) {
     58     fbBuilder.addInt8(1, fooEnum?.value);
     59     return fbBuilder.offset;
     60   }
     61   int addFooStruct(int offset) {
     62     fbBuilder.addStruct(2, offset);
     63     return fbBuilder.offset;
     64   }
     65 
     66   int finish() {
     67     return fbBuilder.endTable();
     68   }
     69 }
     70 
     71 class TableInFirstNSObjectBuilder extends fb.ObjectBuilder {
     72   final namespace_a_namespace_b.TableInNestedNSObjectBuilder _fooTable;
     73   final EnumInNestedNS _fooEnum;
     74   final namespace_a_namespace_b.StructInNestedNSObjectBuilder _fooStruct;
     75 
     76   TableInFirstNSObjectBuilder({
     77     namespace_a_namespace_b.TableInNestedNSObjectBuilder fooTable,
     78     EnumInNestedNS fooEnum,
     79     namespace_a_namespace_b.StructInNestedNSObjectBuilder fooStruct,
     80   })
     81       : _fooTable = fooTable,
     82         _fooEnum = fooEnum,
     83         _fooStruct = fooStruct;
     84 
     85   /// Finish building, and store into the [fbBuilder].
     86   @override
     87   int finish(
     88     fb.Builder fbBuilder) {
     89     assert(fbBuilder != null);
     90     final int fooTableOffset = _fooTable?.getOrCreateOffset(fbBuilder);
     91 
     92     fbBuilder.startTable();
     93     if (fooTableOffset != null) {
     94       fbBuilder.addOffset(0, fooTableOffset);
     95     }
     96     fbBuilder.addInt8(1, _fooEnum?.value);
     97     if (_fooStruct != null) {
     98       fbBuilder.addStruct(2, _fooStruct.finish(fbBuilder));
     99     }
    100     return fbBuilder.endTable();
    101   }
    102 
    103   /// Convenience method to serialize to byte list.
    104   @override
    105   Uint8List toBytes([String fileIdentifier]) {
    106     fb.Builder fbBuilder = new fb.Builder();
    107     int offset = finish(fbBuilder);
    108     return fbBuilder.finish(offset, fileIdentifier);
    109   }
    110 }
    111 class SecondTableInA {
    112   SecondTableInA._(this._bc, this._bcOffset);
    113   factory SecondTableInA(List<int> bytes) {
    114     fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
    115     return reader.read(rootRef, 0);
    116   }
    117 
    118   static const fb.Reader<SecondTableInA> reader = const _SecondTableInAReader();
    119 
    120   final fb.BufferContext _bc;
    121   final int _bcOffset;
    122 
    123   namespace_c.TableInC get referToC => namespace_c.TableInC.reader.vTableGet(_bc, _bcOffset, 4, null);
    124 
    125   @override
    126   String toString() {
    127     return 'SecondTableInA{referToC: $referToC}';
    128   }
    129 }
    130 
    131 class _SecondTableInAReader extends fb.TableReader<SecondTableInA> {
    132   const _SecondTableInAReader();
    133 
    134   @override
    135   SecondTableInA createObject(fb.BufferContext bc, int offset) => 
    136     new SecondTableInA._(bc, offset);
    137 }
    138 
    139 class SecondTableInABuilder {
    140   SecondTableInABuilder(this.fbBuilder) {
    141     assert(fbBuilder != null);
    142   }
    143 
    144   final fb.Builder fbBuilder;
    145 
    146   void begin() {
    147     fbBuilder.startTable();
    148   }
    149 
    150   int addReferToCOffset(int offset) {
    151     fbBuilder.addOffset(0, offset);
    152     return fbBuilder.offset;
    153   }
    154 
    155   int finish() {
    156     return fbBuilder.endTable();
    157   }
    158 }
    159 
    160 class SecondTableInAObjectBuilder extends fb.ObjectBuilder {
    161   final namespace_c.TableInCObjectBuilder _referToC;
    162 
    163   SecondTableInAObjectBuilder({
    164     namespace_c.TableInCObjectBuilder referToC,
    165   })
    166       : _referToC = referToC;
    167 
    168   /// Finish building, and store into the [fbBuilder].
    169   @override
    170   int finish(
    171     fb.Builder fbBuilder) {
    172     assert(fbBuilder != null);
    173     final int referToCOffset = _referToC?.getOrCreateOffset(fbBuilder);
    174 
    175     fbBuilder.startTable();
    176     if (referToCOffset != null) {
    177       fbBuilder.addOffset(0, referToCOffset);
    178     }
    179     return fbBuilder.endTable();
    180   }
    181 
    182   /// Convenience method to serialize to byte list.
    183   @override
    184   Uint8List toBytes([String fileIdentifier]) {
    185     fb.Builder fbBuilder = new fb.Builder();
    186     int offset = finish(fbBuilder);
    187     return fbBuilder.finish(offset, fileIdentifier);
    188   }
    189 }
    190