mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 15:40:02 +00:00
[C++] Fix compile failure on Object API union construction for struct member (#6923)
* Add dedicated traits to Object API version of unions. * Add suppression for unused parameters on unions of structs.
This commit is contained in:
@@ -103,6 +103,14 @@ template<> struct EquipmentTraits<MyGame::Sample::Weapon> {
|
|||||||
static const Equipment enum_value = Equipment_Weapon;
|
static const Equipment enum_value = Equipment_Weapon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct EquipmentUnionTraits {
|
||||||
|
static const Equipment enum_value = Equipment_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct EquipmentUnionTraits<MyGame::Sample::WeaponT> {
|
||||||
|
static const Equipment enum_value = Equipment_Weapon;
|
||||||
|
};
|
||||||
|
|
||||||
struct EquipmentUnion {
|
struct EquipmentUnion {
|
||||||
Equipment type;
|
Equipment type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -122,9 +130,9 @@ struct EquipmentUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = EquipmentTraits<typename RT::TableType>::enum_value;
|
type = EquipmentUnionTraits<RT>::enum_value;
|
||||||
if (type != Equipment_NONE) {
|
if (type != Equipment_NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -667,6 +675,7 @@ inline bool VerifyEquipmentVector(flatbuffers::Verifier &verifier, const flatbuf
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *EquipmentUnion::UnPack(const void *obj, Equipment type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *EquipmentUnion::UnPack(const void *obj, Equipment type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Equipment_Weapon: {
|
case Equipment_Weapon: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Sample::Weapon *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Sample::Weapon *>(obj);
|
||||||
@@ -677,6 +686,7 @@ inline void *EquipmentUnion::UnPack(const void *obj, Equipment type, const flatb
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> EquipmentUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> EquipmentUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Equipment_Weapon: {
|
case Equipment_Weapon: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Sample::WeaponT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Sample::WeaponT *>(value);
|
||||||
|
|||||||
@@ -1311,11 +1311,30 @@ class CppGenerator : public BaseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts_.generate_object_based_api && enum_def.is_union) {
|
if (opts_.generate_object_based_api && enum_def.is_union) {
|
||||||
// Generate a union type
|
// Generate a union type and a trait type for it.
|
||||||
code_.SetValue("NAME", Name(enum_def));
|
code_.SetValue("NAME", Name(enum_def));
|
||||||
FLATBUFFERS_ASSERT(enum_def.Lookup("NONE"));
|
FLATBUFFERS_ASSERT(enum_def.Lookup("NONE"));
|
||||||
code_.SetValue("NONE", GetEnumValUse(enum_def, *enum_def.Lookup("NONE")));
|
code_.SetValue("NONE", GetEnumValUse(enum_def, *enum_def.Lookup("NONE")));
|
||||||
|
|
||||||
|
if (!enum_def.uses_multiple_type_instances) {
|
||||||
|
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
||||||
|
++it) {
|
||||||
|
const auto &ev = **it;
|
||||||
|
|
||||||
|
if (it == enum_def.Vals().begin()) {
|
||||||
|
code_ += "template<typename T> struct {{NAME}}UnionTraits {";
|
||||||
|
} else {
|
||||||
|
auto name = GetUnionElement(ev, true, opts_);
|
||||||
|
code_ += "template<> struct {{NAME}}UnionTraits<" + name + "> {";
|
||||||
|
}
|
||||||
|
|
||||||
|
auto value = GetEnumValUse(enum_def, ev);
|
||||||
|
code_ += " static const {{ENUM_NAME}} enum_value = " + value + ";";
|
||||||
|
code_ += "};";
|
||||||
|
code_ += "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
code_ += "struct {{NAME}}Union {";
|
code_ += "struct {{NAME}}Union {";
|
||||||
code_ += " {{NAME}} type;";
|
code_ += " {{NAME}} type;";
|
||||||
code_ += " void *value;";
|
code_ += " void *value;";
|
||||||
@@ -1341,10 +1360,9 @@ class CppGenerator : public BaseGenerator {
|
|||||||
if (!enum_def.uses_multiple_type_instances) {
|
if (!enum_def.uses_multiple_type_instances) {
|
||||||
code_ += " template <typename T>";
|
code_ += " template <typename T>";
|
||||||
code_ += " void Set(T&& val) {";
|
code_ += " void Set(T&& val) {";
|
||||||
code_ += " using RT = typename std::remove_reference<T>::type;";
|
code_ += " typedef typename std::remove_reference<T>::type RT;";
|
||||||
code_ += " Reset();";
|
code_ += " Reset();";
|
||||||
code_ +=
|
code_ += " type = {{NAME}}UnionTraits<RT>::enum_value;";
|
||||||
" type = {{NAME}}Traits<typename RT::TableType>::enum_value;";
|
|
||||||
code_ += " if (type != {{NONE}}) {";
|
code_ += " if (type != {{NONE}}) {";
|
||||||
code_ += " value = new RT(std::forward<T>(val));";
|
code_ += " value = new RT(std::forward<T>(val));";
|
||||||
code_ += " }";
|
code_ += " }";
|
||||||
@@ -1494,6 +1512,7 @@ class CppGenerator : public BaseGenerator {
|
|||||||
if (opts_.generate_object_based_api) {
|
if (opts_.generate_object_based_api) {
|
||||||
// Generate union Unpack() and Pack() functions.
|
// Generate union Unpack() and Pack() functions.
|
||||||
code_ += "inline " + UnionUnPackSignature(enum_def, false) + " {";
|
code_ += "inline " + UnionUnPackSignature(enum_def, false) + " {";
|
||||||
|
code_ += " (void)resolver;";
|
||||||
code_ += " switch (type) {";
|
code_ += " switch (type) {";
|
||||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
||||||
++it) {
|
++it) {
|
||||||
@@ -1524,6 +1543,7 @@ class CppGenerator : public BaseGenerator {
|
|||||||
code_ += "";
|
code_ += "";
|
||||||
|
|
||||||
code_ += "inline " + UnionPackSignature(enum_def, false) + " {";
|
code_ += "inline " + UnionPackSignature(enum_def, false) + " {";
|
||||||
|
code_ += " (void)_rehasher;";
|
||||||
code_ += " switch (type) {";
|
code_ += " switch (type) {";
|
||||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
||||||
++it) {
|
++it) {
|
||||||
|
|||||||
@@ -71,6 +71,53 @@ public struct CharacterUnion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public enum Gadget: UInt8, UnionEnum {
|
||||||
|
public typealias T = UInt8
|
||||||
|
|
||||||
|
public init?(value: T) {
|
||||||
|
self.init(rawValue: value)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static var byteSize: Int { return MemoryLayout<UInt8>.size }
|
||||||
|
public var value: UInt8 { return self.rawValue }
|
||||||
|
case none_ = 0
|
||||||
|
case fallingtub = 1
|
||||||
|
case handfan = 2
|
||||||
|
|
||||||
|
public static var max: Gadget { return .handfan }
|
||||||
|
public static var min: Gadget { return .none_ }
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Gadget: Encodable {
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.singleValueContainer()
|
||||||
|
switch self {
|
||||||
|
case .none_: try container.encode("NONE")
|
||||||
|
case .fallingtub: try container.encode("FallingTub")
|
||||||
|
case .handfan: try container.encode("HandFan")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct GadgetUnion {
|
||||||
|
public var type: Gadget
|
||||||
|
public var value: NativeObject?
|
||||||
|
public init(_ v: NativeObject?, type: Gadget) {
|
||||||
|
self.type = type
|
||||||
|
self.value = v
|
||||||
|
}
|
||||||
|
public func pack(builder: inout FlatBufferBuilder) -> Offset {
|
||||||
|
switch type {
|
||||||
|
case .fallingtub:
|
||||||
|
var __obj = value as? FallingTub
|
||||||
|
return FallingTub_Mutable.pack(&builder, obj: &__obj)
|
||||||
|
case .handfan:
|
||||||
|
var __obj = value as? HandFanT
|
||||||
|
return HandFan.pack(&builder, obj: &__obj)
|
||||||
|
default: return Offset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public struct Rapunzel: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
|
public struct Rapunzel: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
|
||||||
|
|
||||||
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||||
@@ -207,6 +254,74 @@ public struct BookReader_Mutable: FlatBufferObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct FallingTub: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
|
||||||
|
|
||||||
|
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||||
|
|
||||||
|
private var _weight: Int32
|
||||||
|
|
||||||
|
public init(_ bb: ByteBuffer, o: Int32) {
|
||||||
|
let _accessor = Struct(bb: bb, position: o)
|
||||||
|
_weight = _accessor.readBuffer(of: Int32.self, at: 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(weight: Int32) {
|
||||||
|
_weight = weight
|
||||||
|
}
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
_weight = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(_ _t: inout FallingTub_Mutable) {
|
||||||
|
_weight = _t.weight
|
||||||
|
}
|
||||||
|
|
||||||
|
public var weight: Int32 { _weight }
|
||||||
|
|
||||||
|
public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
|
||||||
|
try verifier.inBuffer(position: position, of: FallingTub.self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension FallingTub: Encodable {
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case weight = "weight"
|
||||||
|
}
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
if weight != 0 {
|
||||||
|
try container.encodeIfPresent(weight, forKey: .weight)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct FallingTub_Mutable: FlatBufferObject {
|
||||||
|
|
||||||
|
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||||
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||||
|
private var _accessor: Struct
|
||||||
|
|
||||||
|
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||||
|
|
||||||
|
public var weight: Int32 { return _accessor.readBuffer(of: Int32.self, at: 0) }
|
||||||
|
@discardableResult public func mutate(weight: Int32) -> Bool { return _accessor.mutate(weight, index: 0) }
|
||||||
|
|
||||||
|
|
||||||
|
public mutating func unpack() -> FallingTub {
|
||||||
|
return FallingTub(&self)
|
||||||
|
}
|
||||||
|
public static func pack(_ builder: inout FlatBufferBuilder, obj: inout FallingTub?) -> Offset {
|
||||||
|
guard var obj = obj else { return Offset() }
|
||||||
|
return pack(&builder, obj: &obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func pack(_ builder: inout FlatBufferBuilder, obj: inout FallingTub) -> Offset {
|
||||||
|
return builder.create(struct: obj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public struct Attacker: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
public struct Attacker: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||||
|
|
||||||
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||||
@@ -288,6 +403,88 @@ public class AttackerT: NativeObject {
|
|||||||
|
|
||||||
public func serialize() -> ByteBuffer { return serialize(type: Attacker.self) }
|
public func serialize() -> ByteBuffer { return serialize(type: Attacker.self) }
|
||||||
|
|
||||||
|
}
|
||||||
|
public struct HandFan: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||||
|
|
||||||
|
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||||
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||||
|
private var _accessor: Table
|
||||||
|
|
||||||
|
public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MOVI", addPrefix: prefix) }
|
||||||
|
public static func getRootAsHandFan(bb: ByteBuffer) -> HandFan { return HandFan(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
|
||||||
|
|
||||||
|
private init(_ t: Table) { _accessor = t }
|
||||||
|
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
|
||||||
|
|
||||||
|
private enum VTOFFSET: VOffset {
|
||||||
|
case length = 4
|
||||||
|
var v: Int32 { Int32(self.rawValue) }
|
||||||
|
var p: VOffset { self.rawValue }
|
||||||
|
}
|
||||||
|
|
||||||
|
public var length: Int32 { let o = _accessor.offset(VTOFFSET.length.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||||
|
@discardableResult public func mutate(length: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.length.v); return _accessor.mutate(length, index: o) }
|
||||||
|
public static func startHandFan(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
||||||
|
public static func add(length: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: length, def: 0, at: VTOFFSET.length.p) }
|
||||||
|
public static func endHandFan(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
|
||||||
|
public static func createHandFan(
|
||||||
|
_ fbb: inout FlatBufferBuilder,
|
||||||
|
length: Int32 = 0
|
||||||
|
) -> Offset {
|
||||||
|
let __start = HandFan.startHandFan(&fbb)
|
||||||
|
HandFan.add(length: length, &fbb)
|
||||||
|
return HandFan.endHandFan(&fbb, start: __start)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public mutating func unpack() -> HandFanT {
|
||||||
|
return HandFanT(&self)
|
||||||
|
}
|
||||||
|
public static func pack(_ builder: inout FlatBufferBuilder, obj: inout HandFanT?) -> Offset {
|
||||||
|
guard var obj = obj else { return Offset() }
|
||||||
|
return pack(&builder, obj: &obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func pack(_ builder: inout FlatBufferBuilder, obj: inout HandFanT) -> Offset {
|
||||||
|
let __root = HandFan.startHandFan(&builder)
|
||||||
|
HandFan.add(length: obj.length, &builder)
|
||||||
|
return HandFan.endHandFan(&builder, start: __root)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
|
||||||
|
var _v = try verifier.visitTable(at: position)
|
||||||
|
try _v.visit(field: VTOFFSET.length.p, fieldName: "length", required: false, type: Int32.self)
|
||||||
|
_v.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension HandFan: Encodable {
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case length = "length"
|
||||||
|
}
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
if length != 0 {
|
||||||
|
try container.encodeIfPresent(length, forKey: .length)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HandFanT: NativeObject {
|
||||||
|
|
||||||
|
public var length: Int32
|
||||||
|
|
||||||
|
public init(_ _t: inout HandFan) {
|
||||||
|
length = _t.length
|
||||||
|
}
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
length = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
public func serialize() -> ByteBuffer { return serialize(type: HandFan.self) }
|
||||||
|
|
||||||
}
|
}
|
||||||
public struct Movie: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
public struct Movie: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,22 @@ template<> struct AnyTraits<MyGame::Example2::Monster> {
|
|||||||
static const Any enum_value = Any::MyGame_Example2_Monster;
|
static const Any enum_value = Any::MyGame_Example2_Monster;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct AnyUnionTraits {
|
||||||
|
static const Any enum_value = Any::NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example::MonsterT> {
|
||||||
|
static const Any enum_value = Any::Monster;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
|
||||||
|
static const Any enum_value = Any::TestSimpleTableWithEnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example2::MonsterT> {
|
||||||
|
static const Any enum_value = Any::MyGame_Example2_Monster;
|
||||||
|
};
|
||||||
|
|
||||||
struct AnyUnion {
|
struct AnyUnion {
|
||||||
Any type;
|
Any type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -231,9 +247,9 @@ struct AnyUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = AnyTraits<typename RT::TableType>::enum_value;
|
type = AnyUnionTraits<RT>::enum_value;
|
||||||
if (type != Any::NONE) {
|
if (type != Any::NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -323,6 +339,22 @@ template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
|
|||||||
static const AnyUniqueAliases enum_value = AnyUniqueAliases::M2;
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases::M2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct AnyUniqueAliasesUnionTraits {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases::NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::MonsterT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases::M;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases::TS;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example2::MonsterT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases::M2;
|
||||||
|
};
|
||||||
|
|
||||||
struct AnyUniqueAliasesUnion {
|
struct AnyUniqueAliasesUnion {
|
||||||
AnyUniqueAliases type;
|
AnyUniqueAliases type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -342,9 +374,9 @@ struct AnyUniqueAliasesUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = AnyUniqueAliasesTraits<typename RT::TableType>::enum_value;
|
type = AnyUniqueAliasesUnionTraits<RT>::enum_value;
|
||||||
if (type != AnyUniqueAliases::NONE) {
|
if (type != AnyUniqueAliases::NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -2936,6 +2968,7 @@ inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Any::Monster: {
|
case Any::Monster: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -2954,6 +2987,7 @@ inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::reso
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Any::Monster: {
|
case Any::Monster: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
@@ -3047,6 +3081,7 @@ inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyUniqueAliases::M: {
|
case AnyUniqueAliases::M: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -3065,6 +3100,7 @@ inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyUniqueAliases::M: {
|
case AnyUniqueAliases::M: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
@@ -3158,6 +3194,7 @@ inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyAmbiguousAliases::M1: {
|
case AnyAmbiguousAliases::M1: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -3176,6 +3213,7 @@ inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAlias
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyAmbiguousAliases::M1: {
|
case AnyAmbiguousAliases::M1: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ struct Rapunzel;
|
|||||||
|
|
||||||
struct BookReader;
|
struct BookReader;
|
||||||
|
|
||||||
|
struct FallingTub;
|
||||||
|
|
||||||
|
struct HandFan;
|
||||||
|
struct HandFanBuilder;
|
||||||
|
struct HandFanT;
|
||||||
|
|
||||||
struct Movie;
|
struct Movie;
|
||||||
struct MovieBuilder;
|
struct MovieBuilder;
|
||||||
struct MovieT;
|
struct MovieT;
|
||||||
@@ -24,6 +30,10 @@ inline const flatbuffers::TypeTable *RapunzelTypeTable();
|
|||||||
|
|
||||||
inline const flatbuffers::TypeTable *BookReaderTypeTable();
|
inline const flatbuffers::TypeTable *BookReaderTypeTable();
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *FallingTubTypeTable();
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *HandFanTypeTable();
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *MovieTypeTable();
|
inline const flatbuffers::TypeTable *MovieTypeTable();
|
||||||
|
|
||||||
enum class Character : uint8_t {
|
enum class Character : uint8_t {
|
||||||
@@ -144,6 +154,114 @@ struct CharacterUnion {
|
|||||||
bool VerifyCharacter(flatbuffers::Verifier &verifier, const void *obj, Character type);
|
bool VerifyCharacter(flatbuffers::Verifier &verifier, const void *obj, Character type);
|
||||||
bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<Character> *types);
|
bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<Character> *types);
|
||||||
|
|
||||||
|
enum class Gadget : uint8_t {
|
||||||
|
NONE = 0,
|
||||||
|
FallingTub = 1,
|
||||||
|
HandFan = 2,
|
||||||
|
MIN = NONE,
|
||||||
|
MAX = HandFan
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const Gadget (&EnumValuesGadget())[3] {
|
||||||
|
static const Gadget values[] = {
|
||||||
|
Gadget::NONE,
|
||||||
|
Gadget::FallingTub,
|
||||||
|
Gadget::HandFan
|
||||||
|
};
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char * const *EnumNamesGadget() {
|
||||||
|
static const char * const names[4] = {
|
||||||
|
"NONE",
|
||||||
|
"FallingTub",
|
||||||
|
"HandFan",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *EnumNameGadget(Gadget e) {
|
||||||
|
if (flatbuffers::IsOutRange(e, Gadget::NONE, Gadget::HandFan)) return "";
|
||||||
|
const size_t index = static_cast<size_t>(e);
|
||||||
|
return EnumNamesGadget()[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T> struct GadgetTraits {
|
||||||
|
static const Gadget enum_value = Gadget::NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetTraits<FallingTub> {
|
||||||
|
static const Gadget enum_value = Gadget::FallingTub;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetTraits<HandFan> {
|
||||||
|
static const Gadget enum_value = Gadget::HandFan;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T> struct GadgetUnionTraits {
|
||||||
|
static const Gadget enum_value = Gadget::NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetUnionTraits<FallingTub> {
|
||||||
|
static const Gadget enum_value = Gadget::FallingTub;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetUnionTraits<HandFanT> {
|
||||||
|
static const Gadget enum_value = Gadget::HandFan;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GadgetUnion {
|
||||||
|
Gadget type;
|
||||||
|
void *value;
|
||||||
|
|
||||||
|
GadgetUnion() : type(Gadget::NONE), value(nullptr) {}
|
||||||
|
GadgetUnion(GadgetUnion&& u) FLATBUFFERS_NOEXCEPT :
|
||||||
|
type(Gadget::NONE), value(nullptr)
|
||||||
|
{ std::swap(type, u.type); std::swap(value, u.value); }
|
||||||
|
GadgetUnion(const GadgetUnion &);
|
||||||
|
GadgetUnion &operator=(const GadgetUnion &u)
|
||||||
|
{ GadgetUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
|
||||||
|
GadgetUnion &operator=(GadgetUnion &&u) FLATBUFFERS_NOEXCEPT
|
||||||
|
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
|
||||||
|
~GadgetUnion() { Reset(); }
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void Set(T&& val) {
|
||||||
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
|
Reset();
|
||||||
|
type = GadgetUnionTraits<RT>::enum_value;
|
||||||
|
if (type != Gadget::NONE) {
|
||||||
|
value = new RT(std::forward<T>(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *UnPack(const void *obj, Gadget type, const flatbuffers::resolver_function_t *resolver);
|
||||||
|
flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||||
|
|
||||||
|
FallingTub *AsFallingTub() {
|
||||||
|
return type == Gadget::FallingTub ?
|
||||||
|
reinterpret_cast<FallingTub *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
const FallingTub *AsFallingTub() const {
|
||||||
|
return type == Gadget::FallingTub ?
|
||||||
|
reinterpret_cast<const FallingTub *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
HandFanT *AsHandFan() {
|
||||||
|
return type == Gadget::HandFan ?
|
||||||
|
reinterpret_cast<HandFanT *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
const HandFanT *AsHandFan() const {
|
||||||
|
return type == Gadget::HandFan ?
|
||||||
|
reinterpret_cast<const HandFanT *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool VerifyGadget(flatbuffers::Verifier &verifier, const void *obj, Gadget type);
|
||||||
|
bool VerifyGadgetVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<Gadget> *types);
|
||||||
|
|
||||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
||||||
private:
|
private:
|
||||||
int32_t hair_length_;
|
int32_t hair_length_;
|
||||||
@@ -226,6 +344,47 @@ struct BookReader::Traits {
|
|||||||
using FieldType = decltype(std::declval<type>().get_field<Index>());
|
using FieldType = decltype(std::declval<type>().get_field<Index>());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FallingTub FLATBUFFERS_FINAL_CLASS {
|
||||||
|
private:
|
||||||
|
int32_t weight_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct Traits;
|
||||||
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||||
|
return FallingTubTypeTable();
|
||||||
|
}
|
||||||
|
FallingTub()
|
||||||
|
: weight_(0) {
|
||||||
|
}
|
||||||
|
FallingTub(int32_t _weight)
|
||||||
|
: weight_(flatbuffers::EndianScalar(_weight)) {
|
||||||
|
}
|
||||||
|
int32_t weight() const {
|
||||||
|
return flatbuffers::EndianScalar(weight_);
|
||||||
|
}
|
||||||
|
void mutate_weight(int32_t _weight) {
|
||||||
|
flatbuffers::WriteScalar(&weight_, _weight);
|
||||||
|
}
|
||||||
|
template<size_t Index>
|
||||||
|
auto get_field() const {
|
||||||
|
if constexpr (Index == 0) return weight();
|
||||||
|
else static_assert(Index != Index, "Invalid Field Index");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FLATBUFFERS_STRUCT_END(FallingTub, 4);
|
||||||
|
|
||||||
|
struct FallingTub::Traits {
|
||||||
|
using type = FallingTub;
|
||||||
|
static constexpr auto name = "FallingTub";
|
||||||
|
static constexpr auto fully_qualified_name = "FallingTub";
|
||||||
|
static constexpr size_t fields_number = 1;
|
||||||
|
static constexpr std::array<const char *, fields_number> field_names = {
|
||||||
|
"weight"
|
||||||
|
};
|
||||||
|
template<size_t Index>
|
||||||
|
using FieldType = decltype(std::declval<type>().get_field<Index>());
|
||||||
|
};
|
||||||
|
|
||||||
struct AttackerT : public flatbuffers::NativeTable {
|
struct AttackerT : public flatbuffers::NativeTable {
|
||||||
typedef Attacker TableType;
|
typedef Attacker TableType;
|
||||||
int32_t sword_attack_damage = 0;
|
int32_t sword_attack_damage = 0;
|
||||||
@@ -303,6 +462,83 @@ struct Attacker::Traits {
|
|||||||
|
|
||||||
flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuilder &_fbb, const AttackerT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuilder &_fbb, const AttackerT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
|
struct HandFanT : public flatbuffers::NativeTable {
|
||||||
|
typedef HandFan TableType;
|
||||||
|
int32_t length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HandFan FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
|
typedef HandFanT NativeTableType;
|
||||||
|
typedef HandFanBuilder Builder;
|
||||||
|
struct Traits;
|
||||||
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||||
|
return HandFanTypeTable();
|
||||||
|
}
|
||||||
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
|
VT_LENGTH = 4
|
||||||
|
};
|
||||||
|
int32_t length() const {
|
||||||
|
return GetField<int32_t>(VT_LENGTH, 0);
|
||||||
|
}
|
||||||
|
bool mutate_length(int32_t _length = 0) {
|
||||||
|
return SetField<int32_t>(VT_LENGTH, _length, 0);
|
||||||
|
}
|
||||||
|
template<size_t Index>
|
||||||
|
auto get_field() const {
|
||||||
|
if constexpr (Index == 0) return length();
|
||||||
|
else static_assert(Index != Index, "Invalid Field Index");
|
||||||
|
}
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<int32_t>(verifier, VT_LENGTH) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
HandFanT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||||
|
void UnPackTo(HandFanT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||||
|
static flatbuffers::Offset<HandFan> Pack(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HandFanBuilder {
|
||||||
|
typedef HandFan Table;
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_length(int32_t length) {
|
||||||
|
fbb_.AddElement<int32_t>(HandFan::VT_LENGTH, length, 0);
|
||||||
|
}
|
||||||
|
explicit HandFanBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
|
: fbb_(_fbb) {
|
||||||
|
start_ = fbb_.StartTable();
|
||||||
|
}
|
||||||
|
flatbuffers::Offset<HandFan> Finish() {
|
||||||
|
const auto end = fbb_.EndTable(start_);
|
||||||
|
auto o = flatbuffers::Offset<HandFan>(end);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> CreateHandFan(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
int32_t length = 0) {
|
||||||
|
HandFanBuilder builder_(_fbb);
|
||||||
|
builder_.add_length(length);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HandFan::Traits {
|
||||||
|
using type = HandFan;
|
||||||
|
static auto constexpr Create = CreateHandFan;
|
||||||
|
static constexpr auto name = "HandFan";
|
||||||
|
static constexpr auto fully_qualified_name = "HandFan";
|
||||||
|
static constexpr size_t fields_number = 1;
|
||||||
|
static constexpr std::array<const char *, fields_number> field_names = {
|
||||||
|
"length"
|
||||||
|
};
|
||||||
|
template<size_t Index>
|
||||||
|
using FieldType = decltype(std::declval<type>().get_field<Index>());
|
||||||
|
};
|
||||||
|
|
||||||
|
flatbuffers::Offset<HandFan> CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct MovieT : public flatbuffers::NativeTable {
|
struct MovieT : public flatbuffers::NativeTable {
|
||||||
typedef Movie TableType;
|
typedef Movie TableType;
|
||||||
CharacterUnion main_character{};
|
CharacterUnion main_character{};
|
||||||
@@ -487,6 +723,32 @@ inline flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuild
|
|||||||
_sword_attack_damage);
|
_sword_attack_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline HandFanT *HandFan::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||||
|
auto _o = std::make_unique<HandFanT>();
|
||||||
|
UnPackTo(_o.get(), _resolver);
|
||||||
|
return _o.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void HandFan::UnPackTo(HandFanT *_o, const flatbuffers::resolver_function_t *_resolver) const {
|
||||||
|
(void)_o;
|
||||||
|
(void)_resolver;
|
||||||
|
{ auto _e = length(); _o->length = _e; }
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> HandFan::Pack(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||||
|
return CreateHandFan(_fbb, _o, _rehasher);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||||
|
(void)_rehasher;
|
||||||
|
(void)_o;
|
||||||
|
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const HandFanT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||||
|
auto _length = _o->length;
|
||||||
|
return CreateHandFan(
|
||||||
|
_fbb,
|
||||||
|
_length);
|
||||||
|
}
|
||||||
|
|
||||||
inline MovieT *Movie::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
inline MovieT *Movie::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||||
auto _o = std::make_unique<MovieT>();
|
auto _o = std::make_unique<MovieT>();
|
||||||
UnPackTo(_o.get(), _resolver);
|
UnPackTo(_o.get(), _resolver);
|
||||||
@@ -565,6 +827,7 @@ inline bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuf
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Character::MuLan: {
|
case Character::MuLan: {
|
||||||
auto ptr = reinterpret_cast<const Attacker *>(obj);
|
auto ptr = reinterpret_cast<const Attacker *>(obj);
|
||||||
@@ -595,6 +858,7 @@ inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatb
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> CharacterUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> CharacterUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Character::MuLan: {
|
case Character::MuLan: {
|
||||||
auto ptr = reinterpret_cast<const AttackerT *>(value);
|
auto ptr = reinterpret_cast<const AttackerT *>(value);
|
||||||
@@ -693,6 +957,97 @@ inline void CharacterUnion::Reset() {
|
|||||||
type = Character::NONE;
|
type = Character::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool VerifyGadget(flatbuffers::Verifier &verifier, const void *obj, Gadget type) {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget::NONE: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Gadget::FallingTub: {
|
||||||
|
return verifier.Verify<FallingTub>(static_cast<const uint8_t *>(obj), 0);
|
||||||
|
}
|
||||||
|
case Gadget::HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFan *>(obj);
|
||||||
|
return verifier.VerifyTable(ptr);
|
||||||
|
}
|
||||||
|
default: return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool VerifyGadgetVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<Gadget> *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 (!VerifyGadget(
|
||||||
|
verifier, values->Get(i), types->GetEnum<Gadget>(i))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void *GadgetUnion::UnPack(const void *obj, Gadget type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
|
switch (type) {
|
||||||
|
case Gadget::FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<const FallingTub *>(obj);
|
||||||
|
return new FallingTub(*ptr);
|
||||||
|
}
|
||||||
|
case Gadget::HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFan *>(obj);
|
||||||
|
return ptr->UnPack(resolver);
|
||||||
|
}
|
||||||
|
default: return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<void> GadgetUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
|
switch (type) {
|
||||||
|
case Gadget::FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<const FallingTub *>(value);
|
||||||
|
return _fbb.CreateStruct(*ptr).Union();
|
||||||
|
}
|
||||||
|
case Gadget::HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFanT *>(value);
|
||||||
|
return CreateHandFan(_fbb, ptr, _rehasher).Union();
|
||||||
|
}
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline GadgetUnion::GadgetUnion(const GadgetUnion &u) : type(u.type), value(nullptr) {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget::FallingTub: {
|
||||||
|
value = new FallingTub(*reinterpret_cast<FallingTub *>(u.value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Gadget::HandFan: {
|
||||||
|
value = new HandFanT(*reinterpret_cast<HandFanT *>(u.value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void GadgetUnion::Reset() {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget::FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<FallingTub *>(value);
|
||||||
|
delete ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Gadget::HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<HandFanT *>(value);
|
||||||
|
delete ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
value = nullptr;
|
||||||
|
type = Gadget::NONE;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||||
@@ -723,6 +1078,27 @@ inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
|||||||
return &tt;
|
return &tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *GadgetTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, 1 }
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeFunction type_refs[] = {
|
||||||
|
FallingTubTypeTable,
|
||||||
|
HandFanTypeTable
|
||||||
|
};
|
||||||
|
static const char * const names[] = {
|
||||||
|
"NONE",
|
||||||
|
"FallingTub",
|
||||||
|
"HandFan"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_UNION, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *AttackerTypeTable() {
|
inline const flatbuffers::TypeTable *AttackerTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_INT, 0, -1 }
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
@@ -764,6 +1140,33 @@ inline const flatbuffers::TypeTable *BookReaderTypeTable() {
|
|||||||
return &tt;
|
return &tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *FallingTubTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
|
};
|
||||||
|
static const int64_t values[] = { 0, 4 };
|
||||||
|
static const char * const names[] = {
|
||||||
|
"weight"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_STRUCT, 1, type_codes, nullptr, nullptr, values, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *HandFanTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
|
};
|
||||||
|
static const char * const names[] = {
|
||||||
|
"length"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *MovieTypeTable() {
|
inline const flatbuffers::TypeTable *MovieTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_UTYPE, 0, 0 },
|
{ flatbuffers::ET_UTYPE, 0, 0 },
|
||||||
|
|||||||
@@ -242,6 +242,22 @@ template<> struct AnyTraits<MyGame::Example2::Monster> {
|
|||||||
static const Any enum_value = Any_MyGame_Example2_Monster;
|
static const Any enum_value = Any_MyGame_Example2_Monster;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct AnyUnionTraits {
|
||||||
|
static const Any enum_value = Any_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example::MonsterT> {
|
||||||
|
static const Any enum_value = Any_Monster;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
|
||||||
|
static const Any enum_value = Any_TestSimpleTableWithEnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUnionTraits<MyGame::Example2::MonsterT> {
|
||||||
|
static const Any enum_value = Any_MyGame_Example2_Monster;
|
||||||
|
};
|
||||||
|
|
||||||
struct AnyUnion {
|
struct AnyUnion {
|
||||||
Any type;
|
Any type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -261,9 +277,9 @@ struct AnyUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = AnyTraits<typename RT::TableType>::enum_value;
|
type = AnyUnionTraits<RT>::enum_value;
|
||||||
if (type != Any_NONE) {
|
if (type != Any_NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -382,6 +398,22 @@ template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
|
|||||||
static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct AnyUniqueAliasesUnionTraits {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::MonsterT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example2::MonsterT> {
|
||||||
|
static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
|
||||||
|
};
|
||||||
|
|
||||||
struct AnyUniqueAliasesUnion {
|
struct AnyUniqueAliasesUnion {
|
||||||
AnyUniqueAliases type;
|
AnyUniqueAliases type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -401,9 +433,9 @@ struct AnyUniqueAliasesUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = AnyUniqueAliasesTraits<typename RT::TableType>::enum_value;
|
type = AnyUniqueAliasesUnionTraits<RT>::enum_value;
|
||||||
if (type != AnyUniqueAliases_NONE) {
|
if (type != AnyUniqueAliases_NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -2907,6 +2939,7 @@ inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Any_Monster: {
|
case Any_Monster: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -2925,6 +2958,7 @@ inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::reso
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Any_Monster: {
|
case Any_Monster: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
@@ -3018,6 +3052,7 @@ inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyUniqueAliases_M: {
|
case AnyUniqueAliases_M: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -3036,6 +3071,7 @@ inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyUniqueAliases_M: {
|
case AnyUniqueAliases_M: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
@@ -3129,6 +3165,7 @@ inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyAmbiguousAliases_M1: {
|
case AnyAmbiguousAliases_M1: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
|
||||||
@@ -3147,6 +3184,7 @@ inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAlias
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AnyAmbiguousAliases_M1: {
|
case AnyAmbiguousAliases_M1: {
|
||||||
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
|
||||||
|
|||||||
@@ -62,6 +62,14 @@ template<> struct UnionInNestedNSTraits<NamespaceA::NamespaceB::TableInNestedNS>
|
|||||||
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> struct UnionInNestedNSUnionTraits {
|
||||||
|
static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct UnionInNestedNSUnionTraits<NamespaceA::NamespaceB::TableInNestedNST> {
|
||||||
|
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||||
|
};
|
||||||
|
|
||||||
struct UnionInNestedNSUnion {
|
struct UnionInNestedNSUnion {
|
||||||
UnionInNestedNS type;
|
UnionInNestedNS type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -81,9 +89,9 @@ struct UnionInNestedNSUnion {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Set(T&& val) {
|
void Set(T&& val) {
|
||||||
using RT = typename std::remove_reference<T>::type;
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
Reset();
|
Reset();
|
||||||
type = UnionInNestedNSTraits<typename RT::TableType>::enum_value;
|
type = UnionInNestedNSUnionTraits<RT>::enum_value;
|
||||||
if (type != UnionInNestedNS_NONE) {
|
if (type != UnionInNestedNS_NONE) {
|
||||||
value = new RT(std::forward<T>(val));
|
value = new RT(std::forward<T>(val));
|
||||||
}
|
}
|
||||||
@@ -332,6 +340,7 @@ inline bool VerifyUnionInNestedNSVector(flatbuffers::Verifier &verifier, const f
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case UnionInNestedNS_TableInNestedNS: {
|
case UnionInNestedNS_TableInNestedNS: {
|
||||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
||||||
@@ -342,6 +351,7 @@ inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case UnionInNestedNS_TableInNestedNS: {
|
case UnionInNestedNS_TableInNestedNS: {
|
||||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "flatbuffers/minireflect.h"
|
#include "flatbuffers/minireflect.h"
|
||||||
#include "flatbuffers/registry.h"
|
#include "flatbuffers/registry.h"
|
||||||
#include "flatbuffers/util.h"
|
#include "flatbuffers/util.h"
|
||||||
|
|
||||||
#include "monster_test_generated.h"
|
#include "monster_test_generated.h"
|
||||||
#include "namespace_test/namespace_test1_generated.h"
|
#include "namespace_test/namespace_test1_generated.h"
|
||||||
#include "namespace_test/namespace_test2_generated.h"
|
#include "namespace_test/namespace_test2_generated.h"
|
||||||
@@ -2933,6 +2932,15 @@ void UnionVectorTest() {
|
|||||||
TEST_EQ(parser2.Parse("{a_type:Bool,a:{b:true}}"), true);
|
TEST_EQ(parser2.Parse("{a_type:Bool,a:{b:true}}"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StructUnionTest() {
|
||||||
|
GadgetUnion gadget;
|
||||||
|
gadget.Set(FallingTub(100));
|
||||||
|
|
||||||
|
HandFanT fan;
|
||||||
|
fan.length = 10;
|
||||||
|
gadget.Set(fan);
|
||||||
|
}
|
||||||
|
|
||||||
void ConformTest() {
|
void ConformTest() {
|
||||||
flatbuffers::Parser parser;
|
flatbuffers::Parser parser;
|
||||||
TEST_EQ(parser.Parse("table T { A:int; } enum E:byte { A }"), true);
|
TEST_EQ(parser.Parse("table T { A:int; } enum E:byte { A }"), true);
|
||||||
@@ -4187,6 +4195,7 @@ int FlatBufferTests() {
|
|||||||
FlexBuffersFloatingPointTest();
|
FlexBuffersFloatingPointTest();
|
||||||
FlatbuffersIteratorsTest();
|
FlatbuffersIteratorsTest();
|
||||||
FixedLengthArraySpanTest();
|
FixedLengthArraySpanTest();
|
||||||
|
StructUnionTest();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
49
tests/union_vector/FallingTub.cs
Normal file
49
tests/union_vector/FallingTub.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
using global::System;
|
||||||
|
using global::System.Collections.Generic;
|
||||||
|
using global::FlatBuffers;
|
||||||
|
|
||||||
|
public struct FallingTub : IFlatbufferObject
|
||||||
|
{
|
||||||
|
private Struct __p;
|
||||||
|
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||||
|
public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
|
||||||
|
public FallingTub __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||||
|
|
||||||
|
public int Weight { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
|
||||||
|
public void MutateWeight(int weight) { __p.bb.PutInt(__p.bb_pos + 0, weight); }
|
||||||
|
|
||||||
|
public static Offset<FallingTub> CreateFallingTub(FlatBufferBuilder builder, int Weight) {
|
||||||
|
builder.Prep(4, 4);
|
||||||
|
builder.PutInt(Weight);
|
||||||
|
return new Offset<FallingTub>(builder.Offset);
|
||||||
|
}
|
||||||
|
public FallingTubT UnPack() {
|
||||||
|
var _o = new FallingTubT();
|
||||||
|
this.UnPackTo(_o);
|
||||||
|
return _o;
|
||||||
|
}
|
||||||
|
public void UnPackTo(FallingTubT _o) {
|
||||||
|
_o.Weight = this.Weight;
|
||||||
|
}
|
||||||
|
public static Offset<FallingTub> Pack(FlatBufferBuilder builder, FallingTubT _o) {
|
||||||
|
if (_o == null) return default(Offset<FallingTub>);
|
||||||
|
return CreateFallingTub(
|
||||||
|
builder,
|
||||||
|
_o.Weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FallingTubT
|
||||||
|
{
|
||||||
|
[Newtonsoft.Json.JsonProperty("weight")]
|
||||||
|
public int Weight { get; set; }
|
||||||
|
|
||||||
|
public FallingTubT() {
|
||||||
|
this.Weight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
44
tests/union_vector/FallingTub.java
Normal file
44
tests/union_vector/FallingTub.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*;
|
||||||
|
import java.lang.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.google.flatbuffers.*;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public final class FallingTub extends Struct {
|
||||||
|
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||||
|
public FallingTub __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||||
|
|
||||||
|
public int weight() { return bb.getInt(bb_pos + 0); }
|
||||||
|
public void mutateWeight(int weight) { bb.putInt(bb_pos + 0, weight); }
|
||||||
|
|
||||||
|
public static int createFallingTub(FlatBufferBuilder builder, int weight) {
|
||||||
|
builder.prep(4, 4);
|
||||||
|
builder.putInt(weight);
|
||||||
|
return builder.offset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Vector extends BaseVector {
|
||||||
|
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||||
|
|
||||||
|
public FallingTub get(int j) { return get(new FallingTub(), j); }
|
||||||
|
public FallingTub get(FallingTub obj, int j) { return obj.__assign(__element(j), bb); }
|
||||||
|
}
|
||||||
|
public FallingTubT unpack() {
|
||||||
|
FallingTubT _o = new FallingTubT();
|
||||||
|
unpackTo(_o);
|
||||||
|
return _o;
|
||||||
|
}
|
||||||
|
public void unpackTo(FallingTubT _o) {
|
||||||
|
int _oWeight = weight();
|
||||||
|
_o.setWeight(_oWeight);
|
||||||
|
}
|
||||||
|
public static int pack(FlatBufferBuilder builder, FallingTubT _o) {
|
||||||
|
if (_o == null) return 0;
|
||||||
|
return createFallingTub(
|
||||||
|
builder,
|
||||||
|
_o.getWeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
27
tests/union_vector/FallingTub.kt
Normal file
27
tests/union_vector/FallingTub.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*
|
||||||
|
import kotlin.math.sign
|
||||||
|
import com.google.flatbuffers.*
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
|
class FallingTub : Struct() {
|
||||||
|
|
||||||
|
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||||
|
__reset(_i, _bb)
|
||||||
|
}
|
||||||
|
fun __assign(_i: Int, _bb: ByteBuffer) : FallingTub {
|
||||||
|
__init(_i, _bb)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
val weight : Int get() = bb.getInt(bb_pos + 0)
|
||||||
|
fun mutateWeight(weight: Int) : ByteBuffer = bb.putInt(bb_pos + 0, weight)
|
||||||
|
companion object {
|
||||||
|
fun createFallingTub(builder: FlatBufferBuilder, weight: Int) : Int {
|
||||||
|
builder.prep(4, 4)
|
||||||
|
builder.putInt(weight)
|
||||||
|
return builder.offset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
tests/union_vector/FallingTub.php
Normal file
41
tests/union_vector/FallingTub.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
use \Google\FlatBuffers\Struct;
|
||||||
|
use \Google\FlatBuffers\Table;
|
||||||
|
use \Google\FlatBuffers\ByteBuffer;
|
||||||
|
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||||
|
|
||||||
|
class FallingTub extends Struct
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param int $_i offset
|
||||||
|
* @param ByteBuffer $_bb
|
||||||
|
* @return FallingTub
|
||||||
|
**/
|
||||||
|
public function init($_i, ByteBuffer $_bb)
|
||||||
|
{
|
||||||
|
$this->bb_pos = $_i;
|
||||||
|
$this->bb = $_bb;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function GetWeight()
|
||||||
|
{
|
||||||
|
return $this->bb->getInt($this->bb_pos + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int offset
|
||||||
|
*/
|
||||||
|
public static function createFallingTub(FlatBufferBuilder $builder, $weight)
|
||||||
|
{
|
||||||
|
$builder->prep(4, 4);
|
||||||
|
$builder->putInt($weight);
|
||||||
|
return $builder->offset();
|
||||||
|
}
|
||||||
|
}
|
||||||
20
tests/union_vector/FallingTubT.java
Normal file
20
tests/union_vector/FallingTubT.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*;
|
||||||
|
import java.lang.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.google.flatbuffers.*;
|
||||||
|
|
||||||
|
public class FallingTubT {
|
||||||
|
private int weight;
|
||||||
|
|
||||||
|
public int getWeight() { return weight; }
|
||||||
|
|
||||||
|
public void setWeight(int weight) { this.weight = weight; }
|
||||||
|
|
||||||
|
|
||||||
|
public FallingTubT() {
|
||||||
|
this.weight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
78
tests/union_vector/Gadget.cs
Normal file
78
tests/union_vector/Gadget.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
|
public enum Gadget : byte
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
FallingTub = 1,
|
||||||
|
HandFan = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
public class GadgetUnion {
|
||||||
|
public Gadget Type { get; set; }
|
||||||
|
public object Value { get; set; }
|
||||||
|
|
||||||
|
public GadgetUnion() {
|
||||||
|
this.Type = Gadget.NONE;
|
||||||
|
this.Value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T As<T>() where T : class { return this.Value as T; }
|
||||||
|
public FallingTubT AsFallingTub() { return this.As<FallingTubT>(); }
|
||||||
|
public static GadgetUnion FromFallingTub(FallingTubT _fallingtub) { return new GadgetUnion{ Type = Gadget.FallingTub, Value = _fallingtub }; }
|
||||||
|
public HandFanT AsHandFan() { return this.As<HandFanT>(); }
|
||||||
|
public static GadgetUnion FromHandFan(HandFanT _handfan) { return new GadgetUnion{ Type = Gadget.HandFan, Value = _handfan }; }
|
||||||
|
|
||||||
|
public static int Pack(FlatBuffers.FlatBufferBuilder builder, GadgetUnion _o) {
|
||||||
|
switch (_o.Type) {
|
||||||
|
default: return 0;
|
||||||
|
case Gadget.FallingTub: return FallingTub.Pack(builder, _o.AsFallingTub()).Value;
|
||||||
|
case Gadget.HandFan: return HandFan.Pack(builder, _o.AsHandFan()).Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GadgetUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||||
|
public override bool CanConvert(System.Type objectType) {
|
||||||
|
return objectType == typeof(GadgetUnion) || objectType == typeof(System.Collections.Generic.List<GadgetUnion>);
|
||||||
|
}
|
||||||
|
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
|
||||||
|
var _olist = value as System.Collections.Generic.List<GadgetUnion>;
|
||||||
|
if (_olist != null) {
|
||||||
|
writer.WriteStartArray();
|
||||||
|
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
|
||||||
|
writer.WriteEndArray();
|
||||||
|
} else {
|
||||||
|
this.WriteJson(writer, value as GadgetUnion, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void WriteJson(Newtonsoft.Json.JsonWriter writer, GadgetUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||||
|
if (_o == null) return;
|
||||||
|
serializer.Serialize(writer, _o.Value);
|
||||||
|
}
|
||||||
|
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
|
||||||
|
var _olist = existingValue as System.Collections.Generic.List<GadgetUnion>;
|
||||||
|
if (_olist != null) {
|
||||||
|
for (var _j = 0; _j < _olist.Count; ++_j) {
|
||||||
|
reader.Read();
|
||||||
|
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
|
||||||
|
}
|
||||||
|
reader.Read();
|
||||||
|
return _olist;
|
||||||
|
} else {
|
||||||
|
return this.ReadJson(reader, existingValue as GadgetUnion, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public GadgetUnion ReadJson(Newtonsoft.Json.JsonReader reader, GadgetUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||||
|
if (_o == null) return null;
|
||||||
|
switch (_o.Type) {
|
||||||
|
default: break;
|
||||||
|
case Gadget.FallingTub: _o.Value = serializer.Deserialize<FallingTubT>(reader); break;
|
||||||
|
case Gadget.HandFan: _o.Value = serializer.Deserialize<HandFanT>(reader); break;
|
||||||
|
}
|
||||||
|
return _o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
14
tests/union_vector/Gadget.java
Normal file
14
tests/union_vector/Gadget.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public final class Gadget {
|
||||||
|
private Gadget() { }
|
||||||
|
public static final byte NONE = 0;
|
||||||
|
public static final byte FallingTub = 1;
|
||||||
|
public static final byte HandFan = 2;
|
||||||
|
|
||||||
|
public static final String[] names = { "NONE", "FallingTub", "HandFan", };
|
||||||
|
|
||||||
|
public static String name(int e) { return names[e]; }
|
||||||
|
}
|
||||||
|
|
||||||
13
tests/union_vector/Gadget.kt
Normal file
13
tests/union_vector/Gadget.kt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
|
class Gadget private constructor() {
|
||||||
|
companion object {
|
||||||
|
const val NONE: UByte = 0u
|
||||||
|
const val FallingTub: UByte = 1u
|
||||||
|
const val HandFan: UByte = 2u
|
||||||
|
val names : Array<String> = arrayOf("NONE", "FallingTub", "HandFan")
|
||||||
|
fun name(e: Int) : String = names[e]
|
||||||
|
}
|
||||||
|
}
|
||||||
23
tests/union_vector/Gadget.php
Normal file
23
tests/union_vector/Gadget.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
class Gadget
|
||||||
|
{
|
||||||
|
const NONE = 0;
|
||||||
|
const FallingTub = 1;
|
||||||
|
const HandFan = 2;
|
||||||
|
|
||||||
|
private static $names = array(
|
||||||
|
Gadget::NONE=>"NONE",
|
||||||
|
Gadget::FallingTub=>"FallingTub",
|
||||||
|
Gadget::HandFan=>"HandFan",
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function Name($e)
|
||||||
|
{
|
||||||
|
if (!isset(self::$names[$e])) {
|
||||||
|
throw new \Exception();
|
||||||
|
}
|
||||||
|
return self::$names[$e];
|
||||||
|
}
|
||||||
|
}
|
||||||
33
tests/union_vector/GadgetUnion.java
Normal file
33
tests/union_vector/GadgetUnion.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import com.google.flatbuffers.FlatBufferBuilder;
|
||||||
|
|
||||||
|
public class GadgetUnion {
|
||||||
|
private byte type;
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public byte getType() { return type; }
|
||||||
|
|
||||||
|
public void setType(byte type) { this.type = type; }
|
||||||
|
|
||||||
|
public Object getValue() { return value; }
|
||||||
|
|
||||||
|
public void setValue(Object value) { this.value = value; }
|
||||||
|
|
||||||
|
public GadgetUnion() {
|
||||||
|
this.type = Gadget.NONE;
|
||||||
|
this.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FallingTubT asFallingTub() { return (FallingTubT) value; }
|
||||||
|
public HandFanT asHandFan() { return (HandFanT) value; }
|
||||||
|
|
||||||
|
public static int pack(FlatBufferBuilder builder, GadgetUnion _o) {
|
||||||
|
switch (_o.type) {
|
||||||
|
case Gadget.FallingTub: return FallingTub.pack(builder, _o.asFallingTub());
|
||||||
|
case Gadget.HandFan: return HandFan.pack(builder, _o.asHandFan());
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
60
tests/union_vector/HandFan.cs
Normal file
60
tests/union_vector/HandFan.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
using global::System;
|
||||||
|
using global::System.Collections.Generic;
|
||||||
|
using global::FlatBuffers;
|
||||||
|
|
||||||
|
public struct HandFan : IFlatbufferObject
|
||||||
|
{
|
||||||
|
private Table __p;
|
||||||
|
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||||
|
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
|
||||||
|
public static HandFan GetRootAsHandFan(ByteBuffer _bb) { return GetRootAsHandFan(_bb, new HandFan()); }
|
||||||
|
public static HandFan GetRootAsHandFan(ByteBuffer _bb, HandFan obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||||
|
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||||
|
public HandFan __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||||
|
|
||||||
|
public int Length { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||||
|
public bool MutateLength(int length) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, length); return true; } else { return false; } }
|
||||||
|
|
||||||
|
public static Offset<HandFan> CreateHandFan(FlatBufferBuilder builder,
|
||||||
|
int length = 0) {
|
||||||
|
builder.StartTable(1);
|
||||||
|
HandFan.AddLength(builder, length);
|
||||||
|
return HandFan.EndHandFan(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StartHandFan(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||||
|
public static void AddLength(FlatBufferBuilder builder, int length) { builder.AddInt(0, length, 0); }
|
||||||
|
public static Offset<HandFan> EndHandFan(FlatBufferBuilder builder) {
|
||||||
|
int o = builder.EndTable();
|
||||||
|
return new Offset<HandFan>(o);
|
||||||
|
}
|
||||||
|
public HandFanT UnPack() {
|
||||||
|
var _o = new HandFanT();
|
||||||
|
this.UnPackTo(_o);
|
||||||
|
return _o;
|
||||||
|
}
|
||||||
|
public void UnPackTo(HandFanT _o) {
|
||||||
|
_o.Length = this.Length;
|
||||||
|
}
|
||||||
|
public static Offset<HandFan> Pack(FlatBufferBuilder builder, HandFanT _o) {
|
||||||
|
if (_o == null) return default(Offset<HandFan>);
|
||||||
|
return CreateHandFan(
|
||||||
|
builder,
|
||||||
|
_o.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HandFanT
|
||||||
|
{
|
||||||
|
[Newtonsoft.Json.JsonProperty("length")]
|
||||||
|
public int Length { get; set; }
|
||||||
|
|
||||||
|
public HandFanT() {
|
||||||
|
this.Length = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
55
tests/union_vector/HandFan.java
Normal file
55
tests/union_vector/HandFan.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*;
|
||||||
|
import java.lang.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.google.flatbuffers.*;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public final class HandFan extends Table {
|
||||||
|
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
|
||||||
|
public static HandFan getRootAsHandFan(ByteBuffer _bb) { return getRootAsHandFan(_bb, new HandFan()); }
|
||||||
|
public static HandFan getRootAsHandFan(ByteBuffer _bb, HandFan obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||||
|
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||||
|
public HandFan __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||||
|
|
||||||
|
public int length() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||||
|
public boolean mutateLength(int length) { int o = __offset(4); if (o != 0) { bb.putInt(o + bb_pos, length); return true; } else { return false; } }
|
||||||
|
|
||||||
|
public static int createHandFan(FlatBufferBuilder builder,
|
||||||
|
int length) {
|
||||||
|
builder.startTable(1);
|
||||||
|
HandFan.addLength(builder, length);
|
||||||
|
return HandFan.endHandFan(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startHandFan(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||||
|
public static void addLength(FlatBufferBuilder builder, int length) { builder.addInt(0, length, 0); }
|
||||||
|
public static int endHandFan(FlatBufferBuilder builder) {
|
||||||
|
int o = builder.endTable();
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Vector extends BaseVector {
|
||||||
|
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||||
|
|
||||||
|
public HandFan get(int j) { return get(new HandFan(), j); }
|
||||||
|
public HandFan get(HandFan obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||||
|
}
|
||||||
|
public HandFanT unpack() {
|
||||||
|
HandFanT _o = new HandFanT();
|
||||||
|
unpackTo(_o);
|
||||||
|
return _o;
|
||||||
|
}
|
||||||
|
public void unpackTo(HandFanT _o) {
|
||||||
|
int _oLength = length();
|
||||||
|
_o.setLength(_oLength);
|
||||||
|
}
|
||||||
|
public static int pack(FlatBufferBuilder builder, HandFanT _o) {
|
||||||
|
if (_o == null) return 0;
|
||||||
|
return createHandFan(
|
||||||
|
builder,
|
||||||
|
_o.getLength());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
tests/union_vector/HandFan.kt
Normal file
51
tests/union_vector/HandFan.kt
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*
|
||||||
|
import kotlin.math.sign
|
||||||
|
import com.google.flatbuffers.*
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
|
class HandFan : Table() {
|
||||||
|
|
||||||
|
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||||
|
__reset(_i, _bb)
|
||||||
|
}
|
||||||
|
fun __assign(_i: Int, _bb: ByteBuffer) : HandFan {
|
||||||
|
__init(_i, _bb)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
val length : Int
|
||||||
|
get() {
|
||||||
|
val o = __offset(4)
|
||||||
|
return if(o != 0) bb.getInt(o + bb_pos) else 0
|
||||||
|
}
|
||||||
|
fun mutateLength(length: Int) : Boolean {
|
||||||
|
val o = __offset(4)
|
||||||
|
return if (o != 0) {
|
||||||
|
bb.putInt(o + bb_pos, length)
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
companion object {
|
||||||
|
fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
|
||||||
|
fun getRootAsHandFan(_bb: ByteBuffer): HandFan = getRootAsHandFan(_bb, HandFan())
|
||||||
|
fun getRootAsHandFan(_bb: ByteBuffer, obj: HandFan): HandFan {
|
||||||
|
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
|
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||||
|
}
|
||||||
|
fun createHandFan(builder: FlatBufferBuilder, length: Int) : Int {
|
||||||
|
builder.startTable(1)
|
||||||
|
addLength(builder, length)
|
||||||
|
return endHandFan(builder)
|
||||||
|
}
|
||||||
|
fun startHandFan(builder: FlatBufferBuilder) = builder.startTable(1)
|
||||||
|
fun addLength(builder: FlatBufferBuilder, length: Int) = builder.addInt(0, length, 0)
|
||||||
|
fun endHandFan(builder: FlatBufferBuilder) : Int {
|
||||||
|
val o = builder.endTable()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
92
tests/union_vector/HandFan.php
Normal file
92
tests/union_vector/HandFan.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
use \Google\FlatBuffers\Struct;
|
||||||
|
use \Google\FlatBuffers\Table;
|
||||||
|
use \Google\FlatBuffers\ByteBuffer;
|
||||||
|
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||||
|
|
||||||
|
class HandFan extends Table
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param ByteBuffer $bb
|
||||||
|
* @return HandFan
|
||||||
|
*/
|
||||||
|
public static function getRootAsHandFan(ByteBuffer $bb)
|
||||||
|
{
|
||||||
|
$obj = new HandFan();
|
||||||
|
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function HandFanIdentifier()
|
||||||
|
{
|
||||||
|
return "MOVI";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function HandFanBufferHasIdentifier(ByteBuffer $buf)
|
||||||
|
{
|
||||||
|
return self::__has_identifier($buf, self::HandFanIdentifier());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $_i offset
|
||||||
|
* @param ByteBuffer $_bb
|
||||||
|
* @return HandFan
|
||||||
|
**/
|
||||||
|
public function init($_i, ByteBuffer $_bb)
|
||||||
|
{
|
||||||
|
$this->bb_pos = $_i;
|
||||||
|
$this->bb = $_bb;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getLength()
|
||||||
|
{
|
||||||
|
$o = $this->__offset(4);
|
||||||
|
return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FlatBufferBuilder $builder
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function startHandFan(FlatBufferBuilder $builder)
|
||||||
|
{
|
||||||
|
$builder->StartObject(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FlatBufferBuilder $builder
|
||||||
|
* @return HandFan
|
||||||
|
*/
|
||||||
|
public static function createHandFan(FlatBufferBuilder $builder, $length)
|
||||||
|
{
|
||||||
|
$builder->startObject(1);
|
||||||
|
self::addLength($builder, $length);
|
||||||
|
$o = $builder->endObject();
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FlatBufferBuilder $builder
|
||||||
|
* @param int
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function addLength(FlatBufferBuilder $builder, $length)
|
||||||
|
{
|
||||||
|
$builder->addIntX(0, $length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FlatBufferBuilder $builder
|
||||||
|
* @return int table offset
|
||||||
|
*/
|
||||||
|
public static function endHandFan(FlatBufferBuilder $builder)
|
||||||
|
{
|
||||||
|
$o = $builder->endObject();
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
tests/union_vector/HandFanT.java
Normal file
20
tests/union_vector/HandFanT.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import java.nio.*;
|
||||||
|
import java.lang.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.google.flatbuffers.*;
|
||||||
|
|
||||||
|
public class HandFanT {
|
||||||
|
private int length;
|
||||||
|
|
||||||
|
public int getLength() { return length; }
|
||||||
|
|
||||||
|
public void setLength(int length) { this.length = length; }
|
||||||
|
|
||||||
|
|
||||||
|
public HandFanT() {
|
||||||
|
this.length = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
63
tests/union_vector/falling-tub.ts
Normal file
63
tests/union_vector/falling-tub.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import * as flatbuffers from 'flatbuffers';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export class FallingTub {
|
||||||
|
bb: flatbuffers.ByteBuffer|null = null;
|
||||||
|
bb_pos = 0;
|
||||||
|
__init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
|
||||||
|
this.bb_pos = i;
|
||||||
|
this.bb = bb;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
weight():number {
|
||||||
|
return this.bb!.readInt32(this.bb_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
mutate_weight(value:number):boolean {
|
||||||
|
this.bb!.writeInt32(this.bb_pos + 0, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getFullyQualifiedName():string {
|
||||||
|
return 'FallingTub';
|
||||||
|
}
|
||||||
|
|
||||||
|
static sizeOf():number {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static createFallingTub(builder:flatbuffers.Builder, weight: number):flatbuffers.Offset {
|
||||||
|
builder.prep(4, 4);
|
||||||
|
builder.writeInt32(weight);
|
||||||
|
return builder.offset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unpack(): FallingTubT {
|
||||||
|
return new FallingTubT(
|
||||||
|
this.weight()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unpackTo(_o: FallingTubT): void {
|
||||||
|
_o.weight = this.weight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FallingTubT {
|
||||||
|
constructor(
|
||||||
|
public weight: number = 0
|
||||||
|
){}
|
||||||
|
|
||||||
|
|
||||||
|
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||||
|
return FallingTub.createFallingTub(builder,
|
||||||
|
this.weight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
tests/union_vector/gadget.ts
Normal file
37
tests/union_vector/gadget.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import { FallingTub, FallingTubT } from './falling-tub';
|
||||||
|
import { HandFan, HandFanT } from './hand-fan';
|
||||||
|
|
||||||
|
|
||||||
|
export enum Gadget{
|
||||||
|
NONE = 0,
|
||||||
|
FallingTub = 1,
|
||||||
|
HandFan = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unionToGadget(
|
||||||
|
type: Gadget,
|
||||||
|
accessor: (obj:FallingTub|HandFan) => FallingTub|HandFan|null
|
||||||
|
): FallingTub|HandFan|null {
|
||||||
|
switch(Gadget[type]) {
|
||||||
|
case 'NONE': return null;
|
||||||
|
case 'FallingTub': return accessor(new FallingTub())! as FallingTub;
|
||||||
|
case 'HandFan': return accessor(new HandFan())! as HandFan;
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unionListToGadget(
|
||||||
|
type: Gadget,
|
||||||
|
accessor: (index: number, obj:FallingTub|HandFan) => FallingTub|HandFan|null,
|
||||||
|
index: number
|
||||||
|
): FallingTub|HandFan|null {
|
||||||
|
switch(Gadget[type]) {
|
||||||
|
case 'NONE': return null;
|
||||||
|
case 'FallingTub': return accessor(index, new FallingTub())! as FallingTub;
|
||||||
|
case 'HandFan': return accessor(index, new HandFan())! as HandFan;
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
87
tests/union_vector/hand-fan.ts
Normal file
87
tests/union_vector/hand-fan.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
|
import * as flatbuffers from 'flatbuffers';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export class HandFan {
|
||||||
|
bb: flatbuffers.ByteBuffer|null = null;
|
||||||
|
bb_pos = 0;
|
||||||
|
__init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
|
||||||
|
this.bb_pos = i;
|
||||||
|
this.bb = bb;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getRootAsHandFan(bb:flatbuffers.ByteBuffer, obj?:HandFan):HandFan {
|
||||||
|
return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getSizePrefixedRootAsHandFan(bb:flatbuffers.ByteBuffer, obj?:HandFan):HandFan {
|
||||||
|
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||||
|
return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
length():number {
|
||||||
|
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||||
|
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutate_length(value:number):boolean {
|
||||||
|
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||||
|
|
||||||
|
if (offset === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bb!.writeInt32(this.bb_pos + offset, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getFullyQualifiedName():string {
|
||||||
|
return 'HandFan';
|
||||||
|
}
|
||||||
|
|
||||||
|
static startHandFan(builder:flatbuffers.Builder) {
|
||||||
|
builder.startObject(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static addLength(builder:flatbuffers.Builder, length:number) {
|
||||||
|
builder.addFieldInt32(0, length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static endHandFan(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||||
|
const offset = builder.endObject();
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static createHandFan(builder:flatbuffers.Builder, length:number):flatbuffers.Offset {
|
||||||
|
HandFan.startHandFan(builder);
|
||||||
|
HandFan.addLength(builder, length);
|
||||||
|
return HandFan.endHandFan(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
unpack(): HandFanT {
|
||||||
|
return new HandFanT(
|
||||||
|
this.length()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unpackTo(_o: HandFanT): void {
|
||||||
|
_o.length = this.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class HandFanT {
|
||||||
|
constructor(
|
||||||
|
public length: number = 0
|
||||||
|
){}
|
||||||
|
|
||||||
|
|
||||||
|
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||||
|
return HandFan.createHandFan(builder,
|
||||||
|
this.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,19 @@ union Character {
|
|||||||
Unused: string
|
Unused: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct FallingTub {
|
||||||
|
weight: int;
|
||||||
|
}
|
||||||
|
|
||||||
|
table HandFan {
|
||||||
|
length: int;
|
||||||
|
}
|
||||||
|
|
||||||
|
union Gadget {
|
||||||
|
FallingTub,
|
||||||
|
HandFan,
|
||||||
|
}
|
||||||
|
|
||||||
table Movie {
|
table Movie {
|
||||||
main_character: Character;
|
main_character: Character;
|
||||||
characters: [Character];
|
characters: [Character];
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
export { Attacker, AttackerT } from './attacker';
|
export { Attacker, AttackerT } from './attacker';
|
||||||
export { BookReader, BookReaderT } from './book-reader';
|
export { BookReader, BookReaderT } from './book-reader';
|
||||||
export { Character, unionToCharacter, unionListToCharacter } from './character';
|
export { Character, unionToCharacter, unionListToCharacter } from './character';
|
||||||
|
export { FallingTub, FallingTubT } from './falling-tub';
|
||||||
|
export { Gadget, unionToGadget, unionListToGadget } from './gadget';
|
||||||
|
export { HandFan, HandFanT } from './hand-fan';
|
||||||
export { Movie, MovieT } from './movie';
|
export { Movie, MovieT } from './movie';
|
||||||
export { Rapunzel, RapunzelT } from './rapunzel';
|
export { Rapunzel, RapunzelT } from './rapunzel';
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ struct Rapunzel;
|
|||||||
|
|
||||||
struct BookReader;
|
struct BookReader;
|
||||||
|
|
||||||
|
struct FallingTub;
|
||||||
|
|
||||||
|
struct HandFan;
|
||||||
|
struct HandFanBuilder;
|
||||||
|
struct HandFanT;
|
||||||
|
|
||||||
struct Movie;
|
struct Movie;
|
||||||
struct MovieBuilder;
|
struct MovieBuilder;
|
||||||
struct MovieT;
|
struct MovieT;
|
||||||
@@ -24,6 +30,10 @@ bool operator==(const Rapunzel &lhs, const Rapunzel &rhs);
|
|||||||
bool operator!=(const Rapunzel &lhs, const Rapunzel &rhs);
|
bool operator!=(const Rapunzel &lhs, const Rapunzel &rhs);
|
||||||
bool operator==(const BookReader &lhs, const BookReader &rhs);
|
bool operator==(const BookReader &lhs, const BookReader &rhs);
|
||||||
bool operator!=(const BookReader &lhs, const BookReader &rhs);
|
bool operator!=(const BookReader &lhs, const BookReader &rhs);
|
||||||
|
bool operator==(const FallingTub &lhs, const FallingTub &rhs);
|
||||||
|
bool operator!=(const FallingTub &lhs, const FallingTub &rhs);
|
||||||
|
bool operator==(const HandFanT &lhs, const HandFanT &rhs);
|
||||||
|
bool operator!=(const HandFanT &lhs, const HandFanT &rhs);
|
||||||
bool operator==(const MovieT &lhs, const MovieT &rhs);
|
bool operator==(const MovieT &lhs, const MovieT &rhs);
|
||||||
bool operator!=(const MovieT &lhs, const MovieT &rhs);
|
bool operator!=(const MovieT &lhs, const MovieT &rhs);
|
||||||
|
|
||||||
@@ -33,6 +43,10 @@ inline const flatbuffers::TypeTable *RapunzelTypeTable();
|
|||||||
|
|
||||||
inline const flatbuffers::TypeTable *BookReaderTypeTable();
|
inline const flatbuffers::TypeTable *BookReaderTypeTable();
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *FallingTubTypeTable();
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *HandFanTypeTable();
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *MovieTypeTable();
|
inline const flatbuffers::TypeTable *MovieTypeTable();
|
||||||
|
|
||||||
enum Character : uint8_t {
|
enum Character : uint8_t {
|
||||||
@@ -194,6 +208,139 @@ inline bool operator!=(const CharacterUnion &lhs, const CharacterUnion &rhs) {
|
|||||||
bool VerifyCharacter(flatbuffers::Verifier &verifier, const void *obj, Character type);
|
bool VerifyCharacter(flatbuffers::Verifier &verifier, const void *obj, Character type);
|
||||||
bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
|
bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
|
||||||
|
|
||||||
|
enum Gadget : uint8_t {
|
||||||
|
Gadget_NONE = 0,
|
||||||
|
Gadget_FallingTub = 1,
|
||||||
|
Gadget_HandFan = 2,
|
||||||
|
Gadget_MIN = Gadget_NONE,
|
||||||
|
Gadget_MAX = Gadget_HandFan
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const Gadget (&EnumValuesGadget())[3] {
|
||||||
|
static const Gadget values[] = {
|
||||||
|
Gadget_NONE,
|
||||||
|
Gadget_FallingTub,
|
||||||
|
Gadget_HandFan
|
||||||
|
};
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char * const *EnumNamesGadget() {
|
||||||
|
static const char * const names[4] = {
|
||||||
|
"NONE",
|
||||||
|
"FallingTub",
|
||||||
|
"HandFan",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *EnumNameGadget(Gadget e) {
|
||||||
|
if (flatbuffers::IsOutRange(e, Gadget_NONE, Gadget_HandFan)) return "";
|
||||||
|
const size_t index = static_cast<size_t>(e);
|
||||||
|
return EnumNamesGadget()[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T> struct GadgetTraits {
|
||||||
|
static const Gadget enum_value = Gadget_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetTraits<FallingTub> {
|
||||||
|
static const Gadget enum_value = Gadget_FallingTub;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetTraits<HandFan> {
|
||||||
|
static const Gadget enum_value = Gadget_HandFan;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T> struct GadgetUnionTraits {
|
||||||
|
static const Gadget enum_value = Gadget_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetUnionTraits<FallingTub> {
|
||||||
|
static const Gadget enum_value = Gadget_FallingTub;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct GadgetUnionTraits<HandFanT> {
|
||||||
|
static const Gadget enum_value = Gadget_HandFan;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GadgetUnion {
|
||||||
|
Gadget type;
|
||||||
|
void *value;
|
||||||
|
|
||||||
|
GadgetUnion() : type(Gadget_NONE), value(nullptr) {}
|
||||||
|
GadgetUnion(GadgetUnion&& u) FLATBUFFERS_NOEXCEPT :
|
||||||
|
type(Gadget_NONE), value(nullptr)
|
||||||
|
{ std::swap(type, u.type); std::swap(value, u.value); }
|
||||||
|
GadgetUnion(const GadgetUnion &);
|
||||||
|
GadgetUnion &operator=(const GadgetUnion &u)
|
||||||
|
{ GadgetUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
|
||||||
|
GadgetUnion &operator=(GadgetUnion &&u) FLATBUFFERS_NOEXCEPT
|
||||||
|
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
|
||||||
|
~GadgetUnion() { Reset(); }
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void Set(T&& val) {
|
||||||
|
typedef typename std::remove_reference<T>::type RT;
|
||||||
|
Reset();
|
||||||
|
type = GadgetUnionTraits<RT>::enum_value;
|
||||||
|
if (type != Gadget_NONE) {
|
||||||
|
value = new RT(std::forward<T>(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *UnPack(const void *obj, Gadget type, const flatbuffers::resolver_function_t *resolver);
|
||||||
|
flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||||
|
|
||||||
|
FallingTub *AsFallingTub() {
|
||||||
|
return type == Gadget_FallingTub ?
|
||||||
|
reinterpret_cast<FallingTub *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
const FallingTub *AsFallingTub() const {
|
||||||
|
return type == Gadget_FallingTub ?
|
||||||
|
reinterpret_cast<const FallingTub *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
HandFanT *AsHandFan() {
|
||||||
|
return type == Gadget_HandFan ?
|
||||||
|
reinterpret_cast<HandFanT *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
const HandFanT *AsHandFan() const {
|
||||||
|
return type == Gadget_HandFan ?
|
||||||
|
reinterpret_cast<const HandFanT *>(value) : nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline bool operator==(const GadgetUnion &lhs, const GadgetUnion &rhs) {
|
||||||
|
if (lhs.type != rhs.type) return false;
|
||||||
|
switch (lhs.type) {
|
||||||
|
case Gadget_NONE: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
return *(reinterpret_cast<const FallingTub *>(lhs.value)) ==
|
||||||
|
*(reinterpret_cast<const FallingTub *>(rhs.value));
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
return *(reinterpret_cast<const HandFanT *>(lhs.value)) ==
|
||||||
|
*(reinterpret_cast<const HandFanT *>(rhs.value));
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const GadgetUnion &lhs, const GadgetUnion &rhs) {
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VerifyGadget(flatbuffers::Verifier &verifier, const void *obj, Gadget type);
|
||||||
|
bool VerifyGadgetVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
|
||||||
|
|
||||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
||||||
private:
|
private:
|
||||||
int32_t hair_length_;
|
int32_t hair_length_;
|
||||||
@@ -266,6 +413,42 @@ inline bool operator!=(const BookReader &lhs, const BookReader &rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FallingTub FLATBUFFERS_FINAL_CLASS {
|
||||||
|
private:
|
||||||
|
int32_t weight_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||||
|
return FallingTubTypeTable();
|
||||||
|
}
|
||||||
|
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||||
|
return "FallingTub";
|
||||||
|
}
|
||||||
|
FallingTub()
|
||||||
|
: weight_(0) {
|
||||||
|
}
|
||||||
|
FallingTub(int32_t _weight)
|
||||||
|
: weight_(flatbuffers::EndianScalar(_weight)) {
|
||||||
|
}
|
||||||
|
int32_t weight() const {
|
||||||
|
return flatbuffers::EndianScalar(weight_);
|
||||||
|
}
|
||||||
|
void mutate_weight(int32_t _weight) {
|
||||||
|
flatbuffers::WriteScalar(&weight_, _weight);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FLATBUFFERS_STRUCT_END(FallingTub, 4);
|
||||||
|
|
||||||
|
inline bool operator==(const FallingTub &lhs, const FallingTub &rhs) {
|
||||||
|
return
|
||||||
|
(lhs.weight() == rhs.weight());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const FallingTub &lhs, const FallingTub &rhs) {
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct AttackerT : public flatbuffers::NativeTable {
|
struct AttackerT : public flatbuffers::NativeTable {
|
||||||
typedef Attacker TableType;
|
typedef Attacker TableType;
|
||||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||||
@@ -330,6 +513,70 @@ inline flatbuffers::Offset<Attacker> CreateAttacker(
|
|||||||
|
|
||||||
flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuilder &_fbb, const AttackerT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuilder &_fbb, const AttackerT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
|
struct HandFanT : public flatbuffers::NativeTable {
|
||||||
|
typedef HandFan TableType;
|
||||||
|
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||||
|
return "HandFanT";
|
||||||
|
}
|
||||||
|
int32_t length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HandFan FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
|
typedef HandFanT NativeTableType;
|
||||||
|
typedef HandFanBuilder Builder;
|
||||||
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||||
|
return HandFanTypeTable();
|
||||||
|
}
|
||||||
|
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||||
|
return "HandFan";
|
||||||
|
}
|
||||||
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||||
|
VT_LENGTH = 4
|
||||||
|
};
|
||||||
|
int32_t length() const {
|
||||||
|
return GetField<int32_t>(VT_LENGTH, 0);
|
||||||
|
}
|
||||||
|
bool mutate_length(int32_t _length = 0) {
|
||||||
|
return SetField<int32_t>(VT_LENGTH, _length, 0);
|
||||||
|
}
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<int32_t>(verifier, VT_LENGTH) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
HandFanT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||||
|
void UnPackTo(HandFanT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||||
|
static flatbuffers::Offset<HandFan> Pack(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HandFanBuilder {
|
||||||
|
typedef HandFan Table;
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_length(int32_t length) {
|
||||||
|
fbb_.AddElement<int32_t>(HandFan::VT_LENGTH, length, 0);
|
||||||
|
}
|
||||||
|
explicit HandFanBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
|
: fbb_(_fbb) {
|
||||||
|
start_ = fbb_.StartTable();
|
||||||
|
}
|
||||||
|
flatbuffers::Offset<HandFan> Finish() {
|
||||||
|
const auto end = fbb_.EndTable(start_);
|
||||||
|
auto o = flatbuffers::Offset<HandFan>(end);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> CreateHandFan(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
int32_t length = 0) {
|
||||||
|
HandFanBuilder builder_(_fbb);
|
||||||
|
builder_.add_length(length);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
flatbuffers::Offset<HandFan> CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||||
|
|
||||||
struct MovieT : public flatbuffers::NativeTable {
|
struct MovieT : public flatbuffers::NativeTable {
|
||||||
typedef Movie TableType;
|
typedef Movie TableType;
|
||||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||||
@@ -507,6 +754,43 @@ inline flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuild
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool operator==(const HandFanT &lhs, const HandFanT &rhs) {
|
||||||
|
return
|
||||||
|
(lhs.length == rhs.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const HandFanT &lhs, const HandFanT &rhs) {
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HandFanT *HandFan::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||||
|
auto _o = std::unique_ptr<HandFanT>(new HandFanT());
|
||||||
|
UnPackTo(_o.get(), _resolver);
|
||||||
|
return _o.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void HandFan::UnPackTo(HandFanT *_o, const flatbuffers::resolver_function_t *_resolver) const {
|
||||||
|
(void)_o;
|
||||||
|
(void)_resolver;
|
||||||
|
{ auto _e = length(); _o->length = _e; }
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> HandFan::Pack(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||||
|
return CreateHandFan(_fbb, _o, _rehasher);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<HandFan> CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, const HandFanT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||||
|
(void)_rehasher;
|
||||||
|
(void)_o;
|
||||||
|
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const HandFanT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||||
|
auto _length = _o->length;
|
||||||
|
return CreateHandFan(
|
||||||
|
_fbb,
|
||||||
|
_length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool operator==(const MovieT &lhs, const MovieT &rhs) {
|
inline bool operator==(const MovieT &lhs, const MovieT &rhs) {
|
||||||
return
|
return
|
||||||
(lhs.main_character == rhs.main_character) &&
|
(lhs.main_character == rhs.main_character) &&
|
||||||
@@ -596,6 +880,7 @@ inline bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuf
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatbuffers::resolver_function_t *resolver) {
|
inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Character_MuLan: {
|
case Character_MuLan: {
|
||||||
auto ptr = reinterpret_cast<const Attacker *>(obj);
|
auto ptr = reinterpret_cast<const Attacker *>(obj);
|
||||||
@@ -626,6 +911,7 @@ inline void *CharacterUnion::UnPack(const void *obj, Character type, const flatb
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline flatbuffers::Offset<void> CharacterUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
inline flatbuffers::Offset<void> CharacterUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Character_MuLan: {
|
case Character_MuLan: {
|
||||||
auto ptr = reinterpret_cast<const AttackerT *>(value);
|
auto ptr = reinterpret_cast<const AttackerT *>(value);
|
||||||
@@ -724,6 +1010,97 @@ inline void CharacterUnion::Reset() {
|
|||||||
type = Character_NONE;
|
type = Character_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool VerifyGadget(flatbuffers::Verifier &verifier, const void *obj, Gadget type) {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget_NONE: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
return verifier.Verify<FallingTub>(static_cast<const uint8_t *>(obj), 0);
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFan *>(obj);
|
||||||
|
return verifier.VerifyTable(ptr);
|
||||||
|
}
|
||||||
|
default: return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool VerifyGadgetVector(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 (!VerifyGadget(
|
||||||
|
verifier, values->Get(i), types->GetEnum<Gadget>(i))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void *GadgetUnion::UnPack(const void *obj, Gadget type, const flatbuffers::resolver_function_t *resolver) {
|
||||||
|
(void)resolver;
|
||||||
|
switch (type) {
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<const FallingTub *>(obj);
|
||||||
|
return new FallingTub(*ptr);
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFan *>(obj);
|
||||||
|
return ptr->UnPack(resolver);
|
||||||
|
}
|
||||||
|
default: return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<void> GadgetUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||||
|
(void)_rehasher;
|
||||||
|
switch (type) {
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<const FallingTub *>(value);
|
||||||
|
return _fbb.CreateStruct(*ptr).Union();
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<const HandFanT *>(value);
|
||||||
|
return CreateHandFan(_fbb, ptr, _rehasher).Union();
|
||||||
|
}
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline GadgetUnion::GadgetUnion(const GadgetUnion &u) : type(u.type), value(nullptr) {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
value = new FallingTub(*reinterpret_cast<FallingTub *>(u.value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
value = new HandFanT(*reinterpret_cast<HandFanT *>(u.value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void GadgetUnion::Reset() {
|
||||||
|
switch (type) {
|
||||||
|
case Gadget_FallingTub: {
|
||||||
|
auto ptr = reinterpret_cast<FallingTub *>(value);
|
||||||
|
delete ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Gadget_HandFan: {
|
||||||
|
auto ptr = reinterpret_cast<HandFanT *>(value);
|
||||||
|
delete ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
value = nullptr;
|
||||||
|
type = Gadget_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||||
@@ -754,6 +1131,27 @@ inline const flatbuffers::TypeTable *CharacterTypeTable() {
|
|||||||
return &tt;
|
return &tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *GadgetTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||||
|
{ flatbuffers::ET_SEQUENCE, 0, 1 }
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeFunction type_refs[] = {
|
||||||
|
FallingTubTypeTable,
|
||||||
|
HandFanTypeTable
|
||||||
|
};
|
||||||
|
static const char * const names[] = {
|
||||||
|
"NONE",
|
||||||
|
"FallingTub",
|
||||||
|
"HandFan"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_UNION, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *AttackerTypeTable() {
|
inline const flatbuffers::TypeTable *AttackerTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_INT, 0, -1 }
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
@@ -795,6 +1193,33 @@ inline const flatbuffers::TypeTable *BookReaderTypeTable() {
|
|||||||
return &tt;
|
return &tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *FallingTubTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
|
};
|
||||||
|
static const int64_t values[] = { 0, 4 };
|
||||||
|
static const char * const names[] = {
|
||||||
|
"weight"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_STRUCT, 1, type_codes, nullptr, nullptr, values, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const flatbuffers::TypeTable *HandFanTypeTable() {
|
||||||
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
|
{ flatbuffers::ET_INT, 0, -1 }
|
||||||
|
};
|
||||||
|
static const char * const names[] = {
|
||||||
|
"length"
|
||||||
|
};
|
||||||
|
static const flatbuffers::TypeTable tt = {
|
||||||
|
flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||||
|
};
|
||||||
|
return &tt;
|
||||||
|
}
|
||||||
|
|
||||||
inline const flatbuffers::TypeTable *MovieTypeTable() {
|
inline const flatbuffers::TypeTable *MovieTypeTable() {
|
||||||
static const flatbuffers::TypeCode type_codes[] = {
|
static const flatbuffers::TypeCode type_codes[] = {
|
||||||
{ flatbuffers::ET_UTYPE, 0, 0 },
|
{ flatbuffers::ET_UTYPE, 0, 0 },
|
||||||
|
|||||||
Reference in New Issue
Block a user