};
struct EnumDef : public Definition {
- EnumDef() : is_union(false), uses_type_aliases(false) {}
+ EnumDef() : is_union(false), uses_multiple_type_instances(false) {}
EnumVal *ReverseLookup(int64_t enum_idx, bool skip_union_default = true) {
for (auto it = vals.vec.begin() +
SymbolTable<EnumVal> vals;
bool is_union;
- bool uses_type_aliases;
+ // Type is a union which uses type aliases where at least one type is
+ // available under two different names.
+ bool uses_multiple_type_instances;
Type underlying_type;
};
}
// Generate type traits for unions to map from a type to union enum value.
- if (enum_def.is_union && !enum_def.uses_type_aliases) {
+ if (enum_def.is_union && !enum_def.uses_multiple_type_instances) {
for (auto it = enum_def.vals.vec.begin(); it != enum_def.vals.vec.end();
++it) {
const auto &ev = **it;
code_ += "";
code_ += " void Reset();";
code_ += "";
- if (!enum_def.uses_type_aliases) {
+ if (!enum_def.uses_multiple_type_instances) {
code_ += "#ifndef FLATBUFFERS_CPP98_STL";
code_ += " template <typename T>";
code_ += " void Set(T&& val) {";
if (field.value.type.base_type == BASE_TYPE_UNION) {
auto u = field.value.type.enum_def;
- code_ +=
- " template<typename T> "
- "const T *{{NULLABLE_EXT}}{{FIELD_NAME}}_as() const;";
+ if (!field.value.type.enum_def->uses_multiple_type_instances)
+ code_ +=
+ " template<typename T> "
+ "const T *{{NULLABLE_EXT}}{{FIELD_NAME}}_as() const;";
for (auto u_it = u->vals.vec.begin(); u_it != u->vals.vec.end();
++u_it) {
}
auto u = field.value.type.enum_def;
- if (u->uses_type_aliases) continue;
+ if (u->uses_multiple_type_instances) continue;
code_.SetValue("FIELD_NAME", Name(field));
}
auto u = field.value.type.enum_def;
- if (u->uses_type_aliases) continue;
code_.SetValue("FIELD_NAME", Name(field));
ECHECK(ParseMetaData(&enum_def->attributes));
EXPECT('{');
if (is_union) enum_def->vals.Add("NONE", new EnumVal("NONE", 0));
+ std::set<std::pair<BaseType, StructDef*>> union_types;
for (;;) {
if (opts.proto_mode && attribute_ == "option") {
ECHECK(ParseProtoOption());
if (ev.union_type.base_type != BASE_TYPE_STRUCT &&
ev.union_type.base_type != BASE_TYPE_STRING)
return Error("union value type may only be table/struct/string");
- enum_def->uses_type_aliases = true;
} else {
ev.union_type = Type(BASE_TYPE_STRUCT, LookupCreateStruct(full_name));
}
+ if (!enum_def->uses_multiple_type_instances) {
+ auto union_type_key = std::make_pair(ev.union_type.base_type, ev.union_type.struct_def);
+ if (union_types.count(union_type_key) > 0) {
+ enum_def->uses_multiple_type_instances = true;
+ } else {
+ union_types.insert(union_type_key);
+ }
+ }
}
if (Is('=')) {
NEXT();
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Compile Include="..\MyGame\Example\Any.cs">
<Link>MyGame\Example\Any.cs</Link>
</Compile>
+ <Compile Include="..\MyGame\Example\AnyAmbiguousAliases.cs">
+ <Link>MyGame\Example\AnyAmbiguousAliases.cs</Link>
+ </Compile>
+ <Compile Include="..\MyGame\Example\AnyUniqueAliases.cs">
+ <Link>MyGame\Example\AnyUniqueAliases.cs</Link>
+ </Compile>
<Compile Include="..\MyGame\Example\Color.cs">
<Link>MyGame\Example\Color.cs</Link>
</Compile>
<Target Name="AfterBuild">
</Target>
-->
-</Project>
\ No newline at end of file
+</Project>
--- /dev/null
+// <auto-generated>
+// automatically generated by the FlatBuffers compiler, do not modify
+// </auto-generated>
+
+namespace MyGame.Example
+{
+
+public enum AnyAmbiguousAliases : byte
+{
+ NONE = 0,
+ M1 = 1,
+ M2 = 2,
+ M3 = 3,
+};
+
+
+}
--- /dev/null
+// Code generated by the FlatBuffers compiler. DO NOT EDIT.
+
+package Example
+
+type AnyAmbiguousAliases = byte
+const (
+ AnyAmbiguousAliasesNONE AnyAmbiguousAliases = 0
+ AnyAmbiguousAliasesM1 AnyAmbiguousAliases = 1
+ AnyAmbiguousAliasesM2 AnyAmbiguousAliases = 2
+ AnyAmbiguousAliasesM3 AnyAmbiguousAliases = 3
+)
+
+var EnumNamesAnyAmbiguousAliases = map[AnyAmbiguousAliases]string{
+ AnyAmbiguousAliasesNONE:"NONE",
+ AnyAmbiguousAliasesM1:"M1",
+ AnyAmbiguousAliasesM2:"M2",
+ AnyAmbiguousAliasesM3:"M3",
+}
+
--- /dev/null
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package MyGame.Example;
+
+
+@javax.annotation.Generated(value="flatc")
+public final class AnyAmbiguousAliases {
+ private AnyAmbiguousAliases() { }
+ public static final byte NONE = 0;
+ public static final byte M1 = 1;
+ public static final byte M2 = 2;
+ public static final byte M3 = 3;
+
+ public static final String[] names = { "NONE", "M1", "M2", "M3", };
+
+ public static String name(int e) { return names[e]; }
+}
+
--- /dev/null
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: Example
+
+local AnyAmbiguousAliases = {
+ NONE = 0,
+ M1 = 1,
+ M2 = 2,
+ M3 = 3,
+}
+
+return AnyAmbiguousAliases -- return the module
\ No newline at end of file
--- /dev/null
+<?php
+// automatically generated by the FlatBuffers compiler, do not modify
+
+namespace MyGame\Example;
+
+class AnyAmbiguousAliases
+{
+ const NONE = 0;
+ const M1 = 1;
+ const M2 = 2;
+ const M3 = 3;
+
+ private static $names = array(
+ "NONE",
+ "M1",
+ "M2",
+ "M3",
+ );
+
+ public static function Name($e)
+ {
+ if (!isset(self::$names[$e])) {
+ throw new \Exception();
+ }
+ return self::$names[$e];
+ }
+}
--- /dev/null
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: Example
+
+class AnyAmbiguousAliases(object):
+ NONE = 0
+ M1 = 1
+ M2 = 2
+ M3 = 3
+
--- /dev/null
+// <auto-generated>
+// automatically generated by the FlatBuffers compiler, do not modify
+// </auto-generated>
+
+namespace MyGame.Example
+{
+
+public enum AnyUniqueAliases : byte
+{
+ NONE = 0,
+ M = 1,
+ T = 2,
+ M2 = 3,
+};
+
+
+}
--- /dev/null
+// Code generated by the FlatBuffers compiler. DO NOT EDIT.
+
+package Example
+
+type AnyUniqueAliases = byte
+const (
+ AnyUniqueAliasesNONE AnyUniqueAliases = 0
+ AnyUniqueAliasesM AnyUniqueAliases = 1
+ AnyUniqueAliasesT AnyUniqueAliases = 2
+ AnyUniqueAliasesM2 AnyUniqueAliases = 3
+)
+
+var EnumNamesAnyUniqueAliases = map[AnyUniqueAliases]string{
+ AnyUniqueAliasesNONE:"NONE",
+ AnyUniqueAliasesM:"M",
+ AnyUniqueAliasesT:"T",
+ AnyUniqueAliasesM2:"M2",
+}
+
--- /dev/null
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package MyGame.Example;
+
+
+@javax.annotation.Generated(value="flatc")
+public final class AnyUniqueAliases {
+ private AnyUniqueAliases() { }
+ public static final byte NONE = 0;
+ public static final byte M = 1;
+ public static final byte T = 2;
+ public static final byte M2 = 3;
+
+ public static final String[] names = { "NONE", "M", "T", "M2", };
+
+ public static String name(int e) { return names[e]; }
+}
+
--- /dev/null
+-- automatically generated by the FlatBuffers compiler, do not modify
+
+-- namespace: Example
+
+local AnyUniqueAliases = {
+ NONE = 0,
+ M = 1,
+ T = 2,
+ M2 = 3,
+}
+
+return AnyUniqueAliases -- return the module
\ No newline at end of file
--- /dev/null
+<?php
+// automatically generated by the FlatBuffers compiler, do not modify
+
+namespace MyGame\Example;
+
+class AnyUniqueAliases
+{
+ const NONE = 0;
+ const M = 1;
+ const T = 2;
+ const M2 = 3;
+
+ private static $names = array(
+ "NONE",
+ "M",
+ "T",
+ "M2",
+ );
+
+ public static function Name($e)
+ {
+ if (!isset(self::$names[$e])) {
+ throw new \Exception();
+ }
+ return self::$names[$e];
+ }
+}
--- /dev/null
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: Example
+
+class AnyUniqueAliases(object):
+ NONE = 0
+ M = 1
+ T = 2
+ M2 = 3
+
#endif
public ulong[] GetVectorOfNonOwningReferencesArray() { return __p.__vector_as_array<ulong>(88); }
public bool MutateVectorOfNonOwningReferences(int j, ulong vector_of_non_owning_references) { int o = __p.__offset(88); if (o != 0) { __p.bb.PutUlong(__p.__vector(o) + j * 8, vector_of_non_owning_references); return true; } else { return false; } }
+ public AnyUniqueAliases AnyUniqueType { get { int o = __p.__offset(90); return o != 0 ? (AnyUniqueAliases)__p.bb.Get(o + __p.bb_pos) : AnyUniqueAliases.NONE; } }
+ public bool MutateAnyUniqueType(AnyUniqueAliases any_unique_type) { int o = __p.__offset(90); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)any_unique_type); return true; } else { return false; } }
+ public TTable? AnyUnique<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(92); return o != 0 ? (TTable?)__p.__union<TTable>(o) : null; }
+ public AnyAmbiguousAliases AnyAmbiguousType { get { int o = __p.__offset(94); return o != 0 ? (AnyAmbiguousAliases)__p.bb.Get(o + __p.bb_pos) : AnyAmbiguousAliases.NONE; } }
+ public bool MutateAnyAmbiguousType(AnyAmbiguousAliases any_ambiguous_type) { int o = __p.__offset(94); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)any_ambiguous_type); return true; } else { return false; } }
+ public TTable? AnyAmbiguous<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(96); return o != 0 ? (TTable?)__p.__union<TTable>(o) : null; }
- public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(43); }
+ public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(47); }
public static void AddPos(FlatBufferBuilder builder, Offset<Vec3> posOffset) { builder.AddStruct(0, posOffset.Value, 0); }
public static void AddMana(FlatBufferBuilder builder, short mana) { builder.AddShort(1, mana, 150); }
public static void AddHp(FlatBufferBuilder builder, short hp) { builder.AddShort(2, hp, 100); }
public static VectorOffset CreateVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddUlong(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfNonOwningReferencesVectorBlock(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
public static void StartVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
+ public static void AddAnyUniqueType(FlatBufferBuilder builder, AnyUniqueAliases anyUniqueType) { builder.AddByte(43, (byte)anyUniqueType, 0); }
+ public static void AddAnyUnique(FlatBufferBuilder builder, int anyUniqueOffset) { builder.AddOffset(44, anyUniqueOffset, 0); }
+ public static void AddAnyAmbiguousType(FlatBufferBuilder builder, AnyAmbiguousAliases anyAmbiguousType) { builder.AddByte(45, (byte)anyAmbiguousType, 0); }
+ public static void AddAnyAmbiguous(FlatBufferBuilder builder, int anyAmbiguousOffset) { builder.AddOffset(46, anyAmbiguousOffset, 0); }
public static Offset<Monster> EndMonster(FlatBufferBuilder builder) {
int o = builder.EndObject();
builder.Required(o, 10); // name
return 0
}
+func (rcv *Monster) AnyUniqueType() byte {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(90))
+ if o != 0 {
+ return rcv._tab.GetByte(o + rcv._tab.Pos)
+ }
+ return 0
+}
+
+func (rcv *Monster) MutateAnyUniqueType(n byte) bool {
+ return rcv._tab.MutateByteSlot(90, n)
+}
+
+func (rcv *Monster) AnyUnique(obj *flatbuffers.Table) bool {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(92))
+ if o != 0 {
+ rcv._tab.Union(obj, o)
+ return true
+ }
+ return false
+}
+
+func (rcv *Monster) AnyAmbiguousType() byte {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(94))
+ if o != 0 {
+ return rcv._tab.GetByte(o + rcv._tab.Pos)
+ }
+ return 0
+}
+
+func (rcv *Monster) MutateAnyAmbiguousType(n byte) bool {
+ return rcv._tab.MutateByteSlot(94, n)
+}
+
+func (rcv *Monster) AnyAmbiguous(obj *flatbuffers.Table) bool {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(96))
+ if o != 0 {
+ rcv._tab.Union(obj, o)
+ return true
+ }
+ return false
+}
+
func MonsterStart(builder *flatbuffers.Builder) {
- builder.StartObject(43)
+ builder.StartObject(47)
}
func MonsterAddPos(builder *flatbuffers.Builder, pos flatbuffers.UOffsetT) {
builder.PrependStructSlot(0, flatbuffers.UOffsetT(pos), 0)
func MonsterStartVectorOfNonOwningReferencesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(8, numElems, 8)
}
+func MonsterAddAnyUniqueType(builder *flatbuffers.Builder, anyUniqueType byte) {
+ builder.PrependByteSlot(43, anyUniqueType, 0)
+}
+func MonsterAddAnyUnique(builder *flatbuffers.Builder, anyUnique flatbuffers.UOffsetT) {
+ builder.PrependUOffsetTSlot(44, flatbuffers.UOffsetT(anyUnique), 0)
+}
+func MonsterAddAnyAmbiguousType(builder *flatbuffers.Builder, anyAmbiguousType byte) {
+ builder.PrependByteSlot(45, anyAmbiguousType, 0)
+}
+func MonsterAddAnyAmbiguous(builder *flatbuffers.Builder, anyAmbiguous flatbuffers.UOffsetT) {
+ builder.PrependUOffsetTSlot(46, flatbuffers.UOffsetT(anyAmbiguous), 0)
+}
func MonsterEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}
public ByteBuffer vectorOfNonOwningReferencesAsByteBuffer() { return __vector_as_bytebuffer(88, 8); }
public ByteBuffer vectorOfNonOwningReferencesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 88, 8); }
public boolean mutateVectorOfNonOwningReferences(int j, long vector_of_non_owning_references) { int o = __offset(88); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_non_owning_references); return true; } else { return false; } }
+ public byte anyUniqueType() { int o = __offset(90); return o != 0 ? bb.get(o + bb_pos) : 0; }
+ public boolean mutateAnyUniqueType(byte any_unique_type) { int o = __offset(90); if (o != 0) { bb.put(o + bb_pos, any_unique_type); return true; } else { return false; } }
+ public Table anyUnique(Table obj) { int o = __offset(92); return o != 0 ? __union(obj, o) : null; }
+ public byte anyAmbiguousType() { int o = __offset(94); return o != 0 ? bb.get(o + bb_pos) : 0; }
+ public boolean mutateAnyAmbiguousType(byte any_ambiguous_type) { int o = __offset(94); if (o != 0) { bb.put(o + bb_pos, any_ambiguous_type); return true; } else { return false; } }
+ public Table anyAmbiguous(Table obj) { int o = __offset(96); return o != 0 ? __union(obj, o) : null; }
- public static void startMonster(FlatBufferBuilder builder) { builder.startObject(43); }
+ public static void startMonster(FlatBufferBuilder builder) { builder.startObject(47); }
public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); }
public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); }
public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); }
public static void addVectorOfNonOwningReferences(FlatBufferBuilder builder, int vectorOfNonOwningReferencesOffset) { builder.addOffset(42, vectorOfNonOwningReferencesOffset, 0); }
public static int createVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
public static void startVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
+ public static void addAnyUniqueType(FlatBufferBuilder builder, byte anyUniqueType) { builder.addByte(43, anyUniqueType, 0); }
+ public static void addAnyUnique(FlatBufferBuilder builder, int anyUniqueOffset) { builder.addOffset(44, anyUniqueOffset, 0); }
+ public static void addAnyAmbiguousType(FlatBufferBuilder builder, byte anyAmbiguousType) { builder.addByte(45, anyAmbiguousType, 0); }
+ public static void addAnyAmbiguous(FlatBufferBuilder builder, int anyAmbiguousOffset) { builder.addOffset(46, anyAmbiguousOffset, 0); }
public static int endMonster(FlatBufferBuilder builder) {
int o = builder.endObject();
builder.required(o, 10); // name
end
return 0
end
-function Monster.Start(builder) builder:StartObject(43) end
+function Monster_mt:AnyUniqueType()
+ local o = self.view:Offset(90)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
+ end
+ return 0
+end
+function Monster_mt:AnyUnique()
+ local o = self.view:Offset(92)
+ if o ~= 0 then
+ local obj = flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0)
+ self.view:Union(obj, o)
+ return obj
+ end
+end
+function Monster_mt:AnyAmbiguousType()
+ local o = self.view:Offset(94)
+ if o ~= 0 then
+ return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
+ end
+ return 0
+end
+function Monster_mt:AnyAmbiguous()
+ local o = self.view:Offset(96)
+ if o ~= 0 then
+ local obj = flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0)
+ self.view:Union(obj, o)
+ return obj
+ end
+end
+function Monster.Start(builder) builder:StartObject(47) end
function Monster.AddPos(builder, pos) builder:PrependStructSlot(0, pos, 0) end
function Monster.AddMana(builder, mana) builder:PrependInt16Slot(1, mana, 150) end
function Monster.AddHp(builder, hp) builder:PrependInt16Slot(2, hp, 100) end
function Monster.AddNonOwningReference(builder, nonOwningReference) builder:PrependUint64Slot(41, nonOwningReference, 0) end
function Monster.AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences) builder:PrependUOffsetTRelativeSlot(42, vectorOfNonOwningReferences, 0) end
function Monster.StartVectorOfNonOwningReferencesVector(builder, numElems) return builder:StartVector(8, numElems, 8) end
+function Monster.AddAnyUniqueType(builder, anyUniqueType) builder:PrependUint8Slot(43, anyUniqueType, 0) end
+function Monster.AddAnyUnique(builder, anyUnique) builder:PrependUOffsetTRelativeSlot(44, anyUnique, 0) end
+function Monster.AddAnyAmbiguousType(builder, anyAmbiguousType) builder:PrependUint8Slot(45, anyAmbiguousType, 0) end
+function Monster.AddAnyAmbiguous(builder, anyAmbiguous) builder:PrependUOffsetTRelativeSlot(46, anyAmbiguous, 0) end
function Monster.End(builder) return builder:EndObject() end
return Monster -- return the module
\ No newline at end of file
}
/**
+ * @return byte
+ */
+ public function getAnyUniqueType()
+ {
+ $o = $this->__offset(90);
+ return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \MyGame\Example\AnyUniqueAliases::NONE;
+ }
+
+ /**
+ * @returnint
+ */
+ public function getAnyUnique($obj)
+ {
+ $o = $this->__offset(92);
+ return $o != 0 ? $this->__union($obj, $o) : null;
+ }
+
+ /**
+ * @return byte
+ */
+ public function getAnyAmbiguousType()
+ {
+ $o = $this->__offset(94);
+ return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \MyGame\Example\AnyAmbiguousAliases::NONE;
+ }
+
+ /**
+ * @returnint
+ */
+ public function getAnyAmbiguous($obj)
+ {
+ $o = $this->__offset(96);
+ return $o != 0 ? $this->__union($obj, $o) : null;
+ }
+
+ /**
* @param FlatBufferBuilder $builder
* @return void
*/
public static function startMonster(FlatBufferBuilder $builder)
{
- $builder->StartObject(43);
+ $builder->StartObject(47);
}
/**
* @param FlatBufferBuilder $builder
* @return Monster
*/
- public static function createMonster(FlatBufferBuilder $builder, $pos, $mana, $hp, $name, $inventory, $color, $test_type, $test, $test4, $testarrayofstring, $testarrayoftables, $enemy, $testnestedflatbuffer, $testempty, $testbool, $testhashs32_fnv1, $testhashu32_fnv1, $testhashs64_fnv1, $testhashu64_fnv1, $testhashs32_fnv1a, $testhashu32_fnv1a, $testhashs64_fnv1a, $testhashu64_fnv1a, $testarrayofbools, $testf, $testf2, $testf3, $testarrayofstring2, $testarrayofsortedstruct, $flex, $test5, $vector_of_longs, $vector_of_doubles, $parent_namespace_test, $vector_of_referrables, $single_weak_reference, $vector_of_weak_references, $vector_of_strong_referrables, $co_owning_reference, $vector_of_co_owning_references, $non_owning_reference, $vector_of_non_owning_references)
+ public static function createMonster(FlatBufferBuilder $builder, $pos, $mana, $hp, $name, $inventory, $color, $test_type, $test, $test4, $testarrayofstring, $testarrayoftables, $enemy, $testnestedflatbuffer, $testempty, $testbool, $testhashs32_fnv1, $testhashu32_fnv1, $testhashs64_fnv1, $testhashu64_fnv1, $testhashs32_fnv1a, $testhashu32_fnv1a, $testhashs64_fnv1a, $testhashu64_fnv1a, $testarrayofbools, $testf, $testf2, $testf3, $testarrayofstring2, $testarrayofsortedstruct, $flex, $test5, $vector_of_longs, $vector_of_doubles, $parent_namespace_test, $vector_of_referrables, $single_weak_reference, $vector_of_weak_references, $vector_of_strong_referrables, $co_owning_reference, $vector_of_co_owning_references, $non_owning_reference, $vector_of_non_owning_references, $any_unique_type, $any_unique, $any_ambiguous_type, $any_ambiguous)
{
- $builder->startObject(43);
+ $builder->startObject(47);
self::addPos($builder, $pos);
self::addMana($builder, $mana);
self::addHp($builder, $hp);
self::addVectorOfCoOwningReferences($builder, $vector_of_co_owning_references);
self::addNonOwningReference($builder, $non_owning_reference);
self::addVectorOfNonOwningReferences($builder, $vector_of_non_owning_references);
+ self::addAnyUniqueType($builder, $any_unique_type);
+ self::addAnyUnique($builder, $any_unique);
+ self::addAnyAmbiguousType($builder, $any_ambiguous_type);
+ self::addAnyAmbiguous($builder, $any_ambiguous);
$o = $builder->endObject();
$builder->required($o, 10); // name
return $o;
/**
* @param FlatBufferBuilder $builder
+ * @param byte
+ * @return void
+ */
+ public static function addAnyUniqueType(FlatBufferBuilder $builder, $anyUniqueType)
+ {
+ $builder->addByteX(43, $anyUniqueType, 0);
+ }
+
+ public static function addAnyUnique(FlatBufferBuilder $builder, $offset)
+ {
+ $builder->addOffsetX(44, $offset, 0);
+ }
+
+ /**
+ * @param FlatBufferBuilder $builder
+ * @param byte
+ * @return void
+ */
+ public static function addAnyAmbiguousType(FlatBufferBuilder $builder, $anyAmbiguousType)
+ {
+ $builder->addByteX(45, $anyAmbiguousType, 0);
+ }
+
+ public static function addAnyAmbiguous(FlatBufferBuilder $builder, $offset)
+ {
+ $builder->addOffsetX(46, $offset, 0);
+ }
+
+ /**
+ * @param FlatBufferBuilder $builder
* @return int table offset
*/
public static function endMonster(FlatBufferBuilder $builder)
return self._tab.VectorLen(o)
return 0
-def MonsterStart(builder): builder.StartObject(43)
+ # Monster
+ def AnyUniqueType(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(90))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def AnyUnique(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(92))
+ if o != 0:
+ from flatbuffers.table import Table
+ obj = Table(bytearray(), 0)
+ self._tab.Union(obj, o)
+ return obj
+ return None
+
+ # Monster
+ def AnyAmbiguousType(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(94))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def AnyAmbiguous(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(96))
+ if o != 0:
+ from flatbuffers.table import Table
+ obj = Table(bytearray(), 0)
+ self._tab.Union(obj, o)
+ return obj
+ return None
+
+def MonsterStart(builder): builder.StartObject(47)
def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
def MonsterAddNonOwningReference(builder, nonOwningReference): builder.PrependUint64Slot(41, nonOwningReference, 0)
def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0)
def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterAddAnyUniqueType(builder, anyUniqueType): builder.PrependUint8Slot(43, anyUniqueType, 0)
+def MonsterAddAnyUnique(builder, anyUnique): builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0)
+def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): builder.PrependUint8Slot(45, anyAmbiguousType, 0)
+def MonsterAddAnyAmbiguous(builder, anyAmbiguous): builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0)
def MonsterEnd(builder): return builder.EndObject()
union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
+union AnyUniqueAliases { M: Monster, T: TestSimpleTableWithEnum, M2: MyGame.Example2.Monster }
+union AnyAmbiguousAliases { M1: Monster, M2: Monster, M3: Monster }
+
struct Test { a:short; b:byte; }
table TestSimpleTableWithEnum (csharp_partial, private) {
vector_of_co_owning_references:[ulong](id:40, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"default_ptr_type", cpp_ptr_type_get:".get()"); //was shared_ptr
non_owning_reference:ulong(id:41, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
vector_of_non_owning_references:[ulong](id:42, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
+ any_unique:AnyUniqueAliases(id:44);
+ any_ambiguous:AnyAmbiguousAliases (id:46);
}
table TypeAliases {
"type" : "string",
"enum": ["NONE", "Monster", "TestSimpleTableWithEnum", "MyGame_Example2_Monster"]
},
+ "MyGame_Example_AnyUniqueAliases" : {
+ "type" : "string",
+ "enum": ["NONE", "M", "T", "M2"]
+ },
+ "MyGame_Example_AnyAmbiguousAliases" : {
+ "type" : "string",
+ "enum": ["NONE", "M1", "M2", "M3"]
+ },
"MyGame_OtherNameSpace_Unused" : {
"type" : "object",
"properties" : {
"co_owning_reference" : { "type" : "number" },
"vector_of_co_owning_references" : { "type" : "array", "items" : { "type" : "number" } },
"non_owning_reference" : { "type" : "number" },
- "vector_of_non_owning_references" : { "type" : "array", "items" : { "type" : "number" } }
+ "vector_of_non_owning_references" : { "type" : "array", "items" : { "type" : "number" } },
+ "any_unique_type" : { "$ref" : "#/definitions/MyGame_Example_AnyUniqueAliases" },
+ "any_unique" : { "anyOf": [{ "$ref" : "#/definitions/MyGame_Example_Monster" },{ "$ref" : "#/definitions/MyGame_Example_TestSimpleTableWithEnum" },{ "$ref" : "#/definitions/MyGame_Example2_Monster" }] },
+ "any_ambiguous_type" : { "$ref" : "#/definitions/MyGame_Example_AnyAmbiguousAliases" },
+ "any_ambiguous" : { "anyOf": [{ "$ref" : "#/definitions/MyGame_Example_Monster" },{ "$ref" : "#/definitions/MyGame_Example_Monster" },{ "$ref" : "#/definitions/MyGame_Example_Monster" }] }
},
"required" : ["name"],
"additionalProperties" : false
bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+enum AnyUniqueAliases {
+ AnyUniqueAliases_NONE = 0,
+ AnyUniqueAliases_M = 1,
+ AnyUniqueAliases_T = 2,
+ AnyUniqueAliases_M2 = 3,
+ AnyUniqueAliases_MIN = AnyUniqueAliases_NONE,
+ AnyUniqueAliases_MAX = AnyUniqueAliases_M2
+};
+
+inline const AnyUniqueAliases (&EnumValuesAnyUniqueAliases())[4] {
+ static const AnyUniqueAliases values[] = {
+ AnyUniqueAliases_NONE,
+ AnyUniqueAliases_M,
+ AnyUniqueAliases_T,
+ AnyUniqueAliases_M2
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyUniqueAliases() {
+ static const char * const names[] = {
+ "NONE",
+ "M",
+ "T",
+ "M2",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyUniqueAliases(AnyUniqueAliases e) {
+ if (e < AnyUniqueAliases_NONE || e > AnyUniqueAliases_M2) return "";
+ const size_t index = static_cast<int>(e);
+ return EnumNamesAnyUniqueAliases()[index];
+}
+
+template<typename T> struct AnyUniqueAliasesTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesTraits<Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesTraits<TestSimpleTableWithEnum> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_T;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+struct AnyUniqueAliasesUnion {
+ AnyUniqueAliases type;
+ void *value;
+
+ AnyUniqueAliasesUnion() : type(AnyUniqueAliases_NONE), value(nullptr) {}
+ AnyUniqueAliasesUnion(AnyUniqueAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyUniqueAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &) FLATBUFFERS_NOEXCEPT;
+ AnyUniqueAliasesUnion &operator=(const AnyUniqueAliasesUnion &u) FLATBUFFERS_NOEXCEPT
+ { AnyUniqueAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUniqueAliasesUnion &operator=(AnyUniqueAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUniqueAliasesUnion() { Reset(); }
+
+ void Reset();
+
+#ifndef FLATBUFFERS_CPP98_STL
+ template <typename T>
+ void Set(T&& val) {
+ Reset();
+ type = AnyUniqueAliasesTraits<typename T::TableType>::enum_value;
+ if (type != AnyUniqueAliases_NONE) {
+ value = new T(std::forward<T>(val));
+ }
+ }
+#endif // FLATBUFFERS_CPP98_STL
+
+ static void *UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MonsterT *AsM() {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<MonsterT *>(value) : nullptr;
+ }
+ const MonsterT *AsM() const {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<const MonsterT *>(value) : nullptr;
+ }
+ TestSimpleTableWithEnumT *AsT() {
+ return type == AnyUniqueAliases_T ?
+ reinterpret_cast<TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const TestSimpleTableWithEnumT *AsT() const {
+ return type == AnyUniqueAliases_T ?
+ reinterpret_cast<const TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsM2() {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsM2() const {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ return *(reinterpret_cast<const MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MonsterT *>(rhs.value));
+ }
+ case AnyUniqueAliases_T: {
+ return *(reinterpret_cast<const TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case AnyUniqueAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type);
+bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyAmbiguousAliases {
+ AnyAmbiguousAliases_NONE = 0,
+ AnyAmbiguousAliases_M1 = 1,
+ AnyAmbiguousAliases_M2 = 2,
+ AnyAmbiguousAliases_M3 = 3,
+ AnyAmbiguousAliases_MIN = AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_MAX = AnyAmbiguousAliases_M3
+};
+
+inline const AnyAmbiguousAliases (&EnumValuesAnyAmbiguousAliases())[4] {
+ static const AnyAmbiguousAliases values[] = {
+ AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_M1,
+ AnyAmbiguousAliases_M2,
+ AnyAmbiguousAliases_M3
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyAmbiguousAliases() {
+ static const char * const names[] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyAmbiguousAliases(AnyAmbiguousAliases e) {
+ if (e < AnyAmbiguousAliases_NONE || e > AnyAmbiguousAliases_M3) return "";
+ const size_t index = static_cast<int>(e);
+ return EnumNamesAnyAmbiguousAliases()[index];
+}
+
+struct AnyAmbiguousAliasesUnion {
+ AnyAmbiguousAliases type;
+ void *value;
+
+ AnyAmbiguousAliasesUnion() : type(AnyAmbiguousAliases_NONE), value(nullptr) {}
+ AnyAmbiguousAliasesUnion(AnyAmbiguousAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyAmbiguousAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &) FLATBUFFERS_NOEXCEPT;
+ AnyAmbiguousAliasesUnion &operator=(const AnyAmbiguousAliasesUnion &u) FLATBUFFERS_NOEXCEPT
+ { AnyAmbiguousAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyAmbiguousAliasesUnion &operator=(AnyAmbiguousAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyAmbiguousAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ static void *UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MonsterT *AsM1() {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<MonsterT *>(value) : nullptr;
+ }
+ const MonsterT *AsM1() const {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<const MonsterT *>(value) : nullptr;
+ }
+ MonsterT *AsM2() {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<MonsterT *>(value) : nullptr;
+ }
+ const MonsterT *AsM2() const {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<const MonsterT *>(value) : nullptr;
+ }
+ MonsterT *AsM3() {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<MonsterT *>(value) : nullptr;
+ }
+ const MonsterT *AsM3() const {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<const MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ return *(reinterpret_cast<const MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M2: {
+ return *(reinterpret_cast<const MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M3: {
+ return *(reinterpret_cast<const MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type);
+bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
private:
int16_t a_;
std::vector<flatbuffers::unique_ptr<ReferrableT>> vector_of_co_owning_references;
ReferrableT *non_owning_reference;
std::vector<ReferrableT *> vector_of_non_owning_references;
+ AnyUniqueAliasesUnion any_unique;
+ AnyAmbiguousAliasesUnion any_ambiguous;
MonsterT()
: mana(150),
hp(100),
(lhs.co_owning_reference == rhs.co_owning_reference) &&
(lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
(lhs.non_owning_reference == rhs.non_owning_reference) &&
- (lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references);
+ (lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
+ (lhs.any_unique == rhs.any_unique) &&
+ (lhs.any_ambiguous == rhs.any_ambiguous);
}
/// an example documentation comment: monster object
VT_CO_OWNING_REFERENCE = 82,
VT_VECTOR_OF_CO_OWNING_REFERENCES = 84,
VT_NON_OWNING_REFERENCE = 86,
- VT_VECTOR_OF_NON_OWNING_REFERENCES = 88
+ VT_VECTOR_OF_NON_OWNING_REFERENCES = 88,
+ VT_ANY_UNIQUE_TYPE = 90,
+ VT_ANY_UNIQUE = 92,
+ VT_ANY_AMBIGUOUS_TYPE = 94,
+ VT_ANY_AMBIGUOUS = 96
};
const Vec3 *pos() const {
return GetStruct<const Vec3 *>(VT_POS);
flatbuffers::Vector<uint64_t> *mutable_vector_of_non_owning_references() {
return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
}
+ AnyUniqueAliases any_unique_type() const {
+ return static_cast<AnyUniqueAliases>(GetField<uint8_t>(VT_ANY_UNIQUE_TYPE, 0));
+ }
+ bool mutate_any_unique_type(AnyUniqueAliases _any_unique_type) {
+ return SetField<uint8_t>(VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(_any_unique_type), 0);
+ }
+ const void *any_unique() const {
+ return GetPointer<const void *>(VT_ANY_UNIQUE);
+ }
+ template<typename T> const T *any_unique_as() const;
+ const Monster *any_unique_as_M() const {
+ return any_unique_type() == AnyUniqueAliases_M ? static_cast<const Monster *>(any_unique()) : nullptr;
+ }
+ const TestSimpleTableWithEnum *any_unique_as_T() const {
+ return any_unique_type() == AnyUniqueAliases_T ? static_cast<const TestSimpleTableWithEnum *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example2::Monster *any_unique_as_M2() const {
+ return any_unique_type() == AnyUniqueAliases_M2 ? static_cast<const MyGame::Example2::Monster *>(any_unique()) : nullptr;
+ }
+ void *mutable_any_unique() {
+ return GetPointer<void *>(VT_ANY_UNIQUE);
+ }
+ AnyAmbiguousAliases any_ambiguous_type() const {
+ return static_cast<AnyAmbiguousAliases>(GetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, 0));
+ }
+ bool mutate_any_ambiguous_type(AnyAmbiguousAliases _any_ambiguous_type) {
+ return SetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(_any_ambiguous_type), 0);
+ }
+ const void *any_ambiguous() const {
+ return GetPointer<const void *>(VT_ANY_AMBIGUOUS);
+ }
+ const Monster *any_ambiguous_as_M1() const {
+ return any_ambiguous_type() == AnyAmbiguousAliases_M1 ? static_cast<const Monster *>(any_ambiguous()) : nullptr;
+ }
+ const Monster *any_ambiguous_as_M2() const {
+ return any_ambiguous_type() == AnyAmbiguousAliases_M2 ? static_cast<const Monster *>(any_ambiguous()) : nullptr;
+ }
+ const Monster *any_ambiguous_as_M3() const {
+ return any_ambiguous_type() == AnyAmbiguousAliases_M3 ? static_cast<const Monster *>(any_ambiguous()) : nullptr;
+ }
+ void *mutable_any_ambiguous() {
+ return GetPointer<void *>(VT_ANY_AMBIGUOUS);
+ }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<Vec3>(verifier, VT_POS) &&
VerifyField<uint64_t>(verifier, VT_NON_OWNING_REFERENCE) &&
VerifyOffset(verifier, VT_VECTOR_OF_NON_OWNING_REFERENCES) &&
verifier.VerifyVector(vector_of_non_owning_references()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_UNIQUE_TYPE) &&
+ VerifyOffset(verifier, VT_ANY_UNIQUE) &&
+ VerifyAnyUniqueAliases(verifier, any_unique(), any_unique_type()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_AMBIGUOUS_TYPE) &&
+ VerifyOffset(verifier, VT_ANY_AMBIGUOUS) &&
+ VerifyAnyAmbiguousAliases(verifier, any_ambiguous(), any_ambiguous_type()) &&
verifier.EndTable();
}
MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
return test_as_MyGame_Example2_Monster();
}
+template<> inline const Monster *Monster::any_unique_as<Monster>() const {
+ return any_unique_as_M();
+}
+
+template<> inline const TestSimpleTableWithEnum *Monster::any_unique_as<TestSimpleTableWithEnum>() const {
+ return any_unique_as_T();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::any_unique_as<MyGame::Example2::Monster>() const {
+ return any_unique_as_M2();
+}
+
struct MonsterBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_vector_of_non_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references) {
fbb_.AddOffset(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
}
+ void add_any_unique_type(AnyUniqueAliases any_unique_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(any_unique_type), 0);
+ }
+ void add_any_unique(flatbuffers::Offset<void> any_unique) {
+ fbb_.AddOffset(Monster::VT_ANY_UNIQUE, any_unique);
+ }
+ void add_any_ambiguous_type(AnyAmbiguousAliases any_ambiguous_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(any_ambiguous_type), 0);
+ }
+ void add_any_ambiguous(flatbuffers::Offset<void> any_ambiguous) {
+ fbb_.AddOffset(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
+ }
explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
uint64_t co_owning_reference = 0,
flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references = 0,
uint64_t non_owning_reference = 0,
- flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references = 0) {
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references = 0,
+ AnyUniqueAliases any_unique_type = AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ AnyAmbiguousAliases any_ambiguous_type = AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0) {
MonsterBuilder builder_(_fbb);
builder_.add_non_owning_reference(non_owning_reference);
builder_.add_co_owning_reference(co_owning_reference);
builder_.add_testhashs64_fnv1a(testhashs64_fnv1a);
builder_.add_testhashu64_fnv1(testhashu64_fnv1);
builder_.add_testhashs64_fnv1(testhashs64_fnv1);
+ builder_.add_any_ambiguous(any_ambiguous);
+ builder_.add_any_unique(any_unique);
builder_.add_vector_of_non_owning_references(vector_of_non_owning_references);
builder_.add_vector_of_co_owning_references(vector_of_co_owning_references);
builder_.add_vector_of_strong_referrables(vector_of_strong_referrables);
builder_.add_pos(pos);
builder_.add_hp(hp);
builder_.add_mana(mana);
+ builder_.add_any_ambiguous_type(any_ambiguous_type);
+ builder_.add_any_unique_type(any_unique_type);
builder_.add_testbool(testbool);
builder_.add_test_type(test_type);
builder_.add_color(color);
uint64_t co_owning_reference = 0,
const std::vector<uint64_t> *vector_of_co_owning_references = nullptr,
uint64_t non_owning_reference = 0,
- const std::vector<uint64_t> *vector_of_non_owning_references = nullptr) {
+ const std::vector<uint64_t> *vector_of_non_owning_references = nullptr,
+ AnyUniqueAliases any_unique_type = AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ AnyAmbiguousAliases any_ambiguous_type = AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0) {
return MyGame::Example::CreateMonster(
_fbb,
pos,
co_owning_reference,
vector_of_co_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_co_owning_references) : 0,
non_owning_reference,
- vector_of_non_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_non_owning_references) : 0);
+ vector_of_non_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_non_owning_references) : 0,
+ any_unique_type,
+ any_unique,
+ any_ambiguous_type,
+ any_ambiguous);
}
flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; };
{ auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, naked
if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } };
+ { auto _e = any_unique_type(); _o->any_unique.type = _e; };
+ { auto _e = any_unique(); if (_e) _o->any_unique.value = AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); };
+ { auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; };
+ { auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); };
}
inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
auto _vector_of_co_owning_references = _o->vector_of_co_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_co_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_co_owning_references[i].get())) : 0; }, &_va ) : 0;
auto _non_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->non_owning_reference)) : 0;
auto _vector_of_non_owning_references = _o->vector_of_non_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_non_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_non_owning_references[i])) : 0; }, &_va ) : 0;
+ auto _any_unique_type = _o->any_unique.type;
+ auto _any_unique = _o->any_unique.Pack(_fbb);
+ auto _any_ambiguous_type = _o->any_ambiguous.type;
+ auto _any_ambiguous = _o->any_ambiguous.Pack(_fbb);
return MyGame::Example::CreateMonster(
_fbb,
_pos,
_co_owning_reference,
_vector_of_co_owning_references,
_non_owning_reference,
- _vector_of_non_owning_references);
+ _vector_of_non_owning_references,
+ _any_unique_type,
+ _any_unique,
+ _any_ambiguous_type,
+ _any_ambiguous);
}
inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
type = Any_NONE;
}
+inline bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type) {
+ switch (type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_T: {
+ auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return false;
+ }
+}
+
+inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyUniqueAliases(
+ verifier, values->Get(i), types->GetEnum<AnyUniqueAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_T: {
+ auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_T: {
+ auto ptr = reinterpret_cast<const TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUniqueAliasesUnion::AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ FLATBUFFERS_ASSERT(false); // MonsterT not copyable.
+ break;
+ }
+ case AnyUniqueAliases_T: {
+ value = new TestSimpleTableWithEnumT(*reinterpret_cast<TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUniqueAliasesUnion::Reset() {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_T: {
+ auto ptr = reinterpret_cast<TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyUniqueAliases_NONE;
+}
+
+inline bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type) {
+ switch (type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return false;
+ }
+}
+
+inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyAmbiguousAliases(
+ verifier, values->Get(i), types->GetEnum<AnyAmbiguousAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyAmbiguousAliasesUnion::AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ FLATBUFFERS_ASSERT(false); // MonsterT not copyable.
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ FLATBUFFERS_ASSERT(false); // MonsterT not copyable.
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ FLATBUFFERS_ASSERT(false); // MonsterT not copyable.
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyAmbiguousAliasesUnion::Reset() {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyAmbiguousAliases_NONE;
+}
+
inline const flatbuffers::TypeTable *ColorTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_CHAR, 0, 0 },
return &tt;
}
+inline const flatbuffers::TypeTable *AnyUniqueAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MonsterTypeTable,
+ TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M",
+ "T",
+ "M2"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyAmbiguousAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, names
+ };
+ return &tt;
+}
+
} // namespace Example
inline const flatbuffers::TypeTable *InParentNamespaceTypeTable() {
{ flatbuffers::ET_ULONG, 0, -1 },
{ flatbuffers::ET_ULONG, 1, -1 },
{ flatbuffers::ET_ULONG, 0, -1 },
- { flatbuffers::ET_ULONG, 1, -1 }
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_UTYPE, 0, 9 },
+ { flatbuffers::ET_SEQUENCE, 0, 9 },
+ { flatbuffers::ET_UTYPE, 0, 10 },
+ { flatbuffers::ET_SEQUENCE, 0, 10 }
};
static const flatbuffers::TypeFunction type_refs[] = {
Vec3TypeTable,
StatTypeTable,
AbilityTypeTable,
MyGame::InParentNamespaceTypeTable,
- ReferrableTypeTable
+ ReferrableTypeTable,
+ AnyUniqueAliasesTypeTable,
+ AnyAmbiguousAliasesTypeTable
};
static const char * const names[] = {
"pos",
"co_owning_reference",
"vector_of_co_owning_references",
"non_owning_reference",
- "vector_of_non_owning_references"
+ "vector_of_non_owning_references",
+ "any_unique_type",
+ "any_unique",
+ "any_ambiguous_type",
+ "any_ambiguous"
};
static const flatbuffers::TypeTable tt = {
- flatbuffers::ST_TABLE, 43, type_codes, type_refs, nullptr, names
+ flatbuffers::ST_TABLE, 47, type_codes, type_refs, nullptr, names
};
return &tt;
}
};
/**
+ * @enum
+ */
+MyGame.Example.AnyUniqueAliases = {
+ NONE: 0, 0: 'NONE',
+ M: 1, 1: 'M',
+ T: 2, 2: 'T',
+ M2: 3, 3: 'M2'
+};
+
+/**
+ * @enum
+ */
+MyGame.Example.AnyAmbiguousAliases = {
+ NONE: 0, 0: 'NONE',
+ M1: 1, 1: 'M1',
+ M2: 2, 2: 'M2',
+ M3: 3, 3: 'M3'
+};
+
+/**
* @constructor
*/
MyGame.InParentNamespace = function() {
};
/**
+ * @returns {MyGame.Example.AnyUniqueAliases}
+ */
+MyGame.Example.Monster.prototype.anyUniqueType = function() {
+ var offset = this.bb.__offset(this.bb_pos, 90);
+ return offset ? /** @type {MyGame.Example.AnyUniqueAliases} */ (this.bb.readUint8(this.bb_pos + offset)) : MyGame.Example.AnyUniqueAliases.NONE;
+};
+
+/**
+ * @param {MyGame.Example.AnyUniqueAliases} value
+ * @returns {boolean}
+ */
+MyGame.Example.Monster.prototype.mutate_any_unique_type = function(value) {
+ var offset = this.bb.__offset(this.bb_pos, 90);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb.writeUint8(this.bb_pos + offset, value);
+ return true;
+};
+
+/**
+ * @param {flatbuffers.Table} obj
+ * @returns {?flatbuffers.Table}
+ */
+MyGame.Example.Monster.prototype.anyUnique = function(obj) {
+ var offset = this.bb.__offset(this.bb_pos, 92);
+ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
+};
+
+/**
+ * @returns {MyGame.Example.AnyAmbiguousAliases}
+ */
+MyGame.Example.Monster.prototype.anyAmbiguousType = function() {
+ var offset = this.bb.__offset(this.bb_pos, 94);
+ return offset ? /** @type {MyGame.Example.AnyAmbiguousAliases} */ (this.bb.readUint8(this.bb_pos + offset)) : MyGame.Example.AnyAmbiguousAliases.NONE;
+};
+
+/**
+ * @param {MyGame.Example.AnyAmbiguousAliases} value
+ * @returns {boolean}
+ */
+MyGame.Example.Monster.prototype.mutate_any_ambiguous_type = function(value) {
+ var offset = this.bb.__offset(this.bb_pos, 94);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb.writeUint8(this.bb_pos + offset, value);
+ return true;
+};
+
+/**
+ * @param {flatbuffers.Table} obj
+ * @returns {?flatbuffers.Table}
+ */
+MyGame.Example.Monster.prototype.anyAmbiguous = function(obj) {
+ var offset = this.bb.__offset(this.bb_pos, 96);
+ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
+};
+
+/**
* @param {flatbuffers.Builder} builder
*/
MyGame.Example.Monster.startMonster = function(builder) {
- builder.startObject(43);
+ builder.startObject(47);
};
/**
/**
* @param {flatbuffers.Builder} builder
+ * @param {MyGame.Example.AnyUniqueAliases} anyUniqueType
+ */
+MyGame.Example.Monster.addAnyUniqueType = function(builder, anyUniqueType) {
+ builder.addFieldInt8(43, anyUniqueType, MyGame.Example.AnyUniqueAliases.NONE);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
+ * @param {flatbuffers.Offset} anyUniqueOffset
+ */
+MyGame.Example.Monster.addAnyUnique = function(builder, anyUniqueOffset) {
+ builder.addFieldOffset(44, anyUniqueOffset, 0);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
+ * @param {MyGame.Example.AnyAmbiguousAliases} anyAmbiguousType
+ */
+MyGame.Example.Monster.addAnyAmbiguousType = function(builder, anyAmbiguousType) {
+ builder.addFieldInt8(45, anyAmbiguousType, MyGame.Example.AnyAmbiguousAliases.NONE);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
+ * @param {flatbuffers.Offset} anyAmbiguousOffset
+ */
+MyGame.Example.Monster.addAnyAmbiguous = function(builder, anyAmbiguousOffset) {
+ builder.addFieldOffset(46, anyAmbiguousOffset, 0);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
* @returns {flatbuffers.Offset}
*/
MyGame.Example.Monster.endMonster = function(builder) {
Any_TestSimpleTableWithEnum = 2,
Any_MyGame_Example2_Monster = 3
+enum +
+ AnyUniqueAliases_NONE = 0,
+ AnyUniqueAliases_M = 1,
+ AnyUniqueAliases_T = 2,
+ AnyUniqueAliases_M2 = 3
+
+enum +
+ AnyAmbiguousAliases_NONE = 0,
+ AnyAmbiguousAliases_M1 = 1,
+ AnyAmbiguousAliases_M2 = 2,
+ AnyAmbiguousAliases_M3 = 3
+
namespace MyGame
struct InParentNamespace
buf_.read_int64_le(buf_.flatbuffers_field_vector(pos_, 88) + i * 8)
def vector_of_non_owning_references_length():
buf_.flatbuffers_field_vector_len(pos_, 88)
+ def any_unique_type():
+ buf_.flatbuffers_field_int8(pos_, 90, 0)
+ def any_unique_as_M():
+ MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 92) }
+ def any_unique_as_T():
+ MyGame_Example_TestSimpleTableWithEnum { buf_, buf_.flatbuffers_field_table(pos_, 92) }
+ def any_unique_as_M2():
+ MyGame_Example2_Monster { buf_, buf_.flatbuffers_field_table(pos_, 92) }
+ def any_ambiguous_type():
+ buf_.flatbuffers_field_int8(pos_, 94, 0)
+ def any_ambiguous_as_M1():
+ MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
+ def any_ambiguous_as_M2():
+ MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
+ def any_ambiguous_as_M3():
+ MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
def GetRootAsMonster(buf:string): Monster { buf, buf.flatbuffers_indirect(0) }
def MonsterStart(b_:flatbuffers_builder):
- b_.StartObject(43)
+ b_.StartObject(47)
def MonsterAddPos(b_:flatbuffers_builder, pos:int):
b_.PrependStructSlot(0, pos, 0)
def MonsterAddMana(b_:flatbuffers_builder, mana:int):
b_.StartVector(8, v_.length, 8)
reverse(v_) e_: b_.PrependUint64(e_)
b_.EndVector(v_.length)
+def MonsterAddAnyUniqueType(b_:flatbuffers_builder, any_unique_type:int):
+ b_.PrependUint8Slot(43, any_unique_type, 0)
+def MonsterAddAnyUnique(b_:flatbuffers_builder, any_unique:int):
+ b_.PrependUOffsetTRelativeSlot(44, any_unique, 0)
+def MonsterAddAnyAmbiguousType(b_:flatbuffers_builder, any_ambiguous_type:int):
+ b_.PrependUint8Slot(45, any_ambiguous_type, 0)
+def MonsterAddAnyAmbiguous(b_:flatbuffers_builder, any_ambiguous:int):
+ b_.PrependUOffsetTRelativeSlot(46, any_ambiguous, 0)
def MonsterEnd(b_:flatbuffers_builder):
b_.EndObject()
}
pub struct AnyUnionTableOffset {}
+#[allow(non_camel_case_types)]
+#[repr(u8)]
+#[derive(Clone, Copy, PartialEq, Debug)]
+pub enum AnyUniqueAliases {
+ NONE = 0,
+ M = 1,
+ T = 2,
+ M2 = 3,
+
+}
+
+const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
+const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
+
+impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases {
+ type Inner = Self;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ flatbuffers::read_scalar_at::<Self>(buf, loc)
+ }
+}
+
+impl flatbuffers::EndianScalar for AnyUniqueAliases {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ let n = u8::to_le(self as u8);
+ let p = &n as *const u8 as *const AnyUniqueAliases;
+ unsafe { *p }
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ let n = u8::from_le(self as u8);
+ let p = &n as *const u8 as *const AnyUniqueAliases;
+ unsafe { *p }
+ }
+}
+
+impl flatbuffers::Push for AnyUniqueAliases {
+ type Output = AnyUniqueAliases;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ flatbuffers::emplace_scalar::<AnyUniqueAliases>(dst, *self);
+ }
+}
+
+#[allow(non_camel_case_types)]
+const ENUM_VALUES_ANY_UNIQUE_ALIASES:[AnyUniqueAliases; 4] = [
+ AnyUniqueAliases::NONE,
+ AnyUniqueAliases::M,
+ AnyUniqueAliases::T,
+ AnyUniqueAliases::M2
+];
+
+#[allow(non_camel_case_types)]
+const ENUM_NAMES_ANY_UNIQUE_ALIASES:[&'static str; 4] = [
+ "NONE",
+ "M",
+ "T",
+ "M2"
+];
+
+pub fn enum_name_any_unique_aliases(e: AnyUniqueAliases) -> &'static str {
+ let index: usize = e as usize;
+ ENUM_NAMES_ANY_UNIQUE_ALIASES[index]
+}
+
+pub struct AnyUniqueAliasesUnionTableOffset {}
+#[allow(non_camel_case_types)]
+#[repr(u8)]
+#[derive(Clone, Copy, PartialEq, Debug)]
+pub enum AnyAmbiguousAliases {
+ NONE = 0,
+ M1 = 1,
+ M2 = 2,
+ M3 = 3,
+
+}
+
+const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
+const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
+
+impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases {
+ type Inner = Self;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ flatbuffers::read_scalar_at::<Self>(buf, loc)
+ }
+}
+
+impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ let n = u8::to_le(self as u8);
+ let p = &n as *const u8 as *const AnyAmbiguousAliases;
+ unsafe { *p }
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ let n = u8::from_le(self as u8);
+ let p = &n as *const u8 as *const AnyAmbiguousAliases;
+ unsafe { *p }
+ }
+}
+
+impl flatbuffers::Push for AnyAmbiguousAliases {
+ type Output = AnyAmbiguousAliases;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ flatbuffers::emplace_scalar::<AnyAmbiguousAliases>(dst, *self);
+ }
+}
+
+#[allow(non_camel_case_types)]
+const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES:[AnyAmbiguousAliases; 4] = [
+ AnyAmbiguousAliases::NONE,
+ AnyAmbiguousAliases::M1,
+ AnyAmbiguousAliases::M2,
+ AnyAmbiguousAliases::M3
+];
+
+#[allow(non_camel_case_types)]
+const ENUM_NAMES_ANY_AMBIGUOUS_ALIASES:[&'static str; 4] = [
+ "NONE",
+ "M1",
+ "M2",
+ "M3"
+];
+
+pub fn enum_name_any_ambiguous_aliases(e: AnyAmbiguousAliases) -> &'static str {
+ let index: usize = e as usize;
+ ENUM_NAMES_ANY_AMBIGUOUS_ALIASES[index]
+}
+
+pub struct AnyAmbiguousAliasesUnionTableOffset {}
// struct Test, aligned to 2
#[repr(C, align(2))]
#[derive(Clone, Copy, Debug, PartialEq)]
builder.add_testhashs64_fnv1a(args.testhashs64_fnv1a);
builder.add_testhashu64_fnv1(args.testhashu64_fnv1);
builder.add_testhashs64_fnv1(args.testhashs64_fnv1);
+ if let Some(x) = args.any_ambiguous { builder.add_any_ambiguous(x); }
+ if let Some(x) = args.any_unique { builder.add_any_unique(x); }
if let Some(x) = args.vector_of_non_owning_references { builder.add_vector_of_non_owning_references(x); }
if let Some(x) = args.vector_of_co_owning_references { builder.add_vector_of_co_owning_references(x); }
if let Some(x) = args.vector_of_strong_referrables { builder.add_vector_of_strong_referrables(x); }
if let Some(x) = args.pos { builder.add_pos(x); }
builder.add_hp(args.hp);
builder.add_mana(args.mana);
+ builder.add_any_ambiguous_type(args.any_ambiguous_type);
+ builder.add_any_unique_type(args.any_unique_type);
builder.add_testbool(args.testbool);
builder.add_test_type(args.test_type);
builder.add_color(args.color);
pub const VT_VECTOR_OF_CO_OWNING_REFERENCES: flatbuffers::VOffsetT = 84;
pub const VT_NON_OWNING_REFERENCE: flatbuffers::VOffsetT = 86;
pub const VT_VECTOR_OF_NON_OWNING_REFERENCES: flatbuffers::VOffsetT = 88;
+ pub const VT_ANY_UNIQUE_TYPE: flatbuffers::VOffsetT = 90;
+ pub const VT_ANY_UNIQUE: flatbuffers::VOffsetT = 92;
+ pub const VT_ANY_AMBIGUOUS_TYPE: flatbuffers::VOffsetT = 94;
+ pub const VT_ANY_AMBIGUOUS: flatbuffers::VOffsetT = 96;
#[inline]
pub fn pos(&self) -> Option<&'a Vec3> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, None)
}
#[inline]
+ pub fn any_unique_type(&self) -> AnyUniqueAliases {
+ self._tab.get::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, Some(AnyUniqueAliases::NONE)).unwrap()
+ }
+ #[inline]
+ pub fn any_unique(&self) -> Option<flatbuffers::Table<'a>> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_UNIQUE, None)
+ }
+ #[inline]
+ pub fn any_ambiguous_type(&self) -> AnyAmbiguousAliases {
+ self._tab.get::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, Some(AnyAmbiguousAliases::NONE)).unwrap()
+ }
+ #[inline]
+ pub fn any_ambiguous(&self) -> Option<flatbuffers::Table<'a>> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Monster::VT_ANY_AMBIGUOUS, None)
+ }
+ #[inline]
#[allow(non_snake_case)]
pub fn test_as_monster(&'a self) -> Option<Monster> {
if self.test_type() == Any::Monster {
}
}
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_unique_as_m(&'a self) -> Option<Monster> {
+ if self.any_unique_type() == AnyUniqueAliases::M {
+ self.any_unique().map(|u| Monster::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_unique_as_t(&'a self) -> Option<TestSimpleTableWithEnum> {
+ if self.any_unique_type() == AnyUniqueAliases::T {
+ self.any_unique().map(|u| TestSimpleTableWithEnum::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_unique_as_m2(&'a self) -> Option<super::example_2::Monster> {
+ if self.any_unique_type() == AnyUniqueAliases::M2 {
+ self.any_unique().map(|u| super::example_2::Monster::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_ambiguous_as_m1(&'a self) -> Option<Monster> {
+ if self.any_ambiguous_type() == AnyAmbiguousAliases::M1 {
+ self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_ambiguous_as_m2(&'a self) -> Option<Monster> {
+ if self.any_ambiguous_type() == AnyAmbiguousAliases::M2 {
+ self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn any_ambiguous_as_m3(&'a self) -> Option<Monster> {
+ if self.any_ambiguous_type() == AnyAmbiguousAliases::M3 {
+ self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
}
pub struct MonsterArgs<'a> {
pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
pub non_owning_reference: u64,
pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
+ pub any_unique_type: AnyUniqueAliases,
+ pub any_unique: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
+ pub any_ambiguous_type: AnyAmbiguousAliases,
+ pub any_ambiguous: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for MonsterArgs<'a> {
#[inline]
vector_of_co_owning_references: None,
non_owning_reference: 0,
vector_of_non_owning_references: None,
+ any_unique_type: AnyUniqueAliases::NONE,
+ any_unique: None,
+ any_ambiguous_type: AnyAmbiguousAliases::NONE,
+ any_ambiguous: None,
}
}
}
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
}
#[inline]
+ pub fn add_any_unique_type(&mut self, any_unique_type: AnyUniqueAliases) {
+ self.fbb_.push_slot::<AnyUniqueAliases>(Monster::VT_ANY_UNIQUE_TYPE, any_unique_type, AnyUniqueAliases::NONE);
+ }
+ #[inline]
+ pub fn add_any_unique(&mut self, any_unique: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_UNIQUE, any_unique);
+ }
+ #[inline]
+ pub fn add_any_ambiguous_type(&mut self, any_ambiguous_type: AnyAmbiguousAliases) {
+ self.fbb_.push_slot::<AnyAmbiguousAliases>(Monster::VT_ANY_AMBIGUOUS_TYPE, any_ambiguous_type, AnyAmbiguousAliases::NONE);
+ }
+ #[inline]
+ pub fn add_any_ambiguous(&mut self, any_ambiguous: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
+ }
+ #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
let start = _fbb.start_table();
MonsterBuilder {
}};
/**
+ * @enum
+ */
+export namespace MyGame.Example{
+export enum AnyUniqueAliases{
+ NONE= 0,
+ M= 1,
+ T= 2,
+ M2= 3
+}};
+
+/**
+ * @enum
+ */
+export namespace MyGame.Example{
+export enum AnyAmbiguousAliases{
+ NONE= 0,
+ M1= 1,
+ M2= 2,
+ M3= 3
+}};
+
+/**
* @constructor
*/
export namespace MyGame{
};
/**
+ * @returns MyGame.Example.AnyUniqueAliases
+ */
+anyUniqueType():MyGame.Example.AnyUniqueAliases {
+ var offset = this.bb!.__offset(this.bb_pos, 90);
+ return offset ? /** */ (this.bb!.readUint8(this.bb_pos + offset)) : MyGame.Example.AnyUniqueAliases.NONE;
+};
+
+/**
+ * @param MyGame.Example.AnyUniqueAliases value
+ * @returns boolean
+ */
+mutate_any_unique_type(value:MyGame.Example.AnyUniqueAliases):boolean {
+ var offset = this.bb!.__offset(this.bb_pos, 90);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint8(this.bb_pos + offset, value);
+ return true;
+};
+
+/**
+ * @param flatbuffers.Table obj
+ * @returns ?flatbuffers.Table
+ */
+anyUnique<T extends flatbuffers.Table>(obj:T):T|null {
+ var offset = this.bb!.__offset(this.bb_pos, 92);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+};
+
+/**
+ * @returns MyGame.Example.AnyAmbiguousAliases
+ */
+anyAmbiguousType():MyGame.Example.AnyAmbiguousAliases {
+ var offset = this.bb!.__offset(this.bb_pos, 94);
+ return offset ? /** */ (this.bb!.readUint8(this.bb_pos + offset)) : MyGame.Example.AnyAmbiguousAliases.NONE;
+};
+
+/**
+ * @param MyGame.Example.AnyAmbiguousAliases value
+ * @returns boolean
+ */
+mutate_any_ambiguous_type(value:MyGame.Example.AnyAmbiguousAliases):boolean {
+ var offset = this.bb!.__offset(this.bb_pos, 94);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint8(this.bb_pos + offset, value);
+ return true;
+};
+
+/**
+ * @param flatbuffers.Table obj
+ * @returns ?flatbuffers.Table
+ */
+anyAmbiguous<T extends flatbuffers.Table>(obj:T):T|null {
+ var offset = this.bb!.__offset(this.bb_pos, 96);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+};
+
+/**
* @param flatbuffers.Builder builder
*/
static startMonster(builder:flatbuffers.Builder) {
- builder.startObject(43);
+ builder.startObject(47);
};
/**
/**
* @param flatbuffers.Builder builder
+ * @param MyGame.Example.AnyUniqueAliases anyUniqueType
+ */
+static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:MyGame.Example.AnyUniqueAliases) {
+ builder.addFieldInt8(43, anyUniqueType, MyGame.Example.AnyUniqueAliases.NONE);
+};
+
+/**
+ * @param flatbuffers.Builder builder
+ * @param flatbuffers.Offset anyUniqueOffset
+ */
+static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(44, anyUniqueOffset, 0);
+};
+
+/**
+ * @param flatbuffers.Builder builder
+ * @param MyGame.Example.AnyAmbiguousAliases anyAmbiguousType
+ */
+static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:MyGame.Example.AnyAmbiguousAliases) {
+ builder.addFieldInt8(45, anyAmbiguousType, MyGame.Example.AnyAmbiguousAliases.NONE);
+};
+
+/**
+ * @param flatbuffers.Builder builder
+ * @param flatbuffers.Offset anyAmbiguousOffset
+ */
+static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(46, anyAmbiguousOffset, 0);
+};
+
+/**
+ * @param flatbuffers.Builder builder
* @returns flatbuffers.Offset
*/
static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
new AnyTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
}
+class AnyUniqueAliasesTypeId {
+ final int value;
+ const AnyUniqueAliasesTypeId._(this.value);
+
+ factory AnyUniqueAliasesTypeId.fromValue(int value) {
+ if (value == null) value = 0;
+ if (!values.containsKey(value)) {
+ throw new StateError('Invalid value $value for bit flag enum AnyUniqueAliasesTypeId');
+ }
+ return values[value];
+ }
+
+ static const int minValue = 0;
+ static const int maxValue = 3;
+ static bool containsValue(int value) => values.containsKey(value);
+
+ static const AnyUniqueAliasesTypeId NONE = const AnyUniqueAliasesTypeId._(0);
+ static const AnyUniqueAliasesTypeId M = const AnyUniqueAliasesTypeId._(1);
+ static const AnyUniqueAliasesTypeId T = const AnyUniqueAliasesTypeId._(2);
+ static const AnyUniqueAliasesTypeId M2 = const AnyUniqueAliasesTypeId._(3);
+ static get values => {0: NONE,1: M,2: T,3: M2,};
+
+ static const fb.Reader<AnyUniqueAliasesTypeId> reader = const _AnyUniqueAliasesTypeIdReader();
+
+ @override
+ String toString() {
+ return 'AnyUniqueAliasesTypeId{value: $value}';
+ }
+}
+
+class _AnyUniqueAliasesTypeIdReader extends fb.Reader<AnyUniqueAliasesTypeId> {
+ const _AnyUniqueAliasesTypeIdReader();
+
+ @override
+ int get size => 1;
+
+ @override
+ AnyUniqueAliasesTypeId read(fb.BufferContext bc, int offset) =>
+ new AnyUniqueAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
+}
+
+class AnyAmbiguousAliasesTypeId {
+ final int value;
+ const AnyAmbiguousAliasesTypeId._(this.value);
+
+ factory AnyAmbiguousAliasesTypeId.fromValue(int value) {
+ if (value == null) value = 0;
+ if (!values.containsKey(value)) {
+ throw new StateError('Invalid value $value for bit flag enum AnyAmbiguousAliasesTypeId');
+ }
+ return values[value];
+ }
+
+ static const int minValue = 0;
+ static const int maxValue = 3;
+ static bool containsValue(int value) => values.containsKey(value);
+
+ static const AnyAmbiguousAliasesTypeId NONE = const AnyAmbiguousAliasesTypeId._(0);
+ static const AnyAmbiguousAliasesTypeId M1 = const AnyAmbiguousAliasesTypeId._(1);
+ static const AnyAmbiguousAliasesTypeId M2 = const AnyAmbiguousAliasesTypeId._(2);
+ static const AnyAmbiguousAliasesTypeId M3 = const AnyAmbiguousAliasesTypeId._(3);
+ static get values => {0: NONE,1: M1,2: M2,3: M3,};
+
+ static const fb.Reader<AnyAmbiguousAliasesTypeId> reader = const _AnyAmbiguousAliasesTypeIdReader();
+
+ @override
+ String toString() {
+ return 'AnyAmbiguousAliasesTypeId{value: $value}';
+ }
+}
+
+class _AnyAmbiguousAliasesTypeIdReader extends fb.Reader<AnyAmbiguousAliasesTypeId> {
+ const _AnyAmbiguousAliasesTypeIdReader();
+
+ @override
+ int get size => 1;
+
+ @override
+ AnyAmbiguousAliasesTypeId read(fb.BufferContext bc, int offset) =>
+ new AnyAmbiguousAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
+}
+
class Test {
Test._(this._bc, this._bcOffset);
List<int> get vectorOfCoOwningReferences => const fb.ListReader<int>(const fb.Uint64Reader()).vTableGet(_bc, _bcOffset, 84, null);
int get nonOwningReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 86, 0);
List<int> get vectorOfNonOwningReferences => const fb.ListReader<int>(const fb.Uint64Reader()).vTableGet(_bc, _bcOffset, 88, null);
+ AnyUniqueAliasesTypeId get anyUniqueType => new AnyUniqueAliasesTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 90, 0));
+ dynamic get anyUnique {
+ switch (anyUniqueType?.value) {
+ case 1: return M.reader.vTableGet(_bc, _bcOffset, 92, null);
+ case 2: return T.reader.vTableGet(_bc, _bcOffset, 92, null);
+ case 3: return M2.reader.vTableGet(_bc, _bcOffset, 92, null);
+ default: return null;
+ }
+ }
+ AnyAmbiguousAliasesTypeId get anyAmbiguousType => new AnyAmbiguousAliasesTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 94, 0));
+ dynamic get anyAmbiguous {
+ switch (anyAmbiguousType?.value) {
+ case 1: return M1.reader.vTableGet(_bc, _bcOffset, 96, null);
+ case 2: return M2.reader.vTableGet(_bc, _bcOffset, 96, null);
+ case 3: return M3.reader.vTableGet(_bc, _bcOffset, 96, null);
+ default: return 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}';
+ 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}';
}
}
fbBuilder.addOffset(42, offset);
return fbBuilder.offset;
}
+ int addAnyUniqueType(AnyUniqueAliasesTypeId anyUniqueType) {
+ fbBuilder.addUint8(43, anyUniqueType?.value);
+ return fbBuilder.offset;
+ }
+ int addAnyUniqueOffset(int offset) {
+ fbBuilder.addOffset(44, offset);
+ return fbBuilder.offset;
+ }
+ int addAnyAmbiguousType(AnyAmbiguousAliasesTypeId anyAmbiguousType) {
+ fbBuilder.addUint8(45, anyAmbiguousType?.value);
+ return fbBuilder.offset;
+ }
+ int addAnyAmbiguousOffset(int offset) {
+ fbBuilder.addOffset(46, offset);
+ return fbBuilder.offset;
+ }
int finish() {
return fbBuilder.endTable();
final List<int> _vectorOfCoOwningReferences;
final int _nonOwningReference;
final List<int> _vectorOfNonOwningReferences;
+ final AnyUniqueAliasesTypeId _anyUniqueType;
+ final dynamic _anyUnique;
+ final AnyAmbiguousAliasesTypeId _anyAmbiguousType;
+ final dynamic _anyAmbiguous;
MonsterObjectBuilder({
Vec3ObjectBuilder pos,
List<int> vectorOfCoOwningReferences,
int nonOwningReference,
List<int> vectorOfNonOwningReferences,
+ AnyUniqueAliasesTypeId anyUniqueType,
+ dynamic anyUnique,
+ AnyAmbiguousAliasesTypeId anyAmbiguousType,
+ dynamic anyAmbiguous,
})
: _pos = pos,
_mana = mana,
_coOwningReference = coOwningReference,
_vectorOfCoOwningReferences = vectorOfCoOwningReferences,
_nonOwningReference = nonOwningReference,
- _vectorOfNonOwningReferences = vectorOfNonOwningReferences;
+ _vectorOfNonOwningReferences = vectorOfNonOwningReferences,
+ _anyUniqueType = anyUniqueType,
+ _anyUnique = anyUnique,
+ _anyAmbiguousType = anyAmbiguousType,
+ _anyAmbiguous = anyAmbiguous;
/// Finish building, and store into the [fbBuilder].
@override
final int vectorOfNonOwningReferencesOffset = _vectorOfNonOwningReferences?.isNotEmpty == true
? fbBuilder.writeListUint64(_vectorOfNonOwningReferences)
: null;
+ final int anyUniqueOffset = _anyUnique?.getOrCreateOffset(fbBuilder);
+ final int anyAmbiguousOffset = _anyAmbiguous?.getOrCreateOffset(fbBuilder);
fbBuilder.startTable();
if (_pos != null) {
if (vectorOfNonOwningReferencesOffset != null) {
fbBuilder.addOffset(42, vectorOfNonOwningReferencesOffset);
}
+ fbBuilder.addUint8(43, _anyUniqueType?.value);
+ if (anyUniqueOffset != null) {
+ fbBuilder.addOffset(44, anyUniqueOffset);
+ }
+ fbBuilder.addUint8(45, _anyAmbiguousType?.value);
+ if (anyAmbiguousOffset != null) {
+ fbBuilder.addOffset(46, anyAmbiguousOffset);
+ }
return fbBuilder.endTable();
}
const void *main_character() const {
return GetPointer<const void *>(VT_MAIN_CHARACTER);
}
- template<typename T> const T *main_character_as() const;
const Attacker *main_character_as_MuLan() const {
return main_character_type() == Character_MuLan ? static_cast<const Attacker *>(main_character()) : nullptr;
}