...

Text file src/github.com/google/flatbuffers/tests/namespace_test/namespace_test1_namespace_a.namespace_b_generated.dart

Documentation: github.com/google/flatbuffers/tests/namespace_test

     1// automatically generated by the FlatBuffers compiler, do not modify
     2// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
     3
     4library namespace_a.namespace_b;
     5
     6import 'dart:typed_data' show Uint8List;
     7import 'package:flat_buffers/flat_buffers.dart' as fb;
     8
     9
    10class UnionInNestedNSTypeId {
    11  final int value;
    12  const UnionInNestedNSTypeId._(this.value);
    13
    14  factory UnionInNestedNSTypeId.fromValue(int value) {
    15    final result = values[value];
    16    if (result == null) {
    17      throw StateError('Invalid value $value for bit flag enum UnionInNestedNSTypeId');
    18    }
    19    return result;
    20  }
    21
    22  static UnionInNestedNSTypeId? _createOrNull(int? value) => 
    23      value == null ? null : UnionInNestedNSTypeId.fromValue(value);
    24
    25  static const int minValue = 0;
    26  static const int maxValue = 1;
    27  static bool containsValue(int value) => values.containsKey(value);
    28
    29  static const UnionInNestedNSTypeId NONE = UnionInNestedNSTypeId._(0);
    30  static const UnionInNestedNSTypeId TableInNestedNS = UnionInNestedNSTypeId._(1);
    31  static const Map<int, UnionInNestedNSTypeId> values = {
    32    0: NONE,
    33    1: TableInNestedNS};
    34
    35  static const fb.Reader<UnionInNestedNSTypeId> reader = _UnionInNestedNSTypeIdReader();
    36
    37  @override
    38  String toString() {
    39    return 'UnionInNestedNSTypeId{value: $value}';
    40  }
    41}
    42
    43class _UnionInNestedNSTypeIdReader extends fb.Reader<UnionInNestedNSTypeId> {
    44  const _UnionInNestedNSTypeIdReader();
    45
    46  @override
    47  int get size => 1;
    48
    49  @override
    50  UnionInNestedNSTypeId read(fb.BufferContext bc, int offset) =>
    51      UnionInNestedNSTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
    52}
    53
    54class EnumInNestedNS {
    55  final int value;
    56  const EnumInNestedNS._(this.value);
    57
    58  factory EnumInNestedNS.fromValue(int value) {
    59    final result = values[value];
    60    if (result == null) {
    61      throw StateError('Invalid value $value for bit flag enum EnumInNestedNS');
    62    }
    63    return result;
    64  }
    65
    66  static EnumInNestedNS? _createOrNull(int? value) => 
    67      value == null ? null : EnumInNestedNS.fromValue(value);
    68
    69  static const int minValue = 0;
    70  static const int maxValue = 2;
    71  static bool containsValue(int value) => values.containsKey(value);
    72
    73  static const EnumInNestedNS A = EnumInNestedNS._(0);
    74  static const EnumInNestedNS B = EnumInNestedNS._(1);
    75  static const EnumInNestedNS C = EnumInNestedNS._(2);
    76  static const Map<int, EnumInNestedNS> values = {
    77    0: A,
    78    1: B,
    79    2: C};
    80
    81  static const fb.Reader<EnumInNestedNS> reader = _EnumInNestedNSReader();
    82
    83  @override
    84  String toString() {
    85    return 'EnumInNestedNS{value: $value}';
    86  }
    87}
    88
    89class _EnumInNestedNSReader extends fb.Reader<EnumInNestedNS> {
    90  const _EnumInNestedNSReader();
    91
    92  @override
    93  int get size => 1;
    94
    95  @override
    96  EnumInNestedNS read(fb.BufferContext bc, int offset) =>
    97      EnumInNestedNS.fromValue(const fb.Int8Reader().read(bc, offset));
    98}
    99
   100class TableInNestedNS {
   101  TableInNestedNS._(this._bc, this._bcOffset);
   102  factory TableInNestedNS(List<int> bytes) {
   103    final rootRef = fb.BufferContext.fromBytes(bytes);
   104    return reader.read(rootRef, 0);
   105  }
   106
   107  static const fb.Reader<TableInNestedNS> reader = _TableInNestedNSReader();
   108
   109  final fb.BufferContext _bc;
   110  final int _bcOffset;
   111
   112  int get foo => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0);
   113
   114  @override
   115  String toString() {
   116    return 'TableInNestedNS{foo: $foo}';
   117  }
   118
   119  TableInNestedNST unpack() => TableInNestedNST(
   120      foo: foo);
   121
   122  static int pack(fb.Builder fbBuilder, TableInNestedNST? object) {
   123    if (object == null) return 0;
   124    return object.pack(fbBuilder);
   125  }
   126}
   127
   128class TableInNestedNST implements fb.Packable {
   129  int foo;
   130
   131  TableInNestedNST({
   132      this.foo = 0});
   133
   134  @override
   135  int pack(fb.Builder fbBuilder) {
   136    fbBuilder.startTable(1);
   137    fbBuilder.addInt32(0, foo);
   138    return fbBuilder.endTable();
   139  }
   140
   141  @override
   142  String toString() {
   143    return 'TableInNestedNST{foo: $foo}';
   144  }
   145}
   146
   147class _TableInNestedNSReader extends fb.TableReader<TableInNestedNS> {
   148  const _TableInNestedNSReader();
   149
   150  @override
   151  TableInNestedNS createObject(fb.BufferContext bc, int offset) => 
   152    TableInNestedNS._(bc, offset);
   153}
   154
   155class TableInNestedNSBuilder {
   156  TableInNestedNSBuilder(this.fbBuilder);
   157
   158  final fb.Builder fbBuilder;
   159
   160  void begin() {
   161    fbBuilder.startTable(1);
   162  }
   163
   164  int addFoo(int? foo) {
   165    fbBuilder.addInt32(0, foo);
   166    return fbBuilder.offset;
   167  }
   168
   169  int finish() {
   170    return fbBuilder.endTable();
   171  }
   172}
   173
   174class TableInNestedNSObjectBuilder extends fb.ObjectBuilder {
   175  final int? _foo;
   176
   177  TableInNestedNSObjectBuilder({
   178    int? foo,
   179  })
   180      : _foo = foo;
   181
   182  /// Finish building, and store into the [fbBuilder].
   183  @override
   184  int finish(fb.Builder fbBuilder) {
   185    fbBuilder.startTable(1);
   186    fbBuilder.addInt32(0, _foo);
   187    return fbBuilder.endTable();
   188  }
   189
   190  /// Convenience method to serialize to byte list.
   191  @override
   192  Uint8List toBytes([String? fileIdentifier]) {
   193    final fbBuilder = fb.Builder(deduplicateTables: false);
   194    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
   195    return fbBuilder.buffer;
   196  }
   197}
   198class StructInNestedNS {
   199  StructInNestedNS._(this._bc, this._bcOffset);
   200
   201  static const fb.Reader<StructInNestedNS> reader = _StructInNestedNSReader();
   202
   203  final fb.BufferContext _bc;
   204  final int _bcOffset;
   205
   206  int get a => const fb.Int32Reader().read(_bc, _bcOffset + 0);
   207  int get b => const fb.Int32Reader().read(_bc, _bcOffset + 4);
   208
   209  @override
   210  String toString() {
   211    return 'StructInNestedNS{a: $a, b: $b}';
   212  }
   213
   214  StructInNestedNST unpack() => StructInNestedNST(
   215      a: a,
   216      b: b);
   217
   218  static int pack(fb.Builder fbBuilder, StructInNestedNST? object) {
   219    if (object == null) return 0;
   220    return object.pack(fbBuilder);
   221  }
   222}
   223
   224class StructInNestedNST implements fb.Packable {
   225  int a;
   226  int b;
   227
   228  StructInNestedNST({
   229      required this.a,
   230      required this.b});
   231
   232  @override
   233  int pack(fb.Builder fbBuilder) {
   234    fbBuilder.putInt32(b);
   235    fbBuilder.putInt32(a);
   236    return fbBuilder.offset;
   237  }
   238
   239  @override
   240  String toString() {
   241    return 'StructInNestedNST{a: $a, b: $b}';
   242  }
   243}
   244
   245class _StructInNestedNSReader extends fb.StructReader<StructInNestedNS> {
   246  const _StructInNestedNSReader();
   247
   248  @override
   249  int get size => 8;
   250
   251  @override
   252  StructInNestedNS createObject(fb.BufferContext bc, int offset) => 
   253    StructInNestedNS._(bc, offset);
   254}
   255
   256class StructInNestedNSBuilder {
   257  StructInNestedNSBuilder(this.fbBuilder);
   258
   259  final fb.Builder fbBuilder;
   260
   261  int finish(int a, int b) {
   262    fbBuilder.putInt32(b);
   263    fbBuilder.putInt32(a);
   264    return fbBuilder.offset;
   265  }
   266
   267}
   268
   269class StructInNestedNSObjectBuilder extends fb.ObjectBuilder {
   270  final int _a;
   271  final int _b;
   272
   273  StructInNestedNSObjectBuilder({
   274    required int a,
   275    required int b,
   276  })
   277      : _a = a,
   278        _b = b;
   279
   280  /// Finish building, and store into the [fbBuilder].
   281  @override
   282  int finish(fb.Builder fbBuilder) {
   283    fbBuilder.putInt32(_b);
   284    fbBuilder.putInt32(_a);
   285    return fbBuilder.offset;
   286  }
   287
   288  /// Convenience method to serialize to byte list.
   289  @override
   290  Uint8List toBytes([String? fileIdentifier]) {
   291    final fbBuilder = fb.Builder(deduplicateTables: false);
   292    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
   293    return fbBuilder.buffer;
   294  }
   295}

View as plain text