summaryrefslogtreecommitdiff
path: root/dart
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-05-10 11:35:00 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2021-05-10 11:35:00 -0700
commit5c01ad387f8a2c399dcbe53cf2bb4585a1ca3c0b (patch)
treeb38abcb463ea3b57762901bfb6295e2b4903b5bd /dart
parent42ca1b9140e46ab1b13e3db08b405af79626b48b (diff)
downloadflatbuffers-5c01ad387f8a2c399dcbe53cf2bb4585a1ca3c0b.tar.gz
flatbuffers-5c01ad387f8a2c399dcbe53cf2bb4585a1ca3c0b.tar.bz2
flatbuffers-5c01ad387f8a2c399dcbe53cf2bb4585a1ca3c0b.zip
Dart generated code update
Change-Id: I317d731d17d733088cad608364b614bff8151c36
Diffstat (limited to 'dart')
-rw-r--r--dart/test/monster_test_my_game.example_generated.dart97
1 files changed, 95 insertions, 2 deletions
diff --git a/dart/test/monster_test_my_game.example_generated.dart b/dart/test/monster_test_my_game.example_generated.dart
index f9305f7c..4a5f5c99 100644
--- a/dart/test/monster_test_my_game.example_generated.dart
+++ b/dart/test/monster_test_my_game.example_generated.dart
@@ -544,6 +544,85 @@ class AbilityObjectBuilder extends fb.ObjectBuilder {
return fbBuilder.finish(offset, fileIdentifier);
}
}
+class StructOfStructs {
+ StructOfStructs._(this._bc, this._bcOffset);
+
+ static const fb.Reader<StructOfStructs> reader = const _StructOfStructsReader();
+
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ Ability get a => Ability.reader.read(_bc, _bcOffset + 0);
+ Test get b => Test.reader.read(_bc, _bcOffset + 8);
+ Ability get c => Ability.reader.read(_bc, _bcOffset + 12);
+
+ @override
+ String toString() {
+ return 'StructOfStructs{a: $a, b: $b, c: $c}';
+ }
+}
+
+class _StructOfStructsReader extends fb.StructReader<StructOfStructs> {
+ const _StructOfStructsReader();
+
+ @override
+ int get size => 20;
+
+ @override
+ StructOfStructs createObject(fb.BufferContext bc, int offset) =>
+ new StructOfStructs._(bc, offset);
+}
+
+class StructOfStructsBuilder {
+ StructOfStructsBuilder(this.fbBuilder) {
+ assert(fbBuilder != null);
+ }
+
+ final fb.Builder fbBuilder;
+
+ int finish(fb.StructBuilder a, fb.StructBuilder b, fb.StructBuilder c) {
+ c();
+ b();
+ a();
+ return fbBuilder.offset;
+ }
+
+}
+
+class StructOfStructsObjectBuilder extends fb.ObjectBuilder {
+ final AbilityObjectBuilder _a;
+ final TestObjectBuilder _b;
+ final AbilityObjectBuilder _c;
+
+ StructOfStructsObjectBuilder({
+ AbilityObjectBuilder a,
+ TestObjectBuilder b,
+ AbilityObjectBuilder c,
+ })
+ : _a = a,
+ _b = b,
+ _c = c;
+
+ /// Finish building, and store into the [fbBuilder].
+ @override
+ int finish(
+ fb.Builder fbBuilder) {
+ assert(fbBuilder != null);
+
+ _c.finish(fbBuilder);
+ _b.finish(fbBuilder);
+ _a.finish(fbBuilder);
+ return fbBuilder.offset;
+ }
+
+ /// 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 Stat {
Stat._(this._bc, this._bcOffset);
factory Stat(List<int> bytes) {
@@ -802,10 +881,11 @@ class Monster {
List<Color> get vectorOfEnums => const fb.ListReader<Color>(Color.reader).vTableGet(_bc, _bcOffset, 98, null);
Race get signedEnum => new Race.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 100, -1));
List<int> get testrequirednestedflatbuffer => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 102, null);
+ List<Stat> get scalarKeySortedTables => const fb.ListReader<Stat>(Stat.reader).vTableGet(_bc, _bcOffset, 104, null);
@override
String toString() {
- return 'Monster{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer}';
+ return 'Monster{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer, scalarKeySortedTables: $scalarKeySortedTables}';
}
}
@@ -1024,6 +1104,10 @@ class MonsterBuilder {
fbBuilder.addOffset(49, offset);
return fbBuilder.offset;
}
+ int addScalarKeySortedTablesOffset(int offset) {
+ fbBuilder.addOffset(50, offset);
+ return fbBuilder.offset;
+ }
int finish() {
return fbBuilder.endTable();
@@ -1080,6 +1164,7 @@ class MonsterObjectBuilder extends fb.ObjectBuilder {
final List<Color> _vectorOfEnums;
final Race _signedEnum;
final List<int> _testrequirednestedflatbuffer;
+ final List<StatObjectBuilder> _scalarKeySortedTables;
MonsterObjectBuilder({
Vec3ObjectBuilder pos,
@@ -1131,6 +1216,7 @@ class MonsterObjectBuilder extends fb.ObjectBuilder {
List<Color> vectorOfEnums,
Race signedEnum,
List<int> testrequirednestedflatbuffer,
+ List<StatObjectBuilder> scalarKeySortedTables,
})
: _pos = pos,
_mana = mana,
@@ -1180,7 +1266,8 @@ class MonsterObjectBuilder extends fb.ObjectBuilder {
_anyAmbiguous = anyAmbiguous,
_vectorOfEnums = vectorOfEnums,
_signedEnum = signedEnum,
- _testrequirednestedflatbuffer = testrequirednestedflatbuffer;
+ _testrequirednestedflatbuffer = testrequirednestedflatbuffer,
+ _scalarKeySortedTables = scalarKeySortedTables;
/// Finish building, and store into the [fbBuilder].
@override
@@ -1251,6 +1338,9 @@ class MonsterObjectBuilder extends fb.ObjectBuilder {
final int testrequirednestedflatbufferOffset = _testrequirednestedflatbuffer?.isNotEmpty == true
? fbBuilder.writeListUint8(_testrequirednestedflatbuffer)
: null;
+ final int scalarKeySortedTablesOffset = _scalarKeySortedTables?.isNotEmpty == true
+ ? fbBuilder.writeList(_scalarKeySortedTables.map((b) => b.getOrCreateOffset(fbBuilder)).toList())
+ : null;
fbBuilder.startTable();
if (_pos != null) {
@@ -1356,6 +1446,9 @@ class MonsterObjectBuilder extends fb.ObjectBuilder {
if (testrequirednestedflatbufferOffset != null) {
fbBuilder.addOffset(49, testrequirednestedflatbufferOffset);
}
+ if (scalarKeySortedTablesOffset != null) {
+ fbBuilder.addOffset(50, scalarKeySortedTablesOffset);
+ }
return fbBuilder.endTable();
}