1 // automatically generated by the FlatBuffers compiler, do not modify 2 // swiftlint:disable all 3 // swiftformat:disable all 4 5 import FlatBuffers 6 7 /// Composite components of Monster color. 8 public enum MyGame_Example_Color: UInt8, Enum, Verifiable { 9 public typealias T = UInt8 10 public static var byteSize: Int { return MemoryLayout<UInt8>.size } 11 public var value: UInt8 { return self.rawValue } 12 case red = 1 13 /// \brief color Green 14 /// Green is bit_flag with value (1u << 1) 15 case green = 2 16 /// \brief color Blue (1u << 3) 17 case blue = 8 18 19 public static var max: MyGame_Example_Color { return .blue } 20 public static var min: MyGame_Example_Color { return .red } 21 } 22 23 extension MyGame_Example_Color: Encodable { encodenull24 public func encode(to encoder: Encoder) throws { 25 var container = encoder.singleValueContainer() 26 switch self { 27 case .red: try container.encode("Red") 28 case .green: try container.encode("Green") 29 case .blue: try container.encode("Blue") 30 } 31 } 32 } 33 34 public enum MyGame_Example_Race: Int8, Enum, Verifiable { 35 public typealias T = Int8 36 public static var byteSize: Int { return MemoryLayout<Int8>.size } 37 public var value: Int8 { return self.rawValue } 38 case none_ = -1 39 case human = 0 40 case dwarf = 1 41 case elf = 2 42 43 public static var max: MyGame_Example_Race { return .elf } 44 public static var min: MyGame_Example_Race { return .none_ } 45 } 46 47 extension MyGame_Example_Race: Encodable { encodenull48 public func encode(to encoder: Encoder) throws { 49 var container = encoder.singleValueContainer() 50 switch self { 51 case .none_: try container.encode("None") 52 case .human: try container.encode("Human") 53 case .dwarf: try container.encode("Dwarf") 54 case .elf: try container.encode("Elf") 55 } 56 } 57 } 58 59 public enum MyGame_Example_LongEnum: UInt64, Enum, Verifiable { 60 public typealias T = UInt64 61 public static var byteSize: Int { return MemoryLayout<UInt64>.size } 62 public var value: UInt64 { return self.rawValue } 63 case longone = 2 64 case longtwo = 4 65 case longbig = 1099511627776 66 67 public static var max: MyGame_Example_LongEnum { return .longbig } 68 public static var min: MyGame_Example_LongEnum { return .longone } 69 } 70 71 extension MyGame_Example_LongEnum: Encodable { encodenull72 public func encode(to encoder: Encoder) throws { 73 var container = encoder.singleValueContainer() 74 switch self { 75 case .longone: try container.encode("LongOne") 76 case .longtwo: try container.encode("LongTwo") 77 case .longbig: try container.encode("LongBig") 78 } 79 } 80 } 81 82 public enum MyGame_Example_Any_: UInt8, UnionEnum { 83 public typealias T = UInt8 84 85 public init?(value: T) { 86 self.init(rawValue: value) 87 } 88 89 public static var byteSize: Int { return MemoryLayout<UInt8>.size } 90 public var value: UInt8 { return self.rawValue } 91 case none_ = 0 92 case monster = 1 93 case testsimpletablewithenum = 2 94 case mygameExample2Monster = 3 95 96 public static var max: MyGame_Example_Any_ { return .mygameExample2Monster } 97 public static var min: MyGame_Example_Any_ { return .none_ } 98 } 99 100 extension MyGame_Example_Any_: Encodable { encodenull101 public func encode(to encoder: Encoder) throws { 102 var container = encoder.singleValueContainer() 103 switch self { 104 case .none_: try container.encode("NONE") 105 case .monster: try container.encode("Monster") 106 case .testsimpletablewithenum: try container.encode("TestSimpleTableWithEnum") 107 case .mygameExample2Monster: try container.encode("MyGame_Example2_Monster") 108 } 109 } 110 } 111 112 public struct MyGame_Example_Any_Union { 113 public var type: MyGame_Example_Any_ 114 public var value: NativeObject? 115 public init(_ v: NativeObject?, type: MyGame_Example_Any_) { 116 self.type = type 117 self.value = v 118 } packnull119 public func pack(builder: inout FlatBufferBuilder) -> Offset { 120 switch type { 121 case .monster: 122 var __obj = value as? MyGame_Example_MonsterT 123 return MyGame_Example_Monster.pack(&builder, obj: &__obj) 124 case .testsimpletablewithenum: 125 var __obj = value as? MyGame_Example_TestSimpleTableWithEnumT 126 return MyGame_Example_TestSimpleTableWithEnum.pack(&builder, obj: &__obj) 127 case .mygameExample2Monster: 128 var __obj = value as? MyGame_Example2_MonsterT 129 return MyGame_Example2_Monster.pack(&builder, obj: &__obj) 130 default: return Offset() 131 } 132 } 133 } 134 public enum MyGame_Example_AnyUniqueAliases: UInt8, UnionEnum { 135 public typealias T = UInt8 136 137 public init?(value: T) { 138 self.init(rawValue: value) 139 } 140 141 public static var byteSize: Int { return MemoryLayout<UInt8>.size } 142 public var value: UInt8 { return self.rawValue } 143 case none_ = 0 144 case m = 1 145 case ts = 2 146 case m2 = 3 147 148 public static var max: MyGame_Example_AnyUniqueAliases { return .m2 } 149 public static var min: MyGame_Example_AnyUniqueAliases { return .none_ } 150 } 151 152 extension MyGame_Example_AnyUniqueAliases: Encodable { encodenull153 public func encode(to encoder: Encoder) throws { 154 var container = encoder.singleValueContainer() 155 switch self { 156 case .none_: try container.encode("NONE") 157 case .m: try container.encode("M") 158 case .ts: try container.encode("TS") 159 case .m2: try container.encode("M2") 160 } 161 } 162 } 163 164 public struct MyGame_Example_AnyUniqueAliasesUnion { 165 public var type: MyGame_Example_AnyUniqueAliases 166 public var value: NativeObject? 167 public init(_ v: NativeObject?, type: MyGame_Example_AnyUniqueAliases) { 168 self.type = type 169 self.value = v 170 } packnull171 public func pack(builder: inout FlatBufferBuilder) -> Offset { 172 switch type { 173 case .m: 174 var __obj = value as? MyGame_Example_MonsterT 175 return MyGame_Example_Monster.pack(&builder, obj: &__obj) 176 case .ts: 177 var __obj = value as? MyGame_Example_TestSimpleTableWithEnumT 178 return MyGame_Example_TestSimpleTableWithEnum.pack(&builder, obj: &__obj) 179 case .m2: 180 var __obj = value as? MyGame_Example2_MonsterT 181 return MyGame_Example2_Monster.pack(&builder, obj: &__obj) 182 default: return Offset() 183 } 184 } 185 } 186 public enum MyGame_Example_AnyAmbiguousAliases: UInt8, UnionEnum { 187 public typealias T = UInt8 188 189 public init?(value: T) { 190 self.init(rawValue: value) 191 } 192 193 public static var byteSize: Int { return MemoryLayout<UInt8>.size } 194 public var value: UInt8 { return self.rawValue } 195 case none_ = 0 196 case m1 = 1 197 case m2 = 2 198 case m3 = 3 199 200 public static var max: MyGame_Example_AnyAmbiguousAliases { return .m3 } 201 public static var min: MyGame_Example_AnyAmbiguousAliases { return .none_ } 202 } 203 204 extension MyGame_Example_AnyAmbiguousAliases: Encodable { encodenull205 public func encode(to encoder: Encoder) throws { 206 var container = encoder.singleValueContainer() 207 switch self { 208 case .none_: try container.encode("NONE") 209 case .m1: try container.encode("M1") 210 case .m2: try container.encode("M2") 211 case .m3: try container.encode("M3") 212 } 213 } 214 } 215 216 public struct MyGame_Example_AnyAmbiguousAliasesUnion { 217 public var type: MyGame_Example_AnyAmbiguousAliases 218 public var value: NativeObject? 219 public init(_ v: NativeObject?, type: MyGame_Example_AnyAmbiguousAliases) { 220 self.type = type 221 self.value = v 222 } packnull223 public func pack(builder: inout FlatBufferBuilder) -> Offset { 224 switch type { 225 case .m1: 226 var __obj = value as? MyGame_Example_MonsterT 227 return MyGame_Example_Monster.pack(&builder, obj: &__obj) 228 case .m2: 229 var __obj = value as? MyGame_Example_MonsterT 230 return MyGame_Example_Monster.pack(&builder, obj: &__obj) 231 case .m3: 232 var __obj = value as? MyGame_Example_MonsterT 233 return MyGame_Example_Monster.pack(&builder, obj: &__obj) 234 default: return Offset() 235 } 236 } 237 } 238 public struct MyGame_Example_Test: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 239 validateVersionnull240 static func validateVersion() { FlatBuffersVersion_2_0_0() } 241 242 private var _a: Int16 243 private var _b: Int8 244 private let padding0__: UInt8 = 0 245 246 public init(_ bb: ByteBuffer, o: Int32) { 247 let _accessor = Struct(bb: bb, position: o) 248 _a = _accessor.readBuffer(of: Int16.self, at: 0) 249 _b = _accessor.readBuffer(of: Int8.self, at: 2) 250 } 251 252 public init(a: Int16, b: Int8) { 253 _a = a 254 _b = b 255 } 256 257 public init() { 258 _a = 0 259 _b = 0 260 } 261 262 public init(_ _t: inout MyGame_Example_Test_Mutable) { 263 _a = _t.a 264 _b = _t.b 265 } 266 267 public var a: Int16 { _a } 268 public var b: Int8 { _b } 269 verify<T>null270 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 271 try verifier.inBuffer(position: position, of: MyGame_Example_Test.self) 272 } 273 } 274 275 extension MyGame_Example_Test: Encodable { 276 277 enum CodingKeys: String, CodingKey { 278 case a = "a" 279 case b = "b" 280 } encodenull281 public func encode(to encoder: Encoder) throws { 282 var container = encoder.container(keyedBy: CodingKeys.self) 283 if a != 0 { 284 try container.encodeIfPresent(a, forKey: .a) 285 } 286 if b != 0 { 287 try container.encodeIfPresent(b, forKey: .b) 288 } 289 } 290 } 291 292 public struct MyGame_Example_Test_Mutable: FlatBufferObject { 293 validateVersionnull294 static func validateVersion() { FlatBuffersVersion_2_0_0() } 295 public var __buffer: ByteBuffer! { return _accessor.bb } 296 private var _accessor: Struct 297 298 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 299 300 public var a: Int16 { return _accessor.readBuffer(of: Int16.self, at: 0) } mutatenull301 @discardableResult public func mutate(a: Int16) -> Bool { return _accessor.mutate(a, index: 0) } 302 public var b: Int8 { return _accessor.readBuffer(of: Int8.self, at: 2) } mutatenull303 @discardableResult public func mutate(b: Int8) -> Bool { return _accessor.mutate(b, index: 2) } 304 305 unpacknull306 public mutating func unpack() -> MyGame_Example_Test { 307 return MyGame_Example_Test(&self) 308 } packnull309 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Test?) -> Offset { 310 guard var obj = obj else { return Offset() } 311 return pack(&builder, obj: &obj) 312 } 313 packnull314 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Test) -> Offset { 315 return builder.create(struct: obj) 316 } 317 } 318 319 public struct MyGame_Example_Vec3: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 320 validateVersionnull321 static func validateVersion() { FlatBuffersVersion_2_0_0() } 322 323 private var _x: Float32 324 private var _y: Float32 325 private var _z: Float32 326 private let padding0__: UInt32 = 0 327 private var _test1: Double 328 private var _test2: UInt8 329 private let padding1__: UInt8 = 0 330 private var _test3: MyGame_Example_Test 331 private let padding2__: UInt16 = 0 332 333 public init(_ bb: ByteBuffer, o: Int32) { 334 let _accessor = Struct(bb: bb, position: o) 335 _x = _accessor.readBuffer(of: Float32.self, at: 0) 336 _y = _accessor.readBuffer(of: Float32.self, at: 4) 337 _z = _accessor.readBuffer(of: Float32.self, at: 8) 338 _test1 = _accessor.readBuffer(of: Double.self, at: 16) 339 _test2 = _accessor.readBuffer(of: UInt8.self, at: 24) 340 _test3 = MyGame_Example_Test(_accessor.bb, o: _accessor.postion + 26) 341 } 342 343 public init(x: Float32, y: Float32, z: Float32, test1: Double, test2: MyGame_Example_Color, test3: MyGame_Example_Test) { 344 _x = x 345 _y = y 346 _z = z 347 _test1 = test1 348 _test2 = test2.value 349 _test3 = test3 350 } 351 352 public init() { 353 _x = 0.0 354 _y = 0.0 355 _z = 0.0 356 _test1 = 0.0 357 _test2 = 0 358 _test3 = MyGame_Example_Test() 359 } 360 361 public init(_ _t: inout MyGame_Example_Vec3_Mutable) { 362 _x = _t.x 363 _y = _t.y 364 _z = _t.z 365 _test1 = _t.test1 366 _test2 = _t.test2.value 367 var _vtest3 = _t.test3 368 _test3 = _vtest3.unpack() 369 } 370 371 public var x: Float32 { _x } 372 public var y: Float32 { _y } 373 public var z: Float32 { _z } 374 public var test1: Double { _test1 } 375 public var test2: MyGame_Example_Color { MyGame_Example_Color(rawValue: _test2)! } 376 public var test3: MyGame_Example_Test { _test3 } 377 verify<T>null378 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 379 try verifier.inBuffer(position: position, of: MyGame_Example_Vec3.self) 380 } 381 } 382 383 extension MyGame_Example_Vec3: Encodable { 384 385 enum CodingKeys: String, CodingKey { 386 case x = "x" 387 case y = "y" 388 case z = "z" 389 case test1 = "test1" 390 case test2 = "test2" 391 case test3 = "test3" 392 } encodenull393 public func encode(to encoder: Encoder) throws { 394 var container = encoder.container(keyedBy: CodingKeys.self) 395 if x != 0.0 { 396 try container.encodeIfPresent(x, forKey: .x) 397 } 398 if y != 0.0 { 399 try container.encodeIfPresent(y, forKey: .y) 400 } 401 if z != 0.0 { 402 try container.encodeIfPresent(z, forKey: .z) 403 } 404 if test1 != 0.0 { 405 try container.encodeIfPresent(test1, forKey: .test1) 406 } 407 if test2 != .red { 408 try container.encodeIfPresent(test2, forKey: .test2) 409 } 410 try container.encodeIfPresent(test3, forKey: .test3) 411 } 412 } 413 414 public struct MyGame_Example_Vec3_Mutable: FlatBufferObject { 415 validateVersionnull416 static func validateVersion() { FlatBuffersVersion_2_0_0() } 417 public var __buffer: ByteBuffer! { return _accessor.bb } 418 private var _accessor: Struct 419 420 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 421 422 public var x: Float32 { return _accessor.readBuffer(of: Float32.self, at: 0) } mutatenull423 @discardableResult public func mutate(x: Float32) -> Bool { return _accessor.mutate(x, index: 0) } 424 public var y: Float32 { return _accessor.readBuffer(of: Float32.self, at: 4) } mutatenull425 @discardableResult public func mutate(y: Float32) -> Bool { return _accessor.mutate(y, index: 4) } 426 public var z: Float32 { return _accessor.readBuffer(of: Float32.self, at: 8) } mutatenull427 @discardableResult public func mutate(z: Float32) -> Bool { return _accessor.mutate(z, index: 8) } 428 public var test1: Double { return _accessor.readBuffer(of: Double.self, at: 16) } mutatenull429 @discardableResult public func mutate(test1: Double) -> Bool { return _accessor.mutate(test1, index: 16) } 430 public var test2: MyGame_Example_Color { return MyGame_Example_Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: 24)) ?? .red } mutatenull431 @discardableResult public func mutate(test2: MyGame_Example_Color) -> Bool { return _accessor.mutate(test2.rawValue, index: 24) } 432 public var test3: MyGame_Example_Test_Mutable { return MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.postion + 26) } 433 434 unpacknull435 public mutating func unpack() -> MyGame_Example_Vec3 { 436 return MyGame_Example_Vec3(&self) 437 } packnull438 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Vec3?) -> Offset { 439 guard var obj = obj else { return Offset() } 440 return pack(&builder, obj: &obj) 441 } 442 packnull443 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Vec3) -> Offset { 444 return builder.create(struct: obj) 445 } 446 } 447 448 public struct MyGame_Example_Ability: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 449 validateVersionnull450 static func validateVersion() { FlatBuffersVersion_2_0_0() } 451 452 private var _id: UInt32 453 private var _distance: UInt32 454 455 public init(_ bb: ByteBuffer, o: Int32) { 456 let _accessor = Struct(bb: bb, position: o) 457 _id = _accessor.readBuffer(of: UInt32.self, at: 0) 458 _distance = _accessor.readBuffer(of: UInt32.self, at: 4) 459 } 460 461 public init(id: UInt32, distance: UInt32) { 462 _id = id 463 _distance = distance 464 } 465 466 public init() { 467 _id = 0 468 _distance = 0 469 } 470 471 public init(_ _t: inout MyGame_Example_Ability_Mutable) { 472 _id = _t.id 473 _distance = _t.distance 474 } 475 476 public var id: UInt32 { _id } 477 public var distance: UInt32 { _distance } 478 verify<T>null479 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 480 try verifier.inBuffer(position: position, of: MyGame_Example_Ability.self) 481 } 482 } 483 484 extension MyGame_Example_Ability: Encodable { 485 486 enum CodingKeys: String, CodingKey { 487 case id = "id" 488 case distance = "distance" 489 } encodenull490 public func encode(to encoder: Encoder) throws { 491 var container = encoder.container(keyedBy: CodingKeys.self) 492 if id != 0 { 493 try container.encodeIfPresent(id, forKey: .id) 494 } 495 if distance != 0 { 496 try container.encodeIfPresent(distance, forKey: .distance) 497 } 498 } 499 } 500 501 public struct MyGame_Example_Ability_Mutable: FlatBufferObject { 502 validateVersionnull503 static func validateVersion() { FlatBuffersVersion_2_0_0() } 504 public var __buffer: ByteBuffer! { return _accessor.bb } 505 private var _accessor: Struct 506 507 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 508 509 public var id: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 0) } mutatenull510 @discardableResult public func mutate(id: UInt32) -> Bool { return _accessor.mutate(id, index: 0) } 511 public var distance: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 4) } mutatenull512 @discardableResult public func mutate(distance: UInt32) -> Bool { return _accessor.mutate(distance, index: 4) } 513 514 unpacknull515 public mutating func unpack() -> MyGame_Example_Ability { 516 return MyGame_Example_Ability(&self) 517 } packnull518 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Ability?) -> Offset { 519 guard var obj = obj else { return Offset() } 520 return pack(&builder, obj: &obj) 521 } 522 packnull523 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_Ability) -> Offset { 524 return builder.create(struct: obj) 525 } 526 } 527 528 public struct MyGame_Example_StructOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 529 validateVersionnull530 static func validateVersion() { FlatBuffersVersion_2_0_0() } 531 532 private var _a: MyGame_Example_Ability 533 private var _b: MyGame_Example_Test 534 private var _c: MyGame_Example_Ability 535 536 public init(_ bb: ByteBuffer, o: Int32) { 537 let _accessor = Struct(bb: bb, position: o) 538 _a = MyGame_Example_Ability(_accessor.bb, o: _accessor.postion + 0) 539 _b = MyGame_Example_Test(_accessor.bb, o: _accessor.postion + 8) 540 _c = MyGame_Example_Ability(_accessor.bb, o: _accessor.postion + 12) 541 } 542 543 public init(a: MyGame_Example_Ability, b: MyGame_Example_Test, c: MyGame_Example_Ability) { 544 _a = a 545 _b = b 546 _c = c 547 } 548 549 public init() { 550 _a = MyGame_Example_Ability() 551 _b = MyGame_Example_Test() 552 _c = MyGame_Example_Ability() 553 } 554 555 public init(_ _t: inout MyGame_Example_StructOfStructs_Mutable) { 556 var _va = _t.a 557 _a = _va.unpack() 558 var _vb = _t.b 559 _b = _vb.unpack() 560 var _vc = _t.c 561 _c = _vc.unpack() 562 } 563 564 public var a: MyGame_Example_Ability { _a } 565 public var b: MyGame_Example_Test { _b } 566 public var c: MyGame_Example_Ability { _c } 567 verify<T>null568 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 569 try verifier.inBuffer(position: position, of: MyGame_Example_StructOfStructs.self) 570 } 571 } 572 573 extension MyGame_Example_StructOfStructs: Encodable { 574 575 enum CodingKeys: String, CodingKey { 576 case a = "a" 577 case b = "b" 578 case c = "c" 579 } encodenull580 public func encode(to encoder: Encoder) throws { 581 var container = encoder.container(keyedBy: CodingKeys.self) 582 try container.encodeIfPresent(a, forKey: .a) 583 try container.encodeIfPresent(b, forKey: .b) 584 try container.encodeIfPresent(c, forKey: .c) 585 } 586 } 587 588 public struct MyGame_Example_StructOfStructs_Mutable: FlatBufferObject { 589 validateVersionnull590 static func validateVersion() { FlatBuffersVersion_2_0_0() } 591 public var __buffer: ByteBuffer! { return _accessor.bb } 592 private var _accessor: Struct 593 594 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 595 596 public var a: MyGame_Example_Ability_Mutable { return MyGame_Example_Ability_Mutable(_accessor.bb, o: _accessor.postion + 0) } 597 public var b: MyGame_Example_Test_Mutable { return MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.postion + 8) } 598 public var c: MyGame_Example_Ability_Mutable { return MyGame_Example_Ability_Mutable(_accessor.bb, o: _accessor.postion + 12) } 599 600 unpacknull601 public mutating func unpack() -> MyGame_Example_StructOfStructs { 602 return MyGame_Example_StructOfStructs(&self) 603 } packnull604 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructs?) -> Offset { 605 guard var obj = obj else { return Offset() } 606 return pack(&builder, obj: &obj) 607 } 608 packnull609 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructs) -> Offset { 610 return builder.create(struct: obj) 611 } 612 } 613 614 public struct MyGame_Example_StructOfStructsOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 615 validateVersionnull616 static func validateVersion() { FlatBuffersVersion_2_0_0() } 617 618 private var _a: MyGame_Example_StructOfStructs 619 620 public init(_ bb: ByteBuffer, o: Int32) { 621 let _accessor = Struct(bb: bb, position: o) 622 _a = MyGame_Example_StructOfStructs(_accessor.bb, o: _accessor.postion + 0) 623 } 624 625 public init(a: MyGame_Example_StructOfStructs) { 626 _a = a 627 } 628 629 public init() { 630 _a = MyGame_Example_StructOfStructs() 631 } 632 633 public init(_ _t: inout MyGame_Example_StructOfStructsOfStructs_Mutable) { 634 var _va = _t.a 635 _a = _va.unpack() 636 } 637 638 public var a: MyGame_Example_StructOfStructs { _a } 639 verify<T>null640 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 641 try verifier.inBuffer(position: position, of: MyGame_Example_StructOfStructsOfStructs.self) 642 } 643 } 644 645 extension MyGame_Example_StructOfStructsOfStructs: Encodable { 646 647 enum CodingKeys: String, CodingKey { 648 case a = "a" 649 } encodenull650 public func encode(to encoder: Encoder) throws { 651 var container = encoder.container(keyedBy: CodingKeys.self) 652 try container.encodeIfPresent(a, forKey: .a) 653 } 654 } 655 656 public struct MyGame_Example_StructOfStructsOfStructs_Mutable: FlatBufferObject { 657 validateVersionnull658 static func validateVersion() { FlatBuffersVersion_2_0_0() } 659 public var __buffer: ByteBuffer! { return _accessor.bb } 660 private var _accessor: Struct 661 662 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 663 664 public var a: MyGame_Example_StructOfStructs_Mutable { return MyGame_Example_StructOfStructs_Mutable(_accessor.bb, o: _accessor.postion + 0) } 665 666 unpacknull667 public mutating func unpack() -> MyGame_Example_StructOfStructsOfStructs { 668 return MyGame_Example_StructOfStructsOfStructs(&self) 669 } packnull670 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs?) -> Offset { 671 guard var obj = obj else { return Offset() } 672 return pack(&builder, obj: &obj) 673 } 674 packnull675 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs) -> Offset { 676 return builder.create(struct: obj) 677 } 678 } 679 680 public struct MyGame_InParentNamespace: FlatBufferObject, Verifiable, ObjectAPIPacker { 681 validateVersionnull682 static func validateVersion() { FlatBuffersVersion_2_0_0() } 683 public var __buffer: ByteBuffer! { return _accessor.bb } 684 private var _accessor: Table 685 686 public static var id: String { "MONS" } finishnull687 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_InParentNamespace.id, addPrefix: prefix) } getRootAsInParentNamespacenull688 public static func getRootAsInParentNamespace(bb: ByteBuffer) -> MyGame_InParentNamespace { return MyGame_InParentNamespace(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 689 690 private init(_ t: Table) { _accessor = t } 691 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 692 startInParentNamespacenull693 public static func startInParentNamespace(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 0) } endInParentNamespacenull694 public static func endInParentNamespace(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 695 696 unpacknull697 public mutating func unpack() -> MyGame_InParentNamespaceT { 698 return MyGame_InParentNamespaceT(&self) 699 } packnull700 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_InParentNamespaceT?) -> Offset { 701 guard var obj = obj else { return Offset() } 702 return pack(&builder, obj: &obj) 703 } 704 packnull705 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_InParentNamespaceT) -> Offset { 706 let __root = MyGame_InParentNamespace.startInParentNamespace(&builder) 707 return MyGame_InParentNamespace.endInParentNamespace(&builder, start: __root) 708 } 709 verify<T>null710 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 711 var _v = try verifier.visitTable(at: position) 712 _v.finish() 713 } 714 } 715 716 extension MyGame_InParentNamespace: Encodable { 717 encodenull718 public func encode(to encoder: Encoder) throws { 719 } 720 } 721 722 public class MyGame_InParentNamespaceT: NativeObject { 723 724 725 public init(_ _t: inout MyGame_InParentNamespace) { 726 } 727 728 public init() { 729 } 730 serializenull731 public func serialize() -> ByteBuffer { return serialize(type: MyGame_InParentNamespace.self) } 732 733 } 734 public struct MyGame_Example2_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker { 735 validateVersionnull736 static func validateVersion() { FlatBuffersVersion_2_0_0() } 737 public var __buffer: ByteBuffer! { return _accessor.bb } 738 private var _accessor: Table 739 740 public static var id: String { "MONS" } finishnull741 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example2_Monster.id, addPrefix: prefix) } getRootAsMonsternull742 public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example2_Monster { return MyGame_Example2_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 743 744 private init(_ t: Table) { _accessor = t } 745 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 746 startMonsternull747 public static func startMonster(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 0) } endMonsternull748 public static func endMonster(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 749 750 unpacknull751 public mutating func unpack() -> MyGame_Example2_MonsterT { 752 return MyGame_Example2_MonsterT(&self) 753 } packnull754 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example2_MonsterT?) -> Offset { 755 guard var obj = obj else { return Offset() } 756 return pack(&builder, obj: &obj) 757 } 758 packnull759 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example2_MonsterT) -> Offset { 760 let __root = MyGame_Example2_Monster.startMonster(&builder) 761 return MyGame_Example2_Monster.endMonster(&builder, start: __root) 762 } 763 verify<T>null764 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 765 var _v = try verifier.visitTable(at: position) 766 _v.finish() 767 } 768 } 769 770 extension MyGame_Example2_Monster: Encodable { 771 encodenull772 public func encode(to encoder: Encoder) throws { 773 } 774 } 775 776 public class MyGame_Example2_MonsterT: NativeObject { 777 778 779 public init(_ _t: inout MyGame_Example2_Monster) { 780 } 781 782 public init() { 783 } 784 serializenull785 public func serialize() -> ByteBuffer { return serialize(type: MyGame_Example2_Monster.self) } 786 787 } 788 internal struct MyGame_Example_TestSimpleTableWithEnum: FlatBufferObject, Verifiable, ObjectAPIPacker { 789 validateVersionnull790 static func validateVersion() { FlatBuffersVersion_2_0_0() } 791 internal var __buffer: ByteBuffer! { return _accessor.bb } 792 private var _accessor: Table 793 794 internal static var id: String { "MONS" } finishnull795 internal static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TestSimpleTableWithEnum.id, addPrefix: prefix) } getRootAsTestSimpleTableWithEnumnull796 internal static func getRootAsTestSimpleTableWithEnum(bb: ByteBuffer) -> MyGame_Example_TestSimpleTableWithEnum { return MyGame_Example_TestSimpleTableWithEnum(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 797 798 private init(_ t: Table) { _accessor = t } 799 internal init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 800 801 private enum VTOFFSET: VOffset { 802 case color = 4 803 var v: Int32 { Int32(self.rawValue) } 804 var p: VOffset { self.rawValue } 805 } 806 807 internal var color: MyGame_Example_Color { let o = _accessor.offset(VTOFFSET.color.v); return o == 0 ? .green : MyGame_Example_Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .green } mutatenull808 @discardableResult internal func mutate(color: MyGame_Example_Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) } startTestSimpleTableWithEnumnull809 internal static func startTestSimpleTableWithEnum(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) } addnull810 internal static func add(color: MyGame_Example_Color, _ fbb: inout FlatBufferBuilder) { fbb.add(element: color.rawValue, def: 2, at: VTOFFSET.color.p) } endTestSimpleTableWithEnumnull811 internal static func endTestSimpleTableWithEnum(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 812 internal static func createTestSimpleTableWithEnum( 813 _ fbb: inout FlatBufferBuilder, 814 color: MyGame_Example_Color = .green 815 ) -> Offset { 816 let __start = MyGame_Example_TestSimpleTableWithEnum.startTestSimpleTableWithEnum(&fbb) 817 MyGame_Example_TestSimpleTableWithEnum.add(color: color, &fbb) 818 return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(&fbb, start: __start) 819 } 820 821 unpacknull822 internal mutating func unpack() -> MyGame_Example_TestSimpleTableWithEnumT { 823 return MyGame_Example_TestSimpleTableWithEnumT(&self) 824 } packnull825 internal static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_TestSimpleTableWithEnumT?) -> Offset { 826 guard var obj = obj else { return Offset() } 827 return pack(&builder, obj: &obj) 828 } 829 packnull830 internal static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_TestSimpleTableWithEnumT) -> Offset { 831 let __root = MyGame_Example_TestSimpleTableWithEnum.startTestSimpleTableWithEnum(&builder) 832 MyGame_Example_TestSimpleTableWithEnum.add(color: obj.color, &builder) 833 return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(&builder, start: __root) 834 } 835 verify<T>null836 internal static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 837 var _v = try verifier.visitTable(at: position) 838 try _v.visit(field: VTOFFSET.color.p, fieldName: "color", required: false, type: MyGame_Example_Color.self) 839 _v.finish() 840 } 841 } 842 843 extension MyGame_Example_TestSimpleTableWithEnum: Encodable { 844 845 enum CodingKeys: String, CodingKey { 846 case color = "color" 847 } encodenull848 internal func encode(to encoder: Encoder) throws { 849 var container = encoder.container(keyedBy: CodingKeys.self) 850 if color != .green { 851 try container.encodeIfPresent(color, forKey: .color) 852 } 853 } 854 } 855 856 internal class MyGame_Example_TestSimpleTableWithEnumT: NativeObject { 857 858 internal var color: MyGame_Example_Color 859 860 internal init(_ _t: inout MyGame_Example_TestSimpleTableWithEnum) { 861 color = _t.color 862 } 863 864 internal init() { 865 color = .green 866 } 867 serializenull868 internal func serialize() -> ByteBuffer { return serialize(type: MyGame_Example_TestSimpleTableWithEnum.self) } 869 870 } 871 public struct MyGame_Example_Stat: FlatBufferObject, Verifiable, ObjectAPIPacker { 872 validateVersionnull873 static func validateVersion() { FlatBuffersVersion_2_0_0() } 874 public var __buffer: ByteBuffer! { return _accessor.bb } 875 private var _accessor: Table 876 877 public static var id: String { "MONS" } finishnull878 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Stat.id, addPrefix: prefix) } getRootAsStatnull879 public static func getRootAsStat(bb: ByteBuffer) -> MyGame_Example_Stat { return MyGame_Example_Stat(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 880 881 private init(_ t: Table) { _accessor = t } 882 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 883 884 private enum VTOFFSET: VOffset { 885 case id = 4 886 case val = 6 887 case count = 8 888 var v: Int32 { Int32(self.rawValue) } 889 var p: VOffset { self.rawValue } 890 } 891 892 public var id: String? { let o = _accessor.offset(VTOFFSET.id.v); return o == 0 ? nil : _accessor.string(at: o) } 893 public var idSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.id.v) } 894 public var val: Int64 { let o = _accessor.offset(VTOFFSET.val.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) } mutatenull895 @discardableResult public func mutate(val: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.val.v); return _accessor.mutate(val, index: o) } 896 public var count: UInt16 { let o = _accessor.offset(VTOFFSET.count.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) } mutatenull897 @discardableResult public func mutate(count: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.count.v); return _accessor.mutate(count, index: o) } startStatnull898 public static func startStat(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 3) } addnull899 public static func add(id: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: id, at: VTOFFSET.id.p) } addnull900 public static func add(val: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: val, def: 0, at: VTOFFSET.val.p) } addnull901 public static func add(count: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: count, def: 0, at: VTOFFSET.count.p) } endStatnull902 public static func endStat(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 903 public static func createStat( 904 _ fbb: inout FlatBufferBuilder, 905 idOffset id: Offset = Offset(), 906 val: Int64 = 0, 907 count: UInt16 = 0 908 ) -> Offset { 909 let __start = MyGame_Example_Stat.startStat(&fbb) 910 MyGame_Example_Stat.add(id: id, &fbb) 911 MyGame_Example_Stat.add(val: val, &fbb) 912 MyGame_Example_Stat.add(count: count, &fbb) 913 return MyGame_Example_Stat.endStat(&fbb, start: __start) 914 } sortVectorOfStatnull915 public static func sortVectorOfStat(offsets:[Offset], _ fbb: inout FlatBufferBuilder) -> Offset { 916 var off = offsets 917 off.sort { Table.compare(Table.offset(Int32($1.o), vOffset: 8, fbb: fbb.buffer), Table.offset(Int32($0.o), vOffset: 8, fbb: fbb.buffer), fbb: fbb.buffer) < 0 } 918 return fbb.createVector(ofOffsets: off) 919 } lookupByKeynull920 fileprivate static func lookupByKey(vector: Int32, key: UInt16, fbb: ByteBuffer) -> MyGame_Example_Stat? { 921 var span = fbb.read(def: Int32.self, position: Int(vector - 4)) 922 var start: Int32 = 0 923 while span != 0 { 924 var middle = span / 2 925 let tableOffset = Table.indirect(vector + 4 * (start + middle), fbb) 926 let comp = fbb.read(def: UInt16.self, position: Int(Table.offset(Int32(fbb.capacity) - tableOffset, vOffset: 8, fbb: fbb))) 927 if comp > 0 { 928 span = middle 929 } else if comp < 0 { 930 middle += 1 931 start += middle 932 span -= middle 933 } else { 934 return MyGame_Example_Stat(fbb, o: tableOffset) 935 } 936 } 937 return nil 938 } 939 940 unpacknull941 public mutating func unpack() -> MyGame_Example_StatT { 942 return MyGame_Example_StatT(&self) 943 } packnull944 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StatT?) -> Offset { 945 guard var obj = obj else { return Offset() } 946 return pack(&builder, obj: &obj) 947 } 948 packnull949 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StatT) -> Offset { 950 let __id: Offset 951 if let s = obj.id { 952 __id = builder.create(string: s) 953 } else { 954 __id = Offset() 955 } 956 957 let __root = MyGame_Example_Stat.startStat(&builder) 958 MyGame_Example_Stat.add(id: __id, &builder) 959 MyGame_Example_Stat.add(val: obj.val, &builder) 960 MyGame_Example_Stat.add(count: obj.count, &builder) 961 return MyGame_Example_Stat.endStat(&builder, start: __root) 962 } 963 verify<T>null964 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 965 var _v = try verifier.visitTable(at: position) 966 try _v.visit(field: VTOFFSET.id.p, fieldName: "id", required: false, type: ForwardOffset<String>.self) 967 try _v.visit(field: VTOFFSET.val.p, fieldName: "val", required: false, type: Int64.self) 968 try _v.visit(field: VTOFFSET.count.p, fieldName: "count", required: false, type: UInt16.self) 969 _v.finish() 970 } 971 } 972 973 extension MyGame_Example_Stat: Encodable { 974 975 enum CodingKeys: String, CodingKey { 976 case id = "id" 977 case val = "val" 978 case count = "count" 979 } encodenull980 public func encode(to encoder: Encoder) throws { 981 var container = encoder.container(keyedBy: CodingKeys.self) 982 try container.encodeIfPresent(id, forKey: .id) 983 if val != 0 { 984 try container.encodeIfPresent(val, forKey: .val) 985 } 986 if count != 0 { 987 try container.encodeIfPresent(count, forKey: .count) 988 } 989 } 990 } 991 992 public class MyGame_Example_StatT: NativeObject { 993 994 public var id: String? 995 public var val: Int64 996 public var count: UInt16 997 998 public init(_ _t: inout MyGame_Example_Stat) { 999 id = _t.id 1000 val = _t.val 1001 count = _t.count 1002 } 1003 1004 public init() { 1005 val = 0 1006 count = 0 1007 } 1008 serializenull1009 public func serialize() -> ByteBuffer { return serialize(type: MyGame_Example_Stat.self) } 1010 1011 } 1012 public struct MyGame_Example_Referrable: FlatBufferObject, Verifiable, ObjectAPIPacker { 1013 validateVersionnull1014 static func validateVersion() { FlatBuffersVersion_2_0_0() } 1015 public var __buffer: ByteBuffer! { return _accessor.bb } 1016 private var _accessor: Table 1017 1018 public static var id: String { "MONS" } finishnull1019 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Referrable.id, addPrefix: prefix) } getRootAsReferrablenull1020 public static func getRootAsReferrable(bb: ByteBuffer) -> MyGame_Example_Referrable { return MyGame_Example_Referrable(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 1021 1022 private init(_ t: Table) { _accessor = t } 1023 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 1024 1025 private enum VTOFFSET: VOffset { 1026 case id = 4 1027 var v: Int32 { Int32(self.rawValue) } 1028 var p: VOffset { self.rawValue } 1029 } 1030 1031 public var id: UInt64 { let o = _accessor.offset(VTOFFSET.id.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1032 @discardableResult public func mutate(id: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.id.v); return _accessor.mutate(id, index: o) } startReferrablenull1033 public static func startReferrable(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) } addnull1034 public static func add(id: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: id, def: 0, at: VTOFFSET.id.p) } endReferrablenull1035 public static func endReferrable(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 1036 public static func createReferrable( 1037 _ fbb: inout FlatBufferBuilder, 1038 id: UInt64 = 0 1039 ) -> Offset { 1040 let __start = MyGame_Example_Referrable.startReferrable(&fbb) 1041 MyGame_Example_Referrable.add(id: id, &fbb) 1042 return MyGame_Example_Referrable.endReferrable(&fbb, start: __start) 1043 } sortVectorOfReferrablenull1044 public static func sortVectorOfReferrable(offsets:[Offset], _ fbb: inout FlatBufferBuilder) -> Offset { 1045 var off = offsets 1046 off.sort { Table.compare(Table.offset(Int32($1.o), vOffset: 4, fbb: fbb.buffer), Table.offset(Int32($0.o), vOffset: 4, fbb: fbb.buffer), fbb: fbb.buffer) < 0 } 1047 return fbb.createVector(ofOffsets: off) 1048 } lookupByKeynull1049 fileprivate static func lookupByKey(vector: Int32, key: UInt64, fbb: ByteBuffer) -> MyGame_Example_Referrable? { 1050 var span = fbb.read(def: Int32.self, position: Int(vector - 4)) 1051 var start: Int32 = 0 1052 while span != 0 { 1053 var middle = span / 2 1054 let tableOffset = Table.indirect(vector + 4 * (start + middle), fbb) 1055 let comp = fbb.read(def: UInt64.self, position: Int(Table.offset(Int32(fbb.capacity) - tableOffset, vOffset: 4, fbb: fbb))) 1056 if comp > 0 { 1057 span = middle 1058 } else if comp < 0 { 1059 middle += 1 1060 start += middle 1061 span -= middle 1062 } else { 1063 return MyGame_Example_Referrable(fbb, o: tableOffset) 1064 } 1065 } 1066 return nil 1067 } 1068 1069 unpacknull1070 public mutating func unpack() -> MyGame_Example_ReferrableT { 1071 return MyGame_Example_ReferrableT(&self) 1072 } packnull1073 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_ReferrableT?) -> Offset { 1074 guard var obj = obj else { return Offset() } 1075 return pack(&builder, obj: &obj) 1076 } 1077 packnull1078 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_ReferrableT) -> Offset { 1079 let __root = MyGame_Example_Referrable.startReferrable(&builder) 1080 MyGame_Example_Referrable.add(id: obj.id, &builder) 1081 return MyGame_Example_Referrable.endReferrable(&builder, start: __root) 1082 } 1083 verify<T>null1084 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 1085 var _v = try verifier.visitTable(at: position) 1086 try _v.visit(field: VTOFFSET.id.p, fieldName: "id", required: false, type: UInt64.self) 1087 _v.finish() 1088 } 1089 } 1090 1091 extension MyGame_Example_Referrable: Encodable { 1092 1093 enum CodingKeys: String, CodingKey { 1094 case id = "id" 1095 } encodenull1096 public func encode(to encoder: Encoder) throws { 1097 var container = encoder.container(keyedBy: CodingKeys.self) 1098 if id != 0 { 1099 try container.encodeIfPresent(id, forKey: .id) 1100 } 1101 } 1102 } 1103 1104 public class MyGame_Example_ReferrableT: NativeObject { 1105 1106 public var id: UInt64 1107 1108 public init(_ _t: inout MyGame_Example_Referrable) { 1109 id = _t.id 1110 } 1111 1112 public init() { 1113 id = 0 1114 } 1115 serializenull1116 public func serialize() -> ByteBuffer { return serialize(type: MyGame_Example_Referrable.self) } 1117 1118 } 1119 /// an example documentation comment: "monster object" 1120 public struct MyGame_Example_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker { 1121 validateVersionnull1122 static func validateVersion() { FlatBuffersVersion_2_0_0() } 1123 public var __buffer: ByteBuffer! { return _accessor.bb } 1124 private var _accessor: Table 1125 1126 public static var id: String { "MONS" } finishnull1127 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Monster.id, addPrefix: prefix) } getRootAsMonsternull1128 public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example_Monster { return MyGame_Example_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 1129 1130 private init(_ t: Table) { _accessor = t } 1131 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 1132 1133 private enum VTOFFSET: VOffset { 1134 case pos = 4 1135 case mana = 6 1136 case hp = 8 1137 case name = 10 1138 case inventory = 14 1139 case color = 16 1140 case testType = 18 1141 case test = 20 1142 case test4 = 22 1143 case testarrayofstring = 24 1144 case testarrayoftables = 26 1145 case enemy = 28 1146 case testnestedflatbuffer = 30 1147 case testempty = 32 1148 case testbool = 34 1149 case testhashs32Fnv1 = 36 1150 case testhashu32Fnv1 = 38 1151 case testhashs64Fnv1 = 40 1152 case testhashu64Fnv1 = 42 1153 case testhashs32Fnv1a = 44 1154 case testhashu32Fnv1a = 46 1155 case testhashs64Fnv1a = 48 1156 case testhashu64Fnv1a = 50 1157 case testarrayofbools = 52 1158 case testf = 54 1159 case testf2 = 56 1160 case testf3 = 58 1161 case testarrayofstring2 = 60 1162 case testarrayofsortedstruct = 62 1163 case flex = 64 1164 case test5 = 66 1165 case vectorOfLongs = 68 1166 case vectorOfDoubles = 70 1167 case parentNamespaceTest = 72 1168 case vectorOfReferrables = 74 1169 case singleWeakReference = 76 1170 case vectorOfWeakReferences = 78 1171 case vectorOfStrongReferrables = 80 1172 case coOwningReference = 82 1173 case vectorOfCoOwningReferences = 84 1174 case nonOwningReference = 86 1175 case vectorOfNonOwningReferences = 88 1176 case anyUniqueType = 90 1177 case anyUnique = 92 1178 case anyAmbiguousType = 94 1179 case anyAmbiguous = 96 1180 case vectorOfEnums = 98 1181 case signedEnum = 100 1182 case testrequirednestedflatbuffer = 102 1183 case scalarKeySortedTables = 104 1184 case nativeInline = 106 1185 case longEnumNonEnumDefault = 108 1186 case longEnumNormalDefault = 110 1187 var v: Int32 { Int32(self.rawValue) } 1188 var p: VOffset { self.rawValue } 1189 } 1190 1191 public var pos: MyGame_Example_Vec3? { let o = _accessor.offset(VTOFFSET.pos.v); return o == 0 ? nil : _accessor.readBuffer(of: MyGame_Example_Vec3.self, at: o) } 1192 public var mutablePos: MyGame_Example_Vec3_Mutable? { let o = _accessor.offset(VTOFFSET.pos.v); return o == 0 ? nil : MyGame_Example_Vec3_Mutable(_accessor.bb, o: o + _accessor.postion) } 1193 public var mana: Int16 { let o = _accessor.offset(VTOFFSET.mana.v); return o == 0 ? 150 : _accessor.readBuffer(of: Int16.self, at: o) } mutatenull1194 @discardableResult public func mutate(mana: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.mana.v); return _accessor.mutate(mana, index: o) } 1195 public var hp: Int16 { let o = _accessor.offset(VTOFFSET.hp.v); return o == 0 ? 100 : _accessor.readBuffer(of: Int16.self, at: o) } mutatenull1196 @discardableResult public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.hp.v); return _accessor.mutate(hp, index: o) } 1197 public var name: String! { let o = _accessor.offset(VTOFFSET.name.v); return _accessor.string(at: o) } 1198 public var nameSegmentArray: [UInt8]! { return _accessor.getVector(at: VTOFFSET.name.v) } 1199 public var hasInventory: Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? false : true } 1200 public var inventoryCount: Int32 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.vector(count: o) } inventorynull1201 public func inventory(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) } 1202 public var inventory: [UInt8] { return _accessor.getVector(at: VTOFFSET.inventory.v) ?? [] } mutatenull1203 public func mutate(inventory: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return _accessor.directMutate(inventory, index: _accessor.vector(at: o) + index * 1) } 1204 public var color: MyGame_Example_Color { let o = _accessor.offset(VTOFFSET.color.v); return o == 0 ? .blue : MyGame_Example_Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .blue } mutatenull1205 @discardableResult public func mutate(color: MyGame_Example_Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) } 1206 public var testType: MyGame_Example_Any_ { let o = _accessor.offset(VTOFFSET.testType.v); return o == 0 ? .none_ : MyGame_Example_Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ } test<T: FlatbuffersInitializable>null1207 public func test<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.test.v); return o == 0 ? nil : _accessor.union(o) } 1208 public var hasTest4: Bool { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? false : true } 1209 public var test4Count: Int32 { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? 0 : _accessor.vector(count: o) } test4null1210 public func test4(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) } mutableTest4null1211 public func mutableTest4(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) } 1212 public var hasTestarrayofstring: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? false : true } 1213 public var testarrayofstringCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? 0 : _accessor.vector(count: o) } testarrayofstringnull1214 public func testarrayofstring(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) } 1215 /// an example documentation comment: this will end up in the generated code 1216 /// multiline too 1217 public var hasTestarrayoftables: Bool { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? false : true } 1218 public var testarrayoftablesCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? 0 : _accessor.vector(count: o) } testarrayoftablesnull1219 public func testarrayoftables(at index: Int32) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) } testarrayoftablesBynull1220 public func testarrayoftablesBy(key: String) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) } 1221 public var enemy: MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.enemy.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) } 1222 public var hasTestnestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? false : true } 1223 public var testnestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) } testnestedflatbuffernull1224 public func testnestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) } 1225 public var testnestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testnestedflatbuffer.v) ?? [] } mutatenull1226 public func mutate(testnestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return _accessor.directMutate(testnestedflatbuffer, index: _accessor.vector(at: o) + index * 1) } 1227 public var testempty: MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.testempty.v); return o == 0 ? nil : MyGame_Example_Stat(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) } 1228 public var testbool: Bool { let o = _accessor.offset(VTOFFSET.testbool.v); return o == 0 ? false : 0 != _accessor.readBuffer(of: Byte.self, at: o) } mutatenull1229 @discardableResult public func mutate(testbool: Byte) -> Bool {let o = _accessor.offset(VTOFFSET.testbool.v); return _accessor.mutate(testbool, index: o) } 1230 public var testhashs32Fnv1: Int32 { let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) } mutatenull1231 @discardableResult public func mutate(testhashs32Fnv1: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return _accessor.mutate(testhashs32Fnv1, index: o) } 1232 public var testhashu32Fnv1: UInt32 { let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) } mutatenull1233 @discardableResult public func mutate(testhashu32Fnv1: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return _accessor.mutate(testhashu32Fnv1, index: o) } 1234 public var testhashs64Fnv1: Int64 { let o = _accessor.offset(VTOFFSET.testhashs64Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) } mutatenull1235 @discardableResult public func mutate(testhashs64Fnv1: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1.v); return _accessor.mutate(testhashs64Fnv1, index: o) } 1236 public var testhashu64Fnv1: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1237 @discardableResult public func mutate(testhashu64Fnv1: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1.v); return _accessor.mutate(testhashu64Fnv1, index: o) } 1238 public var testhashs32Fnv1a: Int32 { let o = _accessor.offset(VTOFFSET.testhashs32Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) } mutatenull1239 @discardableResult public func mutate(testhashs32Fnv1a: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1a.v); return _accessor.mutate(testhashs32Fnv1a, index: o) } 1240 public var testhashu32Fnv1a: UInt32 { let o = _accessor.offset(VTOFFSET.testhashu32Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) } mutatenull1241 @discardableResult public func mutate(testhashu32Fnv1a: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1a.v); return _accessor.mutate(testhashu32Fnv1a, index: o) } 1242 public var testhashs64Fnv1a: Int64 { let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) } mutatenull1243 @discardableResult public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return _accessor.mutate(testhashs64Fnv1a, index: o) } 1244 public var testhashu64Fnv1a: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1245 @discardableResult public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return _accessor.mutate(testhashu64Fnv1a, index: o) } 1246 public var hasTestarrayofbools: Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? false : true } 1247 public var testarrayofboolsCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? 0 : _accessor.vector(count: o) } testarrayofboolsnull1248 public func testarrayofbools(at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? true : _accessor.directRead(of: Bool.self, offset: _accessor.vector(at: o) + index * 1) } 1249 public var testarrayofbools: [Bool] { return _accessor.getVector(at: VTOFFSET.testarrayofbools.v) ?? [] } mutatenull1250 public func mutate(testarrayofbools: Bool, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return _accessor.directMutate(testarrayofbools, index: _accessor.vector(at: o) + index * 1) } 1251 public var testf: Float32 { let o = _accessor.offset(VTOFFSET.testf.v); return o == 0 ? 3.14159 : _accessor.readBuffer(of: Float32.self, at: o) } mutatenull1252 @discardableResult public func mutate(testf: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf.v); return _accessor.mutate(testf, index: o) } 1253 public var testf2: Float32 { let o = _accessor.offset(VTOFFSET.testf2.v); return o == 0 ? 3.0 : _accessor.readBuffer(of: Float32.self, at: o) } mutatenull1254 @discardableResult public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf2.v); return _accessor.mutate(testf2, index: o) } 1255 public var testf3: Float32 { let o = _accessor.offset(VTOFFSET.testf3.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) } mutatenull1256 @discardableResult public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf3.v); return _accessor.mutate(testf3, index: o) } 1257 public var hasTestarrayofstring2: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? false : true } 1258 public var testarrayofstring2Count: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? 0 : _accessor.vector(count: o) } testarrayofstring2null1259 public func testarrayofstring2(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) } 1260 public var hasTestarrayofsortedstruct: Bool { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? false : true } 1261 public var testarrayofsortedstructCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? 0 : _accessor.vector(count: o) } testarrayofsortedstructnull1262 public func testarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Ability.self, offset: _accessor.vector(at: o) + index * 8) } mutableTestarrayofsortedstructnull1263 public func mutableTestarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability_Mutable? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : MyGame_Example_Ability_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 8) } 1264 public var hasFlex: Bool { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? false : true } 1265 public var flexCount: Int32 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.vector(count: o) } flexnull1266 public func flex(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) } 1267 public var flex: [UInt8] { return _accessor.getVector(at: VTOFFSET.flex.v) ?? [] } mutatenull1268 public func mutate(flex: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.flex.v); return _accessor.directMutate(flex, index: _accessor.vector(at: o) + index * 1) } 1269 public var hasTest5: Bool { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? false : true } 1270 public var test5Count: Int32 { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? 0 : _accessor.vector(count: o) } test5null1271 public func test5(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) } mutableTest5null1272 public func mutableTest5(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) } 1273 public var hasVectorOfLongs: Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? false : true } 1274 public var vectorOfLongsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfLongsnull1275 public func vectorOfLongs(at index: Int32) -> Int64 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.directRead(of: Int64.self, offset: _accessor.vector(at: o) + index * 8) } 1276 public var vectorOfLongs: [Int64] { return _accessor.getVector(at: VTOFFSET.vectorOfLongs.v) ?? [] } mutatenull1277 public func mutate(vectorOfLongs: Int64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return _accessor.directMutate(vectorOfLongs, index: _accessor.vector(at: o) + index * 8) } 1278 public var hasVectorOfDoubles: Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? false : true } 1279 public var vectorOfDoublesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfDoublesnull1280 public func vectorOfDoubles(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) } 1281 public var vectorOfDoubles: [Double] { return _accessor.getVector(at: VTOFFSET.vectorOfDoubles.v) ?? [] } mutatenull1282 public func mutate(vectorOfDoubles: Double, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return _accessor.directMutate(vectorOfDoubles, index: _accessor.vector(at: o) + index * 8) } 1283 public var parentNamespaceTest: MyGame_InParentNamespace? { let o = _accessor.offset(VTOFFSET.parentNamespaceTest.v); return o == 0 ? nil : MyGame_InParentNamespace(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) } 1284 public var hasVectorOfReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? false : true } 1285 public var vectorOfReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfReferrablesnull1286 public func vectorOfReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) } vectorOfReferrablesBynull1287 public func vectorOfReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) } 1288 public var singleWeakReference: UInt64 { let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1289 @discardableResult public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return _accessor.mutate(singleWeakReference, index: o) } 1290 public var hasVectorOfWeakReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? false : true } 1291 public var vectorOfWeakReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfWeakReferencesnull1292 public func vectorOfWeakReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) } 1293 public var vectorOfWeakReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfWeakReferences.v) ?? [] } mutatenull1294 public func mutate(vectorOfWeakReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return _accessor.directMutate(vectorOfWeakReferences, index: _accessor.vector(at: o) + index * 8) } 1295 public var hasVectorOfStrongReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? false : true } 1296 public var vectorOfStrongReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfStrongReferrablesnull1297 public func vectorOfStrongReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) } vectorOfStrongReferrablesBynull1298 public func vectorOfStrongReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) } 1299 public var coOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.coOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1300 @discardableResult public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.coOwningReference.v); return _accessor.mutate(coOwningReference, index: o) } 1301 public var hasVectorOfCoOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? false : true } 1302 public var vectorOfCoOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfCoOwningReferencesnull1303 public func vectorOfCoOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) } 1304 public var vectorOfCoOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfCoOwningReferences.v) ?? [] } mutatenull1305 public func mutate(vectorOfCoOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return _accessor.directMutate(vectorOfCoOwningReferences, index: _accessor.vector(at: o) + index * 8) } 1306 public var nonOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull1307 @discardableResult public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return _accessor.mutate(nonOwningReference, index: o) } 1308 public var hasVectorOfNonOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? false : true } 1309 public var vectorOfNonOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfNonOwningReferencesnull1310 public func vectorOfNonOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) } 1311 public var vectorOfNonOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfNonOwningReferences.v) ?? [] } mutatenull1312 public func mutate(vectorOfNonOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return _accessor.directMutate(vectorOfNonOwningReferences, index: _accessor.vector(at: o) + index * 8) } 1313 public var anyUniqueType: MyGame_Example_AnyUniqueAliases { let o = _accessor.offset(VTOFFSET.anyUniqueType.v); return o == 0 ? .none_ : MyGame_Example_AnyUniqueAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ } anyUnique<T: FlatbuffersInitializable>null1314 public func anyUnique<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyUnique.v); return o == 0 ? nil : _accessor.union(o) } 1315 public var anyAmbiguousType: MyGame_Example_AnyAmbiguousAliases { let o = _accessor.offset(VTOFFSET.anyAmbiguousType.v); return o == 0 ? .none_ : MyGame_Example_AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ } anyAmbiguous<T: FlatbuffersInitializable>null1316 public func anyAmbiguous<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyAmbiguous.v); return o == 0 ? nil : _accessor.union(o) } 1317 public var hasVectorOfEnums: Bool { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? false : true } 1318 public var vectorOfEnumsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? 0 : _accessor.vector(count: o) } vectorOfEnumsnull1319 public func vectorOfEnums(at index: Int32) -> MyGame_Example_Color? { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? MyGame_Example_Color.red : MyGame_Example_Color(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) } 1320 public var signedEnum: MyGame_Example_Race { let o = _accessor.offset(VTOFFSET.signedEnum.v); return o == 0 ? .none_ : MyGame_Example_Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ } mutatenull1321 @discardableResult public func mutate(signedEnum: MyGame_Example_Race) -> Bool {let o = _accessor.offset(VTOFFSET.signedEnum.v); return _accessor.mutate(signedEnum.rawValue, index: o) } 1322 public var hasTestrequirednestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? false : true } 1323 public var testrequirednestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) } testrequirednestedflatbuffernull1324 public func testrequirednestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) } 1325 public var testrequirednestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testrequirednestedflatbuffer.v) ?? [] } mutatenull1326 public func mutate(testrequirednestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return _accessor.directMutate(testrequirednestedflatbuffer, index: _accessor.vector(at: o) + index * 1) } 1327 public var hasScalarKeySortedTables: Bool { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? false : true } 1328 public var scalarKeySortedTablesCount: Int32 { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? 0 : _accessor.vector(count: o) } scalarKeySortedTablesnull1329 public func scalarKeySortedTables(at index: Int32) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) } scalarKeySortedTablesBynull1330 public func scalarKeySortedTablesBy(key: UInt16) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) } 1331 public var nativeInline: MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.nativeInline.v); return o == 0 ? nil : _accessor.readBuffer(of: MyGame_Example_Test.self, at: o) } 1332 public var mutableNativeInline: MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.nativeInline.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: o + _accessor.postion) } 1333 public var longEnumNonEnumDefault: MyGame_Example_LongEnum { let o = _accessor.offset(VTOFFSET.longEnumNonEnumDefault.v); return o == 0 ? .longone : MyGame_Example_LongEnum(rawValue: _accessor.readBuffer(of: UInt64.self, at: o)) ?? .longone } mutatenull1334 @discardableResult public func mutate(longEnumNonEnumDefault: MyGame_Example_LongEnum) -> Bool {let o = _accessor.offset(VTOFFSET.longEnumNonEnumDefault.v); return _accessor.mutate(longEnumNonEnumDefault.rawValue, index: o) } 1335 public var longEnumNormalDefault: MyGame_Example_LongEnum { let o = _accessor.offset(VTOFFSET.longEnumNormalDefault.v); return o == 0 ? .longone : MyGame_Example_LongEnum(rawValue: _accessor.readBuffer(of: UInt64.self, at: o)) ?? .longone } mutatenull1336 @discardableResult public func mutate(longEnumNormalDefault: MyGame_Example_LongEnum) -> Bool {let o = _accessor.offset(VTOFFSET.longEnumNormalDefault.v); return _accessor.mutate(longEnumNormalDefault.rawValue, index: o) } startMonsternull1337 public static func startMonster(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 54) } addnull1338 public static func add(pos: MyGame_Example_Vec3?, _ fbb: inout FlatBufferBuilder) { guard let pos = pos else { return }; fbb.create(struct: pos, position: VTOFFSET.pos.p) } addnull1339 public static func add(mana: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: mana, def: 150, at: VTOFFSET.mana.p) } addnull1340 public static func add(hp: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: hp, def: 100, at: VTOFFSET.hp.p) } addnull1341 public static func add(name: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: name, at: VTOFFSET.name.p) } addVectorOfnull1342 public static func addVectorOf(inventory: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: inventory, at: VTOFFSET.inventory.p) } addnull1343 public static func add(color: MyGame_Example_Color, _ fbb: inout FlatBufferBuilder) { fbb.add(element: color.rawValue, def: 8, at: VTOFFSET.color.p) } addnull1344 public static func add(testType: MyGame_Example_Any_, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testType.rawValue, def: 0, at: VTOFFSET.testType.p) } addnull1345 public static func add(test: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: test, at: VTOFFSET.test.p) } addVectorOfnull1346 public static func addVectorOf(test4: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: test4, at: VTOFFSET.test4.p) } startVectorOfTest4null1347 public static func startVectorOfTest4(_ size: Int, in builder: inout FlatBufferBuilder) { 1348 builder.startVector(size * MemoryLayout<MyGame_Example_Test>.size, elementSize: MemoryLayout<MyGame_Example_Test>.alignment) 1349 } addVectorOfnull1350 public static func addVectorOf(testarrayofstring: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testarrayofstring, at: VTOFFSET.testarrayofstring.p) } addVectorOfnull1351 public static func addVectorOf(testarrayoftables: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testarrayoftables, at: VTOFFSET.testarrayoftables.p) } addnull1352 public static func add(enemy: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: enemy, at: VTOFFSET.enemy.p) } addVectorOfnull1353 public static func addVectorOf(testnestedflatbuffer: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testnestedflatbuffer, at: VTOFFSET.testnestedflatbuffer.p) } addnull1354 public static func add(testempty: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testempty, at: VTOFFSET.testempty.p) } addnull1355 public static func add(testbool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testbool, def: false, 1356 at: VTOFFSET.testbool.p) } addnull1357 public static func add(testhashs32Fnv1: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs32Fnv1, def: 0, at: VTOFFSET.testhashs32Fnv1.p) } addnull1358 public static func add(testhashu32Fnv1: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashu32Fnv1, def: 0, at: VTOFFSET.testhashu32Fnv1.p) } addnull1359 public static func add(testhashs64Fnv1: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs64Fnv1, def: 0, at: VTOFFSET.testhashs64Fnv1.p) } addnull1360 public static func add(testhashu64Fnv1: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashu64Fnv1, def: 0, at: VTOFFSET.testhashu64Fnv1.p) } addnull1361 public static func add(testhashs32Fnv1a: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs32Fnv1a, def: 0, at: VTOFFSET.testhashs32Fnv1a.p) } addnull1362 public static func add(testhashu32Fnv1a: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashu32Fnv1a, def: 0, at: VTOFFSET.testhashu32Fnv1a.p) } addnull1363 public static func add(testhashs64Fnv1a: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs64Fnv1a, def: 0, at: VTOFFSET.testhashs64Fnv1a.p) } addnull1364 public static func add(testhashu64Fnv1a: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashu64Fnv1a, def: 0, at: VTOFFSET.testhashu64Fnv1a.p) } addVectorOfnull1365 public static func addVectorOf(testarrayofbools: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testarrayofbools, at: VTOFFSET.testarrayofbools.p) } addnull1366 public static func add(testf: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testf, def: 3.14159, at: VTOFFSET.testf.p) } addnull1367 public static func add(testf2: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testf2, def: 3.0, at: VTOFFSET.testf2.p) } addnull1368 public static func add(testf3: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testf3, def: 0.0, at: VTOFFSET.testf3.p) } addVectorOfnull1369 public static func addVectorOf(testarrayofstring2: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testarrayofstring2, at: VTOFFSET.testarrayofstring2.p) } addVectorOfnull1370 public static func addVectorOf(testarrayofsortedstruct: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testarrayofsortedstruct, at: VTOFFSET.testarrayofsortedstruct.p) } startVectorOfTestarrayofsortedstructnull1371 public static func startVectorOfTestarrayofsortedstruct(_ size: Int, in builder: inout FlatBufferBuilder) { 1372 builder.startVector(size * MemoryLayout<MyGame_Example_Ability>.size, elementSize: MemoryLayout<MyGame_Example_Ability>.alignment) 1373 } addVectorOfnull1374 public static func addVectorOf(flex: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: flex, at: VTOFFSET.flex.p) } addVectorOfnull1375 public static func addVectorOf(test5: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: test5, at: VTOFFSET.test5.p) } startVectorOfTest5null1376 public static func startVectorOfTest5(_ size: Int, in builder: inout FlatBufferBuilder) { 1377 builder.startVector(size * MemoryLayout<MyGame_Example_Test>.size, elementSize: MemoryLayout<MyGame_Example_Test>.alignment) 1378 } addVectorOfnull1379 public static func addVectorOf(vectorOfLongs: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfLongs, at: VTOFFSET.vectorOfLongs.p) } addVectorOfnull1380 public static func addVectorOf(vectorOfDoubles: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfDoubles, at: VTOFFSET.vectorOfDoubles.p) } addnull1381 public static func add(parentNamespaceTest: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: parentNamespaceTest, at: VTOFFSET.parentNamespaceTest.p) } addVectorOfnull1382 public static func addVectorOf(vectorOfReferrables: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfReferrables, at: VTOFFSET.vectorOfReferrables.p) } addnull1383 public static func add(singleWeakReference: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: singleWeakReference, def: 0, at: VTOFFSET.singleWeakReference.p) } addVectorOfnull1384 public static func addVectorOf(vectorOfWeakReferences: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfWeakReferences, at: VTOFFSET.vectorOfWeakReferences.p) } addVectorOfnull1385 public static func addVectorOf(vectorOfStrongReferrables: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfStrongReferrables, at: VTOFFSET.vectorOfStrongReferrables.p) } addnull1386 public static func add(coOwningReference: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: coOwningReference, def: 0, at: VTOFFSET.coOwningReference.p) } addVectorOfnull1387 public static func addVectorOf(vectorOfCoOwningReferences: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfCoOwningReferences, at: VTOFFSET.vectorOfCoOwningReferences.p) } addnull1388 public static func add(nonOwningReference: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: nonOwningReference, def: 0, at: VTOFFSET.nonOwningReference.p) } addVectorOfnull1389 public static func addVectorOf(vectorOfNonOwningReferences: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfNonOwningReferences, at: VTOFFSET.vectorOfNonOwningReferences.p) } addnull1390 public static func add(anyUniqueType: MyGame_Example_AnyUniqueAliases, _ fbb: inout FlatBufferBuilder) { fbb.add(element: anyUniqueType.rawValue, def: 0, at: VTOFFSET.anyUniqueType.p) } addnull1391 public static func add(anyUnique: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: anyUnique, at: VTOFFSET.anyUnique.p) } addnull1392 public static func add(anyAmbiguousType: MyGame_Example_AnyAmbiguousAliases, _ fbb: inout FlatBufferBuilder) { fbb.add(element: anyAmbiguousType.rawValue, def: 0, at: VTOFFSET.anyAmbiguousType.p) } addnull1393 public static func add(anyAmbiguous: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: anyAmbiguous, at: VTOFFSET.anyAmbiguous.p) } addVectorOfnull1394 public static func addVectorOf(vectorOfEnums: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vectorOfEnums, at: VTOFFSET.vectorOfEnums.p) } addnull1395 public static func add(signedEnum: MyGame_Example_Race, _ fbb: inout FlatBufferBuilder) { fbb.add(element: signedEnum.rawValue, def: -1, at: VTOFFSET.signedEnum.p) } addVectorOfnull1396 public static func addVectorOf(testrequirednestedflatbuffer: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testrequirednestedflatbuffer, at: VTOFFSET.testrequirednestedflatbuffer.p) } addVectorOfnull1397 public static func addVectorOf(scalarKeySortedTables: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: scalarKeySortedTables, at: VTOFFSET.scalarKeySortedTables.p) } addnull1398 public static func add(nativeInline: MyGame_Example_Test?, _ fbb: inout FlatBufferBuilder) { guard let nativeInline = nativeInline else { return }; fbb.create(struct: nativeInline, position: VTOFFSET.nativeInline.p) } addnull1399 public static func add(longEnumNonEnumDefault: MyGame_Example_LongEnum, _ fbb: inout FlatBufferBuilder) { fbb.add(element: longEnumNonEnumDefault.rawValue, def: 0, at: VTOFFSET.longEnumNonEnumDefault.p) } addnull1400 public static func add(longEnumNormalDefault: MyGame_Example_LongEnum, _ fbb: inout FlatBufferBuilder) { fbb.add(element: longEnumNormalDefault.rawValue, def: 2, at: VTOFFSET.longEnumNormalDefault.p) } endMonsternull1401 public static func endMonster(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); fbb.require(table: end, fields: [10]); return end } 1402 public static func createMonster( 1403 _ fbb: inout FlatBufferBuilder, 1404 pos: MyGame_Example_Vec3? = nil, 1405 mana: Int16 = 150, 1406 hp: Int16 = 100, 1407 nameOffset name: Offset, 1408 inventoryVectorOffset inventory: Offset = Offset(), 1409 color: MyGame_Example_Color = .blue, 1410 testType: MyGame_Example_Any_ = .none_, 1411 testOffset test: Offset = Offset(), 1412 test4VectorOffset test4: Offset = Offset(), 1413 testarrayofstringVectorOffset testarrayofstring: Offset = Offset(), 1414 testarrayoftablesVectorOffset testarrayoftables: Offset = Offset(), 1415 enemyOffset enemy: Offset = Offset(), 1416 testnestedflatbufferVectorOffset testnestedflatbuffer: Offset = Offset(), 1417 testemptyOffset testempty: Offset = Offset(), 1418 testbool: Bool = false, 1419 testhashs32Fnv1: Int32 = 0, 1420 testhashu32Fnv1: UInt32 = 0, 1421 testhashs64Fnv1: Int64 = 0, 1422 testhashu64Fnv1: UInt64 = 0, 1423 testhashs32Fnv1a: Int32 = 0, 1424 testhashu32Fnv1a: UInt32 = 0, 1425 testhashs64Fnv1a: Int64 = 0, 1426 testhashu64Fnv1a: UInt64 = 0, 1427 testarrayofboolsVectorOffset testarrayofbools: Offset = Offset(), 1428 testf: Float32 = 3.14159, 1429 testf2: Float32 = 3.0, 1430 testf3: Float32 = 0.0, 1431 testarrayofstring2VectorOffset testarrayofstring2: Offset = Offset(), 1432 testarrayofsortedstructVectorOffset testarrayofsortedstruct: Offset = Offset(), 1433 flexVectorOffset flex: Offset = Offset(), 1434 test5VectorOffset test5: Offset = Offset(), 1435 vectorOfLongsVectorOffset vectorOfLongs: Offset = Offset(), 1436 vectorOfDoublesVectorOffset vectorOfDoubles: Offset = Offset(), 1437 parentNamespaceTestOffset parentNamespaceTest: Offset = Offset(), 1438 vectorOfReferrablesVectorOffset vectorOfReferrables: Offset = Offset(), 1439 singleWeakReference: UInt64 = 0, 1440 vectorOfWeakReferencesVectorOffset vectorOfWeakReferences: Offset = Offset(), 1441 vectorOfStrongReferrablesVectorOffset vectorOfStrongReferrables: Offset = Offset(), 1442 coOwningReference: UInt64 = 0, 1443 vectorOfCoOwningReferencesVectorOffset vectorOfCoOwningReferences: Offset = Offset(), 1444 nonOwningReference: UInt64 = 0, 1445 vectorOfNonOwningReferencesVectorOffset vectorOfNonOwningReferences: Offset = Offset(), 1446 anyUniqueType: MyGame_Example_AnyUniqueAliases = .none_, 1447 anyUniqueOffset anyUnique: Offset = Offset(), 1448 anyAmbiguousType: MyGame_Example_AnyAmbiguousAliases = .none_, 1449 anyAmbiguousOffset anyAmbiguous: Offset = Offset(), 1450 vectorOfEnumsVectorOffset vectorOfEnums: Offset = Offset(), 1451 signedEnum: MyGame_Example_Race = .none_, 1452 testrequirednestedflatbufferVectorOffset testrequirednestedflatbuffer: Offset = Offset(), 1453 scalarKeySortedTablesVectorOffset scalarKeySortedTables: Offset = Offset(), 1454 nativeInline: MyGame_Example_Test? = nil, 1455 longEnumNonEnumDefault: MyGame_Example_LongEnum = .longone, 1456 longEnumNormalDefault: MyGame_Example_LongEnum = .longone 1457 ) -> Offset { 1458 let __start = MyGame_Example_Monster.startMonster(&fbb) 1459 MyGame_Example_Monster.add(pos: pos, &fbb) 1460 MyGame_Example_Monster.add(mana: mana, &fbb) 1461 MyGame_Example_Monster.add(hp: hp, &fbb) 1462 MyGame_Example_Monster.add(name: name, &fbb) 1463 MyGame_Example_Monster.addVectorOf(inventory: inventory, &fbb) 1464 MyGame_Example_Monster.add(color: color, &fbb) 1465 MyGame_Example_Monster.add(testType: testType, &fbb) 1466 MyGame_Example_Monster.add(test: test, &fbb) 1467 MyGame_Example_Monster.addVectorOf(test4: test4, &fbb) 1468 MyGame_Example_Monster.addVectorOf(testarrayofstring: testarrayofstring, &fbb) 1469 MyGame_Example_Monster.addVectorOf(testarrayoftables: testarrayoftables, &fbb) 1470 MyGame_Example_Monster.add(enemy: enemy, &fbb) 1471 MyGame_Example_Monster.addVectorOf(testnestedflatbuffer: testnestedflatbuffer, &fbb) 1472 MyGame_Example_Monster.add(testempty: testempty, &fbb) 1473 MyGame_Example_Monster.add(testbool: testbool, &fbb) 1474 MyGame_Example_Monster.add(testhashs32Fnv1: testhashs32Fnv1, &fbb) 1475 MyGame_Example_Monster.add(testhashu32Fnv1: testhashu32Fnv1, &fbb) 1476 MyGame_Example_Monster.add(testhashs64Fnv1: testhashs64Fnv1, &fbb) 1477 MyGame_Example_Monster.add(testhashu64Fnv1: testhashu64Fnv1, &fbb) 1478 MyGame_Example_Monster.add(testhashs32Fnv1a: testhashs32Fnv1a, &fbb) 1479 MyGame_Example_Monster.add(testhashu32Fnv1a: testhashu32Fnv1a, &fbb) 1480 MyGame_Example_Monster.add(testhashs64Fnv1a: testhashs64Fnv1a, &fbb) 1481 MyGame_Example_Monster.add(testhashu64Fnv1a: testhashu64Fnv1a, &fbb) 1482 MyGame_Example_Monster.addVectorOf(testarrayofbools: testarrayofbools, &fbb) 1483 MyGame_Example_Monster.add(testf: testf, &fbb) 1484 MyGame_Example_Monster.add(testf2: testf2, &fbb) 1485 MyGame_Example_Monster.add(testf3: testf3, &fbb) 1486 MyGame_Example_Monster.addVectorOf(testarrayofstring2: testarrayofstring2, &fbb) 1487 MyGame_Example_Monster.addVectorOf(testarrayofsortedstruct: testarrayofsortedstruct, &fbb) 1488 MyGame_Example_Monster.addVectorOf(flex: flex, &fbb) 1489 MyGame_Example_Monster.addVectorOf(test5: test5, &fbb) 1490 MyGame_Example_Monster.addVectorOf(vectorOfLongs: vectorOfLongs, &fbb) 1491 MyGame_Example_Monster.addVectorOf(vectorOfDoubles: vectorOfDoubles, &fbb) 1492 MyGame_Example_Monster.add(parentNamespaceTest: parentNamespaceTest, &fbb) 1493 MyGame_Example_Monster.addVectorOf(vectorOfReferrables: vectorOfReferrables, &fbb) 1494 MyGame_Example_Monster.add(singleWeakReference: singleWeakReference, &fbb) 1495 MyGame_Example_Monster.addVectorOf(vectorOfWeakReferences: vectorOfWeakReferences, &fbb) 1496 MyGame_Example_Monster.addVectorOf(vectorOfStrongReferrables: vectorOfStrongReferrables, &fbb) 1497 MyGame_Example_Monster.add(coOwningReference: coOwningReference, &fbb) 1498 MyGame_Example_Monster.addVectorOf(vectorOfCoOwningReferences: vectorOfCoOwningReferences, &fbb) 1499 MyGame_Example_Monster.add(nonOwningReference: nonOwningReference, &fbb) 1500 MyGame_Example_Monster.addVectorOf(vectorOfNonOwningReferences: vectorOfNonOwningReferences, &fbb) 1501 MyGame_Example_Monster.add(anyUniqueType: anyUniqueType, &fbb) 1502 MyGame_Example_Monster.add(anyUnique: anyUnique, &fbb) 1503 MyGame_Example_Monster.add(anyAmbiguousType: anyAmbiguousType, &fbb) 1504 MyGame_Example_Monster.add(anyAmbiguous: anyAmbiguous, &fbb) 1505 MyGame_Example_Monster.addVectorOf(vectorOfEnums: vectorOfEnums, &fbb) 1506 MyGame_Example_Monster.add(signedEnum: signedEnum, &fbb) 1507 MyGame_Example_Monster.addVectorOf(testrequirednestedflatbuffer: testrequirednestedflatbuffer, &fbb) 1508 MyGame_Example_Monster.addVectorOf(scalarKeySortedTables: scalarKeySortedTables, &fbb) 1509 MyGame_Example_Monster.add(nativeInline: nativeInline, &fbb) 1510 MyGame_Example_Monster.add(longEnumNonEnumDefault: longEnumNonEnumDefault, &fbb) 1511 MyGame_Example_Monster.add(longEnumNormalDefault: longEnumNormalDefault, &fbb) 1512 return MyGame_Example_Monster.endMonster(&fbb, start: __start) 1513 } sortVectorOfMonsternull1514 public static func sortVectorOfMonster(offsets:[Offset], _ fbb: inout FlatBufferBuilder) -> Offset { 1515 var off = offsets 1516 off.sort { Table.compare(Table.offset(Int32($1.o), vOffset: 10, fbb: fbb.buffer), Table.offset(Int32($0.o), vOffset: 10, fbb: fbb.buffer), fbb: fbb.buffer) < 0 } 1517 return fbb.createVector(ofOffsets: off) 1518 } lookupByKeynull1519 fileprivate static func lookupByKey(vector: Int32, key: String, fbb: ByteBuffer) -> MyGame_Example_Monster? { 1520 let key = key.utf8.map { $0 } 1521 var span = fbb.read(def: Int32.self, position: Int(vector - 4)) 1522 var start: Int32 = 0 1523 while span != 0 { 1524 var middle = span / 2 1525 let tableOffset = Table.indirect(vector + 4 * (start + middle), fbb) 1526 let comp = Table.compare(Table.offset(Int32(fbb.capacity) - tableOffset, vOffset: 10, fbb: fbb), key, fbb: fbb) 1527 if comp > 0 { 1528 span = middle 1529 } else if comp < 0 { 1530 middle += 1 1531 start += middle 1532 span -= middle 1533 } else { 1534 return MyGame_Example_Monster(fbb, o: tableOffset) 1535 } 1536 } 1537 return nil 1538 } 1539 1540 unpacknull1541 public mutating func unpack() -> MyGame_Example_MonsterT { 1542 return MyGame_Example_MonsterT(&self) 1543 } packnull1544 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_MonsterT?) -> Offset { 1545 guard var obj = obj else { return Offset() } 1546 return pack(&builder, obj: &obj) 1547 } 1548 packnull1549 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_MonsterT) -> Offset { 1550 let __name = builder.create(string: obj.name) 1551 let __inventory = builder.createVector(obj.inventory) 1552 let __test = obj.test?.pack(builder: &builder) ?? Offset() 1553 MyGame_Example_Monster.startVectorOfTest4(obj.test4.count, in: &builder) 1554 for i in obj.test4 { 1555 guard let _o = i else { continue } 1556 builder.create(struct: _o) 1557 } 1558 let __test4 = builder.endVector(len: obj.test4.count) 1559 let __testarrayofstring = builder.createVector(ofStrings: obj.testarrayofstring.compactMap({ $0 }) ) 1560 var __testarrayoftables__: [Offset] = [] 1561 for var i in obj.testarrayoftables { 1562 __testarrayoftables__.append(MyGame_Example_Monster.pack(&builder, obj: &i)) 1563 } 1564 let __testarrayoftables = builder.createVector(ofOffsets: __testarrayoftables__) 1565 let __enemy = MyGame_Example_Monster.pack(&builder, obj: &obj.enemy) 1566 let __testnestedflatbuffer = builder.createVector(obj.testnestedflatbuffer) 1567 let __testempty = MyGame_Example_Stat.pack(&builder, obj: &obj.testempty) 1568 let __testarrayofbools = builder.createVector(obj.testarrayofbools) 1569 let __testarrayofstring2 = builder.createVector(ofStrings: obj.testarrayofstring2.compactMap({ $0 }) ) 1570 MyGame_Example_Monster.startVectorOfTestarrayofsortedstruct(obj.testarrayofsortedstruct.count, in: &builder) 1571 for i in obj.testarrayofsortedstruct { 1572 guard let _o = i else { continue } 1573 builder.create(struct: _o) 1574 } 1575 let __testarrayofsortedstruct = builder.endVector(len: obj.testarrayofsortedstruct.count) 1576 let __flex = builder.createVector(obj.flex) 1577 MyGame_Example_Monster.startVectorOfTest5(obj.test5.count, in: &builder) 1578 for i in obj.test5 { 1579 guard let _o = i else { continue } 1580 builder.create(struct: _o) 1581 } 1582 let __test5 = builder.endVector(len: obj.test5.count) 1583 let __vectorOfLongs = builder.createVector(obj.vectorOfLongs) 1584 let __vectorOfDoubles = builder.createVector(obj.vectorOfDoubles) 1585 let __parentNamespaceTest = MyGame_InParentNamespace.pack(&builder, obj: &obj.parentNamespaceTest) 1586 var __vectorOfReferrables__: [Offset] = [] 1587 for var i in obj.vectorOfReferrables { 1588 __vectorOfReferrables__.append(MyGame_Example_Referrable.pack(&builder, obj: &i)) 1589 } 1590 let __vectorOfReferrables = builder.createVector(ofOffsets: __vectorOfReferrables__) 1591 let __vectorOfWeakReferences = builder.createVector(obj.vectorOfWeakReferences) 1592 var __vectorOfStrongReferrables__: [Offset] = [] 1593 for var i in obj.vectorOfStrongReferrables { 1594 __vectorOfStrongReferrables__.append(MyGame_Example_Referrable.pack(&builder, obj: &i)) 1595 } 1596 let __vectorOfStrongReferrables = builder.createVector(ofOffsets: __vectorOfStrongReferrables__) 1597 let __vectorOfCoOwningReferences = builder.createVector(obj.vectorOfCoOwningReferences) 1598 let __vectorOfNonOwningReferences = builder.createVector(obj.vectorOfNonOwningReferences) 1599 let __anyUnique = obj.anyUnique?.pack(builder: &builder) ?? Offset() 1600 let __anyAmbiguous = obj.anyAmbiguous?.pack(builder: &builder) ?? Offset() 1601 let __vectorOfEnums = builder.createVector(obj.vectorOfEnums) 1602 let __testrequirednestedflatbuffer = builder.createVector(obj.testrequirednestedflatbuffer) 1603 var __scalarKeySortedTables__: [Offset] = [] 1604 for var i in obj.scalarKeySortedTables { 1605 __scalarKeySortedTables__.append(MyGame_Example_Stat.pack(&builder, obj: &i)) 1606 } 1607 let __scalarKeySortedTables = builder.createVector(ofOffsets: __scalarKeySortedTables__) 1608 let __root = MyGame_Example_Monster.startMonster(&builder) 1609 MyGame_Example_Monster.add(pos: obj.pos, &builder) 1610 MyGame_Example_Monster.add(mana: obj.mana, &builder) 1611 MyGame_Example_Monster.add(hp: obj.hp, &builder) 1612 MyGame_Example_Monster.add(name: __name, &builder) 1613 MyGame_Example_Monster.addVectorOf(inventory: __inventory, &builder) 1614 MyGame_Example_Monster.add(color: obj.color, &builder) 1615 if let o = obj.test?.type { 1616 MyGame_Example_Monster.add(testType: o, &builder) 1617 MyGame_Example_Monster.add(test: __test, &builder) 1618 } 1619 1620 MyGame_Example_Monster.addVectorOf(test4: __test4, &builder) 1621 MyGame_Example_Monster.addVectorOf(testarrayofstring: __testarrayofstring, &builder) 1622 MyGame_Example_Monster.addVectorOf(testarrayoftables: __testarrayoftables, &builder) 1623 MyGame_Example_Monster.add(enemy: __enemy, &builder) 1624 MyGame_Example_Monster.addVectorOf(testnestedflatbuffer: __testnestedflatbuffer, &builder) 1625 MyGame_Example_Monster.add(testempty: __testempty, &builder) 1626 MyGame_Example_Monster.add(testbool: obj.testbool, &builder) 1627 MyGame_Example_Monster.add(testhashs32Fnv1: obj.testhashs32Fnv1, &builder) 1628 MyGame_Example_Monster.add(testhashu32Fnv1: obj.testhashu32Fnv1, &builder) 1629 MyGame_Example_Monster.add(testhashs64Fnv1: obj.testhashs64Fnv1, &builder) 1630 MyGame_Example_Monster.add(testhashu64Fnv1: obj.testhashu64Fnv1, &builder) 1631 MyGame_Example_Monster.add(testhashs32Fnv1a: obj.testhashs32Fnv1a, &builder) 1632 MyGame_Example_Monster.add(testhashu32Fnv1a: obj.testhashu32Fnv1a, &builder) 1633 MyGame_Example_Monster.add(testhashs64Fnv1a: obj.testhashs64Fnv1a, &builder) 1634 MyGame_Example_Monster.add(testhashu64Fnv1a: obj.testhashu64Fnv1a, &builder) 1635 MyGame_Example_Monster.addVectorOf(testarrayofbools: __testarrayofbools, &builder) 1636 MyGame_Example_Monster.add(testf: obj.testf, &builder) 1637 MyGame_Example_Monster.add(testf2: obj.testf2, &builder) 1638 MyGame_Example_Monster.add(testf3: obj.testf3, &builder) 1639 MyGame_Example_Monster.addVectorOf(testarrayofstring2: __testarrayofstring2, &builder) 1640 MyGame_Example_Monster.addVectorOf(testarrayofsortedstruct: __testarrayofsortedstruct, &builder) 1641 MyGame_Example_Monster.addVectorOf(flex: __flex, &builder) 1642 MyGame_Example_Monster.addVectorOf(test5: __test5, &builder) 1643 MyGame_Example_Monster.addVectorOf(vectorOfLongs: __vectorOfLongs, &builder) 1644 MyGame_Example_Monster.addVectorOf(vectorOfDoubles: __vectorOfDoubles, &builder) 1645 MyGame_Example_Monster.add(parentNamespaceTest: __parentNamespaceTest, &builder) 1646 MyGame_Example_Monster.addVectorOf(vectorOfReferrables: __vectorOfReferrables, &builder) 1647 MyGame_Example_Monster.add(singleWeakReference: obj.singleWeakReference, &builder) 1648 MyGame_Example_Monster.addVectorOf(vectorOfWeakReferences: __vectorOfWeakReferences, &builder) 1649 MyGame_Example_Monster.addVectorOf(vectorOfStrongReferrables: __vectorOfStrongReferrables, &builder) 1650 MyGame_Example_Monster.add(coOwningReference: obj.coOwningReference, &builder) 1651 MyGame_Example_Monster.addVectorOf(vectorOfCoOwningReferences: __vectorOfCoOwningReferences, &builder) 1652 MyGame_Example_Monster.add(nonOwningReference: obj.nonOwningReference, &builder) 1653 MyGame_Example_Monster.addVectorOf(vectorOfNonOwningReferences: __vectorOfNonOwningReferences, &builder) 1654 if let o = obj.anyUnique?.type { 1655 MyGame_Example_Monster.add(anyUniqueType: o, &builder) 1656 MyGame_Example_Monster.add(anyUnique: __anyUnique, &builder) 1657 } 1658 1659 if let o = obj.anyAmbiguous?.type { 1660 MyGame_Example_Monster.add(anyAmbiguousType: o, &builder) 1661 MyGame_Example_Monster.add(anyAmbiguous: __anyAmbiguous, &builder) 1662 } 1663 1664 MyGame_Example_Monster.addVectorOf(vectorOfEnums: __vectorOfEnums, &builder) 1665 MyGame_Example_Monster.add(signedEnum: obj.signedEnum, &builder) 1666 MyGame_Example_Monster.addVectorOf(testrequirednestedflatbuffer: __testrequirednestedflatbuffer, &builder) 1667 MyGame_Example_Monster.addVectorOf(scalarKeySortedTables: __scalarKeySortedTables, &builder) 1668 MyGame_Example_Monster.add(nativeInline: obj.nativeInline, &builder) 1669 MyGame_Example_Monster.add(longEnumNonEnumDefault: obj.longEnumNonEnumDefault, &builder) 1670 MyGame_Example_Monster.add(longEnumNormalDefault: obj.longEnumNormalDefault, &builder) 1671 return MyGame_Example_Monster.endMonster(&builder, start: __root) 1672 } 1673 verify<T>null1674 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 1675 var _v = try verifier.visitTable(at: position) 1676 try _v.visit(field: VTOFFSET.pos.p, fieldName: "pos", required: false, type: MyGame_Example_Vec3.self) 1677 try _v.visit(field: VTOFFSET.mana.p, fieldName: "mana", required: false, type: Int16.self) 1678 try _v.visit(field: VTOFFSET.hp.p, fieldName: "hp", required: false, type: Int16.self) 1679 try _v.visit(field: VTOFFSET.name.p, fieldName: "name", required: true, type: ForwardOffset<String>.self) 1680 try _v.visit(field: VTOFFSET.inventory.p, fieldName: "inventory", required: false, type: ForwardOffset<Vector<UInt8, UInt8>>.self) 1681 try _v.visit(field: VTOFFSET.color.p, fieldName: "color", required: false, type: MyGame_Example_Color.self) 1682 try _v.visit(unionKey: VTOFFSET.testType.p, unionField: VTOFFSET.test.p, unionKeyName: "testType", fieldName: "test", required: false, completion: { (verifier, key: MyGame_Example_Any_, pos) in 1683 switch key { 1684 case .none_: 1685 break // NOTE - SWIFT doesnt support none 1686 case .monster: 1687 try ForwardOffset<MyGame_Example_Monster>.verify(&verifier, at: pos, of: MyGame_Example_Monster.self) 1688 case .testsimpletablewithenum: 1689 try ForwardOffset<MyGame_Example_TestSimpleTableWithEnum>.verify(&verifier, at: pos, of: MyGame_Example_TestSimpleTableWithEnum.self) 1690 case .mygameExample2Monster: 1691 try ForwardOffset<MyGame_Example2_Monster>.verify(&verifier, at: pos, of: MyGame_Example2_Monster.self) 1692 } 1693 }) 1694 try _v.visit(field: VTOFFSET.test4.p, fieldName: "test4", required: false, type: ForwardOffset<Vector<MyGame_Example_Test, MyGame_Example_Test>>.self) 1695 try _v.visit(field: VTOFFSET.testarrayofstring.p, fieldName: "testarrayofstring", required: false, type: ForwardOffset<Vector<ForwardOffset<String>, String>>.self) 1696 try _v.visit(field: VTOFFSET.testarrayoftables.p, fieldName: "testarrayoftables", required: false, type: ForwardOffset<Vector<ForwardOffset<MyGame_Example_Monster>, MyGame_Example_Monster>>.self) 1697 try _v.visit(field: VTOFFSET.enemy.p, fieldName: "enemy", required: false, type: ForwardOffset<MyGame_Example_Monster>.self) 1698 try _v.visit(field: VTOFFSET.testnestedflatbuffer.p, fieldName: "testnestedflatbuffer", required: false, type: ForwardOffset<Vector<UInt8, UInt8>>.self) 1699 try _v.visit(field: VTOFFSET.testempty.p, fieldName: "testempty", required: false, type: ForwardOffset<MyGame_Example_Stat>.self) 1700 try _v.visit(field: VTOFFSET.testbool.p, fieldName: "testbool", required: false, type: Bool.self) 1701 try _v.visit(field: VTOFFSET.testhashs32Fnv1.p, fieldName: "testhashs32Fnv1", required: false, type: Int32.self) 1702 try _v.visit(field: VTOFFSET.testhashu32Fnv1.p, fieldName: "testhashu32Fnv1", required: false, type: UInt32.self) 1703 try _v.visit(field: VTOFFSET.testhashs64Fnv1.p, fieldName: "testhashs64Fnv1", required: false, type: Int64.self) 1704 try _v.visit(field: VTOFFSET.testhashu64Fnv1.p, fieldName: "testhashu64Fnv1", required: false, type: UInt64.self) 1705 try _v.visit(field: VTOFFSET.testhashs32Fnv1a.p, fieldName: "testhashs32Fnv1a", required: false, type: Int32.self) 1706 try _v.visit(field: VTOFFSET.testhashu32Fnv1a.p, fieldName: "testhashu32Fnv1a", required: false, type: UInt32.self) 1707 try _v.visit(field: VTOFFSET.testhashs64Fnv1a.p, fieldName: "testhashs64Fnv1a", required: false, type: Int64.self) 1708 try _v.visit(field: VTOFFSET.testhashu64Fnv1a.p, fieldName: "testhashu64Fnv1a", required: false, type: UInt64.self) 1709 try _v.visit(field: VTOFFSET.testarrayofbools.p, fieldName: "testarrayofbools", required: false, type: ForwardOffset<Vector<Bool, Bool>>.self) 1710 try _v.visit(field: VTOFFSET.testf.p, fieldName: "testf", required: false, type: Float32.self) 1711 try _v.visit(field: VTOFFSET.testf2.p, fieldName: "testf2", required: false, type: Float32.self) 1712 try _v.visit(field: VTOFFSET.testf3.p, fieldName: "testf3", required: false, type: Float32.self) 1713 try _v.visit(field: VTOFFSET.testarrayofstring2.p, fieldName: "testarrayofstring2", required: false, type: ForwardOffset<Vector<ForwardOffset<String>, String>>.self) 1714 try _v.visit(field: VTOFFSET.testarrayofsortedstruct.p, fieldName: "testarrayofsortedstruct", required: false, type: ForwardOffset<Vector<MyGame_Example_Ability, MyGame_Example_Ability>>.self) 1715 try _v.visit(field: VTOFFSET.flex.p, fieldName: "flex", required: false, type: ForwardOffset<Vector<UInt8, UInt8>>.self) 1716 try _v.visit(field: VTOFFSET.test5.p, fieldName: "test5", required: false, type: ForwardOffset<Vector<MyGame_Example_Test, MyGame_Example_Test>>.self) 1717 try _v.visit(field: VTOFFSET.vectorOfLongs.p, fieldName: "vectorOfLongs", required: false, type: ForwardOffset<Vector<Int64, Int64>>.self) 1718 try _v.visit(field: VTOFFSET.vectorOfDoubles.p, fieldName: "vectorOfDoubles", required: false, type: ForwardOffset<Vector<Double, Double>>.self) 1719 try _v.visit(field: VTOFFSET.parentNamespaceTest.p, fieldName: "parentNamespaceTest", required: false, type: ForwardOffset<MyGame_InParentNamespace>.self) 1720 try _v.visit(field: VTOFFSET.vectorOfReferrables.p, fieldName: "vectorOfReferrables", required: false, type: ForwardOffset<Vector<ForwardOffset<MyGame_Example_Referrable>, MyGame_Example_Referrable>>.self) 1721 try _v.visit(field: VTOFFSET.singleWeakReference.p, fieldName: "singleWeakReference", required: false, type: UInt64.self) 1722 try _v.visit(field: VTOFFSET.vectorOfWeakReferences.p, fieldName: "vectorOfWeakReferences", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self) 1723 try _v.visit(field: VTOFFSET.vectorOfStrongReferrables.p, fieldName: "vectorOfStrongReferrables", required: false, type: ForwardOffset<Vector<ForwardOffset<MyGame_Example_Referrable>, MyGame_Example_Referrable>>.self) 1724 try _v.visit(field: VTOFFSET.coOwningReference.p, fieldName: "coOwningReference", required: false, type: UInt64.self) 1725 try _v.visit(field: VTOFFSET.vectorOfCoOwningReferences.p, fieldName: "vectorOfCoOwningReferences", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self) 1726 try _v.visit(field: VTOFFSET.nonOwningReference.p, fieldName: "nonOwningReference", required: false, type: UInt64.self) 1727 try _v.visit(field: VTOFFSET.vectorOfNonOwningReferences.p, fieldName: "vectorOfNonOwningReferences", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self) 1728 try _v.visit(unionKey: VTOFFSET.anyUniqueType.p, unionField: VTOFFSET.anyUnique.p, unionKeyName: "anyUniqueType", fieldName: "anyUnique", required: false, completion: { (verifier, key: MyGame_Example_AnyUniqueAliases, pos) in 1729 switch key { 1730 case .none_: 1731 break // NOTE - SWIFT doesnt support none 1732 case .m: 1733 try ForwardOffset<MyGame_Example_Monster>.verify(&verifier, at: pos, of: MyGame_Example_Monster.self) 1734 case .ts: 1735 try ForwardOffset<MyGame_Example_TestSimpleTableWithEnum>.verify(&verifier, at: pos, of: MyGame_Example_TestSimpleTableWithEnum.self) 1736 case .m2: 1737 try ForwardOffset<MyGame_Example2_Monster>.verify(&verifier, at: pos, of: MyGame_Example2_Monster.self) 1738 } 1739 }) 1740 try _v.visit(unionKey: VTOFFSET.anyAmbiguousType.p, unionField: VTOFFSET.anyAmbiguous.p, unionKeyName: "anyAmbiguousType", fieldName: "anyAmbiguous", required: false, completion: { (verifier, key: MyGame_Example_AnyAmbiguousAliases, pos) in 1741 switch key { 1742 case .none_: 1743 break // NOTE - SWIFT doesnt support none 1744 case .m1: 1745 try ForwardOffset<MyGame_Example_Monster>.verify(&verifier, at: pos, of: MyGame_Example_Monster.self) 1746 case .m2: 1747 try ForwardOffset<MyGame_Example_Monster>.verify(&verifier, at: pos, of: MyGame_Example_Monster.self) 1748 case .m3: 1749 try ForwardOffset<MyGame_Example_Monster>.verify(&verifier, at: pos, of: MyGame_Example_Monster.self) 1750 } 1751 }) 1752 try _v.visit(field: VTOFFSET.vectorOfEnums.p, fieldName: "vectorOfEnums", required: false, type: ForwardOffset<Vector<MyGame_Example_Color, MyGame_Example_Color>>.self) 1753 try _v.visit(field: VTOFFSET.signedEnum.p, fieldName: "signedEnum", required: false, type: MyGame_Example_Race.self) 1754 try _v.visit(field: VTOFFSET.testrequirednestedflatbuffer.p, fieldName: "testrequirednestedflatbuffer", required: false, type: ForwardOffset<Vector<UInt8, UInt8>>.self) 1755 try _v.visit(field: VTOFFSET.scalarKeySortedTables.p, fieldName: "scalarKeySortedTables", required: false, type: ForwardOffset<Vector<ForwardOffset<MyGame_Example_Stat>, MyGame_Example_Stat>>.self) 1756 try _v.visit(field: VTOFFSET.nativeInline.p, fieldName: "nativeInline", required: false, type: MyGame_Example_Test.self) 1757 try _v.visit(field: VTOFFSET.longEnumNonEnumDefault.p, fieldName: "longEnumNonEnumDefault", required: false, type: MyGame_Example_LongEnum.self) 1758 try _v.visit(field: VTOFFSET.longEnumNormalDefault.p, fieldName: "longEnumNormalDefault", required: false, type: MyGame_Example_LongEnum.self) 1759 _v.finish() 1760 } 1761 } 1762 1763 extension MyGame_Example_Monster: Encodable { 1764 1765 enum CodingKeys: String, CodingKey { 1766 case pos = "pos" 1767 case mana = "mana" 1768 case hp = "hp" 1769 case name = "name" 1770 case inventory = "inventory" 1771 case color = "color" 1772 case testType = "test_type" 1773 case test = "test" 1774 case test4 = "test4" 1775 case testarrayofstring = "testarrayofstring" 1776 case testarrayoftables = "testarrayoftables" 1777 case enemy = "enemy" 1778 case testnestedflatbuffer = "testnestedflatbuffer" 1779 case testempty = "testempty" 1780 case testbool = "testbool" 1781 case testhashs32Fnv1 = "testhashs32_fnv1" 1782 case testhashu32Fnv1 = "testhashu32_fnv1" 1783 case testhashs64Fnv1 = "testhashs64_fnv1" 1784 case testhashu64Fnv1 = "testhashu64_fnv1" 1785 case testhashs32Fnv1a = "testhashs32_fnv1a" 1786 case testhashu32Fnv1a = "testhashu32_fnv1a" 1787 case testhashs64Fnv1a = "testhashs64_fnv1a" 1788 case testhashu64Fnv1a = "testhashu64_fnv1a" 1789 case testarrayofbools = "testarrayofbools" 1790 case testf = "testf" 1791 case testf2 = "testf2" 1792 case testf3 = "testf3" 1793 case testarrayofstring2 = "testarrayofstring2" 1794 case testarrayofsortedstruct = "testarrayofsortedstruct" 1795 case flex = "flex" 1796 case test5 = "test5" 1797 case vectorOfLongs = "vector_of_longs" 1798 case vectorOfDoubles = "vector_of_doubles" 1799 case parentNamespaceTest = "parent_namespace_test" 1800 case vectorOfReferrables = "vector_of_referrables" 1801 case singleWeakReference = "single_weak_reference" 1802 case vectorOfWeakReferences = "vector_of_weak_references" 1803 case vectorOfStrongReferrables = "vector_of_strong_referrables" 1804 case coOwningReference = "co_owning_reference" 1805 case vectorOfCoOwningReferences = "vector_of_co_owning_references" 1806 case nonOwningReference = "non_owning_reference" 1807 case vectorOfNonOwningReferences = "vector_of_non_owning_references" 1808 case anyUniqueType = "any_unique_type" 1809 case anyUnique = "any_unique" 1810 case anyAmbiguousType = "any_ambiguous_type" 1811 case anyAmbiguous = "any_ambiguous" 1812 case vectorOfEnums = "vector_of_enums" 1813 case signedEnum = "signed_enum" 1814 case testrequirednestedflatbuffer = "testrequirednestedflatbuffer" 1815 case scalarKeySortedTables = "scalar_key_sorted_tables" 1816 case nativeInline = "native_inline" 1817 case longEnumNonEnumDefault = "long_enum_non_enum_default" 1818 case longEnumNormalDefault = "long_enum_normal_default" 1819 } encodenull1820 public func encode(to encoder: Encoder) throws { 1821 var container = encoder.container(keyedBy: CodingKeys.self) 1822 try container.encodeIfPresent(pos, forKey: .pos) 1823 if mana != 150 { 1824 try container.encodeIfPresent(mana, forKey: .mana) 1825 } 1826 if hp != 100 { 1827 try container.encodeIfPresent(hp, forKey: .hp) 1828 } 1829 try container.encodeIfPresent(name, forKey: .name) 1830 if inventoryCount > 0 { 1831 try container.encodeIfPresent(inventory, forKey: .inventory) 1832 } 1833 if color != .blue { 1834 try container.encodeIfPresent(color, forKey: .color) 1835 } 1836 if testType != .none_ { 1837 try container.encodeIfPresent(testType, forKey: .testType) 1838 } 1839 switch testType { 1840 case .monster: 1841 let _v = test(type: MyGame_Example_Monster.self) 1842 try container.encodeIfPresent(_v, forKey: .test) 1843 case .testsimpletablewithenum: 1844 let _v = test(type: MyGame_Example_TestSimpleTableWithEnum.self) 1845 try container.encodeIfPresent(_v, forKey: .test) 1846 case .mygameExample2Monster: 1847 let _v = test(type: MyGame_Example2_Monster.self) 1848 try container.encodeIfPresent(_v, forKey: .test) 1849 default: break; 1850 } 1851 if test4Count > 0 { 1852 var contentEncoder = container.nestedUnkeyedContainer(forKey: .test4) 1853 for index in 0..<test4Count { 1854 guard let type = test4(at: index) else { continue } 1855 try contentEncoder.encode(type) 1856 } 1857 } 1858 if testarrayofstringCount > 0 { 1859 var contentEncoder = container.nestedUnkeyedContainer(forKey: .testarrayofstring) 1860 for index in 0..<testarrayofstringCount { 1861 guard let type = testarrayofstring(at: index) else { continue } 1862 try contentEncoder.encode(type) 1863 } 1864 } 1865 if testarrayoftablesCount > 0 { 1866 var contentEncoder = container.nestedUnkeyedContainer(forKey: .testarrayoftables) 1867 for index in 0..<testarrayoftablesCount { 1868 guard let type = testarrayoftables(at: index) else { continue } 1869 try contentEncoder.encode(type) 1870 } 1871 } 1872 try container.encodeIfPresent(enemy, forKey: .enemy) 1873 if testnestedflatbufferCount > 0 { 1874 try container.encodeIfPresent(testnestedflatbuffer, forKey: .testnestedflatbuffer) 1875 } 1876 try container.encodeIfPresent(testempty, forKey: .testempty) 1877 if testbool != false { 1878 try container.encodeIfPresent(testbool, forKey: .testbool) 1879 } 1880 if testhashs32Fnv1 != 0 { 1881 try container.encodeIfPresent(testhashs32Fnv1, forKey: .testhashs32Fnv1) 1882 } 1883 if testhashu32Fnv1 != 0 { 1884 try container.encodeIfPresent(testhashu32Fnv1, forKey: .testhashu32Fnv1) 1885 } 1886 if testhashs64Fnv1 != 0 { 1887 try container.encodeIfPresent(testhashs64Fnv1, forKey: .testhashs64Fnv1) 1888 } 1889 if testhashu64Fnv1 != 0 { 1890 try container.encodeIfPresent(testhashu64Fnv1, forKey: .testhashu64Fnv1) 1891 } 1892 if testhashs32Fnv1a != 0 { 1893 try container.encodeIfPresent(testhashs32Fnv1a, forKey: .testhashs32Fnv1a) 1894 } 1895 if testhashu32Fnv1a != 0 { 1896 try container.encodeIfPresent(testhashu32Fnv1a, forKey: .testhashu32Fnv1a) 1897 } 1898 if testhashs64Fnv1a != 0 { 1899 try container.encodeIfPresent(testhashs64Fnv1a, forKey: .testhashs64Fnv1a) 1900 } 1901 if testhashu64Fnv1a != 0 { 1902 try container.encodeIfPresent(testhashu64Fnv1a, forKey: .testhashu64Fnv1a) 1903 } 1904 if testarrayofboolsCount > 0 { 1905 try container.encodeIfPresent(testarrayofbools, forKey: .testarrayofbools) 1906 } 1907 if testf != 3.14159 { 1908 try container.encodeIfPresent(testf, forKey: .testf) 1909 } 1910 if testf2 != 3.0 { 1911 try container.encodeIfPresent(testf2, forKey: .testf2) 1912 } 1913 if testf3 != 0.0 { 1914 try container.encodeIfPresent(testf3, forKey: .testf3) 1915 } 1916 if testarrayofstring2Count > 0 { 1917 var contentEncoder = container.nestedUnkeyedContainer(forKey: .testarrayofstring2) 1918 for index in 0..<testarrayofstring2Count { 1919 guard let type = testarrayofstring2(at: index) else { continue } 1920 try contentEncoder.encode(type) 1921 } 1922 } 1923 if testarrayofsortedstructCount > 0 { 1924 var contentEncoder = container.nestedUnkeyedContainer(forKey: .testarrayofsortedstruct) 1925 for index in 0..<testarrayofsortedstructCount { 1926 guard let type = testarrayofsortedstruct(at: index) else { continue } 1927 try contentEncoder.encode(type) 1928 } 1929 } 1930 if flexCount > 0 { 1931 try container.encodeIfPresent(flex, forKey: .flex) 1932 } 1933 if test5Count > 0 { 1934 var contentEncoder = container.nestedUnkeyedContainer(forKey: .test5) 1935 for index in 0..<test5Count { 1936 guard let type = test5(at: index) else { continue } 1937 try contentEncoder.encode(type) 1938 } 1939 } 1940 if vectorOfLongsCount > 0 { 1941 try container.encodeIfPresent(vectorOfLongs, forKey: .vectorOfLongs) 1942 } 1943 if vectorOfDoublesCount > 0 { 1944 try container.encodeIfPresent(vectorOfDoubles, forKey: .vectorOfDoubles) 1945 } 1946 try container.encodeIfPresent(parentNamespaceTest, forKey: .parentNamespaceTest) 1947 if vectorOfReferrablesCount > 0 { 1948 var contentEncoder = container.nestedUnkeyedContainer(forKey: .vectorOfReferrables) 1949 for index in 0..<vectorOfReferrablesCount { 1950 guard let type = vectorOfReferrables(at: index) else { continue } 1951 try contentEncoder.encode(type) 1952 } 1953 } 1954 if singleWeakReference != 0 { 1955 try container.encodeIfPresent(singleWeakReference, forKey: .singleWeakReference) 1956 } 1957 if vectorOfWeakReferencesCount > 0 { 1958 try container.encodeIfPresent(vectorOfWeakReferences, forKey: .vectorOfWeakReferences) 1959 } 1960 if vectorOfStrongReferrablesCount > 0 { 1961 var contentEncoder = container.nestedUnkeyedContainer(forKey: .vectorOfStrongReferrables) 1962 for index in 0..<vectorOfStrongReferrablesCount { 1963 guard let type = vectorOfStrongReferrables(at: index) else { continue } 1964 try contentEncoder.encode(type) 1965 } 1966 } 1967 if coOwningReference != 0 { 1968 try container.encodeIfPresent(coOwningReference, forKey: .coOwningReference) 1969 } 1970 if vectorOfCoOwningReferencesCount > 0 { 1971 try container.encodeIfPresent(vectorOfCoOwningReferences, forKey: .vectorOfCoOwningReferences) 1972 } 1973 if nonOwningReference != 0 { 1974 try container.encodeIfPresent(nonOwningReference, forKey: .nonOwningReference) 1975 } 1976 if vectorOfNonOwningReferencesCount > 0 { 1977 try container.encodeIfPresent(vectorOfNonOwningReferences, forKey: .vectorOfNonOwningReferences) 1978 } 1979 if anyUniqueType != .none_ { 1980 try container.encodeIfPresent(anyUniqueType, forKey: .anyUniqueType) 1981 } 1982 switch anyUniqueType { 1983 case .m: 1984 let _v = anyUnique(type: MyGame_Example_Monster.self) 1985 try container.encodeIfPresent(_v, forKey: .anyUnique) 1986 case .ts: 1987 let _v = anyUnique(type: MyGame_Example_TestSimpleTableWithEnum.self) 1988 try container.encodeIfPresent(_v, forKey: .anyUnique) 1989 case .m2: 1990 let _v = anyUnique(type: MyGame_Example2_Monster.self) 1991 try container.encodeIfPresent(_v, forKey: .anyUnique) 1992 default: break; 1993 } 1994 if anyAmbiguousType != .none_ { 1995 try container.encodeIfPresent(anyAmbiguousType, forKey: .anyAmbiguousType) 1996 } 1997 switch anyAmbiguousType { 1998 case .m1: 1999 let _v = anyAmbiguous(type: MyGame_Example_Monster.self) 2000 try container.encodeIfPresent(_v, forKey: .anyAmbiguous) 2001 case .m2: 2002 let _v = anyAmbiguous(type: MyGame_Example_Monster.self) 2003 try container.encodeIfPresent(_v, forKey: .anyAmbiguous) 2004 case .m3: 2005 let _v = anyAmbiguous(type: MyGame_Example_Monster.self) 2006 try container.encodeIfPresent(_v, forKey: .anyAmbiguous) 2007 default: break; 2008 } 2009 if vectorOfEnumsCount > 0 { 2010 var contentEncoder = container.nestedUnkeyedContainer(forKey: .vectorOfEnums) 2011 for index in 0..<vectorOfEnumsCount { 2012 guard let type = vectorOfEnums(at: index) else { continue } 2013 try contentEncoder.encode(type) 2014 } 2015 } 2016 if signedEnum != .none_ { 2017 try container.encodeIfPresent(signedEnum, forKey: .signedEnum) 2018 } 2019 if testrequirednestedflatbufferCount > 0 { 2020 try container.encodeIfPresent(testrequirednestedflatbuffer, forKey: .testrequirednestedflatbuffer) 2021 } 2022 if scalarKeySortedTablesCount > 0 { 2023 var contentEncoder = container.nestedUnkeyedContainer(forKey: .scalarKeySortedTables) 2024 for index in 0..<scalarKeySortedTablesCount { 2025 guard let type = scalarKeySortedTables(at: index) else { continue } 2026 try contentEncoder.encode(type) 2027 } 2028 } 2029 try container.encodeIfPresent(nativeInline, forKey: .nativeInline) 2030 if longEnumNonEnumDefault != .longone { 2031 try container.encodeIfPresent(longEnumNonEnumDefault, forKey: .longEnumNonEnumDefault) 2032 } 2033 if longEnumNormalDefault != .longone { 2034 try container.encodeIfPresent(longEnumNormalDefault, forKey: .longEnumNormalDefault) 2035 } 2036 } 2037 } 2038 2039 public class MyGame_Example_MonsterT: NativeObject { 2040 2041 public var pos: MyGame_Example_Vec3? 2042 public var mana: Int16 2043 public var hp: Int16 2044 public var name: String 2045 public var inventory: [UInt8] 2046 public var color: MyGame_Example_Color 2047 public var test: MyGame_Example_Any_Union? 2048 public var test4: [MyGame_Example_Test?] 2049 public var testarrayofstring: [String?] 2050 public var testarrayoftables: [MyGame_Example_MonsterT?] 2051 public var enemy: MyGame_Example_MonsterT? 2052 public var testnestedflatbuffer: [UInt8] 2053 public var testempty: MyGame_Example_StatT? 2054 public var testbool: Bool 2055 public var testhashs32Fnv1: Int32 2056 public var testhashu32Fnv1: UInt32 2057 public var testhashs64Fnv1: Int64 2058 public var testhashu64Fnv1: UInt64 2059 public var testhashs32Fnv1a: Int32 2060 public var testhashu32Fnv1a: UInt32 2061 public var testhashs64Fnv1a: Int64 2062 public var testhashu64Fnv1a: UInt64 2063 public var testarrayofbools: [Bool] 2064 public var testf: Float32 2065 public var testf2: Float32 2066 public var testf3: Float32 2067 public var testarrayofstring2: [String?] 2068 public var testarrayofsortedstruct: [MyGame_Example_Ability?] 2069 public var flex: [UInt8] 2070 public var test5: [MyGame_Example_Test?] 2071 public var vectorOfLongs: [Int64] 2072 public var vectorOfDoubles: [Double] 2073 public var parentNamespaceTest: MyGame_InParentNamespaceT? 2074 public var vectorOfReferrables: [MyGame_Example_ReferrableT?] 2075 public var singleWeakReference: UInt64 2076 public var vectorOfWeakReferences: [UInt64] 2077 public var vectorOfStrongReferrables: [MyGame_Example_ReferrableT?] 2078 public var coOwningReference: UInt64 2079 public var vectorOfCoOwningReferences: [UInt64] 2080 public var nonOwningReference: UInt64 2081 public var vectorOfNonOwningReferences: [UInt64] 2082 public var anyUnique: MyGame_Example_AnyUniqueAliasesUnion? 2083 public var anyAmbiguous: MyGame_Example_AnyAmbiguousAliasesUnion? 2084 public var vectorOfEnums: [MyGame_Example_Color] 2085 public var signedEnum: MyGame_Example_Race 2086 public var testrequirednestedflatbuffer: [UInt8] 2087 public var scalarKeySortedTables: [MyGame_Example_StatT?] 2088 public var nativeInline: MyGame_Example_Test? 2089 public var longEnumNonEnumDefault: MyGame_Example_LongEnum 2090 public var longEnumNormalDefault: MyGame_Example_LongEnum 2091 2092 public init(_ _t: inout MyGame_Example_Monster) { 2093 pos = _t.pos 2094 mana = _t.mana 2095 hp = _t.hp 2096 name = _t.name 2097 inventory = [] 2098 for index in 0..<_t.inventoryCount { 2099 inventory.append(_t.inventory(at: index)) 2100 } 2101 color = _t.color 2102 switch _t.testType { 2103 case .monster: 2104 var _v = _t.test(type: MyGame_Example_Monster.self) 2105 test = MyGame_Example_Any_Union(_v?.unpack(), type: .monster) 2106 case .testsimpletablewithenum: 2107 var _v = _t.test(type: MyGame_Example_TestSimpleTableWithEnum.self) 2108 test = MyGame_Example_Any_Union(_v?.unpack(), type: .testsimpletablewithenum) 2109 case .mygameExample2Monster: 2110 var _v = _t.test(type: MyGame_Example2_Monster.self) 2111 test = MyGame_Example_Any_Union(_v?.unpack(), type: .mygameExample2Monster) 2112 default: break 2113 } 2114 test4 = [] 2115 for index in 0..<_t.test4Count { 2116 test4.append(_t.test4(at: index)) 2117 } 2118 testarrayofstring = [] 2119 for index in 0..<_t.testarrayofstringCount { 2120 testarrayofstring.append(_t.testarrayofstring(at: index)) 2121 } 2122 testarrayoftables = [] 2123 for index in 0..<_t.testarrayoftablesCount { 2124 var __v_ = _t.testarrayoftables(at: index) 2125 testarrayoftables.append(__v_?.unpack()) 2126 } 2127 var __enemy = _t.enemy 2128 enemy = __enemy?.unpack() 2129 testnestedflatbuffer = [] 2130 for index in 0..<_t.testnestedflatbufferCount { 2131 testnestedflatbuffer.append(_t.testnestedflatbuffer(at: index)) 2132 } 2133 var __testempty = _t.testempty 2134 testempty = __testempty?.unpack() 2135 testbool = _t.testbool 2136 testhashs32Fnv1 = _t.testhashs32Fnv1 2137 testhashu32Fnv1 = _t.testhashu32Fnv1 2138 testhashs64Fnv1 = _t.testhashs64Fnv1 2139 testhashu64Fnv1 = _t.testhashu64Fnv1 2140 testhashs32Fnv1a = _t.testhashs32Fnv1a 2141 testhashu32Fnv1a = _t.testhashu32Fnv1a 2142 testhashs64Fnv1a = _t.testhashs64Fnv1a 2143 testhashu64Fnv1a = _t.testhashu64Fnv1a 2144 testarrayofbools = [] 2145 for index in 0..<_t.testarrayofboolsCount { 2146 testarrayofbools.append(_t.testarrayofbools(at: index)) 2147 } 2148 testf = _t.testf 2149 testf2 = _t.testf2 2150 testf3 = _t.testf3 2151 testarrayofstring2 = [] 2152 for index in 0..<_t.testarrayofstring2Count { 2153 testarrayofstring2.append(_t.testarrayofstring2(at: index)) 2154 } 2155 testarrayofsortedstruct = [] 2156 for index in 0..<_t.testarrayofsortedstructCount { 2157 testarrayofsortedstruct.append(_t.testarrayofsortedstruct(at: index)) 2158 } 2159 flex = [] 2160 for index in 0..<_t.flexCount { 2161 flex.append(_t.flex(at: index)) 2162 } 2163 test5 = [] 2164 for index in 0..<_t.test5Count { 2165 test5.append(_t.test5(at: index)) 2166 } 2167 vectorOfLongs = [] 2168 for index in 0..<_t.vectorOfLongsCount { 2169 vectorOfLongs.append(_t.vectorOfLongs(at: index)) 2170 } 2171 vectorOfDoubles = [] 2172 for index in 0..<_t.vectorOfDoublesCount { 2173 vectorOfDoubles.append(_t.vectorOfDoubles(at: index)) 2174 } 2175 var __parentNamespaceTest = _t.parentNamespaceTest 2176 parentNamespaceTest = __parentNamespaceTest?.unpack() 2177 vectorOfReferrables = [] 2178 for index in 0..<_t.vectorOfReferrablesCount { 2179 var __v_ = _t.vectorOfReferrables(at: index) 2180 vectorOfReferrables.append(__v_?.unpack()) 2181 } 2182 singleWeakReference = _t.singleWeakReference 2183 vectorOfWeakReferences = [] 2184 for index in 0..<_t.vectorOfWeakReferencesCount { 2185 vectorOfWeakReferences.append(_t.vectorOfWeakReferences(at: index)) 2186 } 2187 vectorOfStrongReferrables = [] 2188 for index in 0..<_t.vectorOfStrongReferrablesCount { 2189 var __v_ = _t.vectorOfStrongReferrables(at: index) 2190 vectorOfStrongReferrables.append(__v_?.unpack()) 2191 } 2192 coOwningReference = _t.coOwningReference 2193 vectorOfCoOwningReferences = [] 2194 for index in 0..<_t.vectorOfCoOwningReferencesCount { 2195 vectorOfCoOwningReferences.append(_t.vectorOfCoOwningReferences(at: index)) 2196 } 2197 nonOwningReference = _t.nonOwningReference 2198 vectorOfNonOwningReferences = [] 2199 for index in 0..<_t.vectorOfNonOwningReferencesCount { 2200 vectorOfNonOwningReferences.append(_t.vectorOfNonOwningReferences(at: index)) 2201 } 2202 switch _t.anyUniqueType { 2203 case .m: 2204 var _v = _t.anyUnique(type: MyGame_Example_Monster.self) 2205 anyUnique = MyGame_Example_AnyUniqueAliasesUnion(_v?.unpack(), type: .m) 2206 case .ts: 2207 var _v = _t.anyUnique(type: MyGame_Example_TestSimpleTableWithEnum.self) 2208 anyUnique = MyGame_Example_AnyUniqueAliasesUnion(_v?.unpack(), type: .ts) 2209 case .m2: 2210 var _v = _t.anyUnique(type: MyGame_Example2_Monster.self) 2211 anyUnique = MyGame_Example_AnyUniqueAliasesUnion(_v?.unpack(), type: .m2) 2212 default: break 2213 } 2214 switch _t.anyAmbiguousType { 2215 case .m1: 2216 var _v = _t.anyAmbiguous(type: MyGame_Example_Monster.self) 2217 anyAmbiguous = MyGame_Example_AnyAmbiguousAliasesUnion(_v?.unpack(), type: .m1) 2218 case .m2: 2219 var _v = _t.anyAmbiguous(type: MyGame_Example_Monster.self) 2220 anyAmbiguous = MyGame_Example_AnyAmbiguousAliasesUnion(_v?.unpack(), type: .m2) 2221 case .m3: 2222 var _v = _t.anyAmbiguous(type: MyGame_Example_Monster.self) 2223 anyAmbiguous = MyGame_Example_AnyAmbiguousAliasesUnion(_v?.unpack(), type: .m3) 2224 default: break 2225 } 2226 vectorOfEnums = [] 2227 for index in 0..<_t.vectorOfEnumsCount { 2228 vectorOfEnums.append(_t.vectorOfEnums(at: index)!) 2229 } 2230 signedEnum = _t.signedEnum 2231 testrequirednestedflatbuffer = [] 2232 for index in 0..<_t.testrequirednestedflatbufferCount { 2233 testrequirednestedflatbuffer.append(_t.testrequirednestedflatbuffer(at: index)) 2234 } 2235 scalarKeySortedTables = [] 2236 for index in 0..<_t.scalarKeySortedTablesCount { 2237 var __v_ = _t.scalarKeySortedTables(at: index) 2238 scalarKeySortedTables.append(__v_?.unpack()) 2239 } 2240 nativeInline = _t.nativeInline 2241 longEnumNonEnumDefault = _t.longEnumNonEnumDefault 2242 longEnumNormalDefault = _t.longEnumNormalDefault 2243 } 2244 2245 public init() { 2246 pos = MyGame_Example_Vec3() 2247 mana = 150 2248 hp = 100 2249 name = "" 2250 inventory = [] 2251 color = .blue 2252 test4 = [] 2253 testarrayofstring = [] 2254 testarrayoftables = [] 2255 enemy = MyGame_Example_MonsterT() 2256 testnestedflatbuffer = [] 2257 testempty = MyGame_Example_StatT() 2258 testbool = false 2259 testhashs32Fnv1 = 0 2260 testhashu32Fnv1 = 0 2261 testhashs64Fnv1 = 0 2262 testhashu64Fnv1 = 0 2263 testhashs32Fnv1a = 0 2264 testhashu32Fnv1a = 0 2265 testhashs64Fnv1a = 0 2266 testhashu64Fnv1a = 0 2267 testarrayofbools = [] 2268 testf = 3.14159 2269 testf2 = 3.0 2270 testf3 = 0.0 2271 testarrayofstring2 = [] 2272 testarrayofsortedstruct = [] 2273 flex = [] 2274 test5 = [] 2275 vectorOfLongs = [] 2276 vectorOfDoubles = [] 2277 parentNamespaceTest = MyGame_InParentNamespaceT() 2278 vectorOfReferrables = [] 2279 singleWeakReference = 0 2280 vectorOfWeakReferences = [] 2281 vectorOfStrongReferrables = [] 2282 coOwningReference = 0 2283 vectorOfCoOwningReferences = [] 2284 nonOwningReference = 0 2285 vectorOfNonOwningReferences = [] 2286 vectorOfEnums = [] 2287 signedEnum = .none_ 2288 testrequirednestedflatbuffer = [] 2289 scalarKeySortedTables = [] 2290 nativeInline = MyGame_Example_Test() 2291 longEnumNonEnumDefault = .longone 2292 longEnumNormalDefault = .longone 2293 } 2294 serializenull2295 public func serialize() -> ByteBuffer { return serialize(type: MyGame_Example_Monster.self) } 2296 2297 } 2298 public struct MyGame_Example_TypeAliases: FlatBufferObject, Verifiable, ObjectAPIPacker { 2299 validateVersionnull2300 static func validateVersion() { FlatBuffersVersion_2_0_0() } 2301 public var __buffer: ByteBuffer! { return _accessor.bb } 2302 private var _accessor: Table 2303 2304 public static var id: String { "MONS" } finishnull2305 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TypeAliases.id, addPrefix: prefix) } getRootAsTypeAliasesnull2306 public static func getRootAsTypeAliases(bb: ByteBuffer) -> MyGame_Example_TypeAliases { return MyGame_Example_TypeAliases(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 2307 2308 private init(_ t: Table) { _accessor = t } 2309 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 2310 2311 private enum VTOFFSET: VOffset { 2312 case i8 = 4 2313 case u8 = 6 2314 case i16 = 8 2315 case u16 = 10 2316 case i32 = 12 2317 case u32 = 14 2318 case i64 = 16 2319 case u64 = 18 2320 case f32 = 20 2321 case f64 = 22 2322 case v8 = 24 2323 case vf64 = 26 2324 var v: Int32 { Int32(self.rawValue) } 2325 var p: VOffset { self.rawValue } 2326 } 2327 2328 public var i8: Int8 { let o = _accessor.offset(VTOFFSET.i8.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int8.self, at: o) } mutatenull2329 @discardableResult public func mutate(i8: Int8) -> Bool {let o = _accessor.offset(VTOFFSET.i8.v); return _accessor.mutate(i8, index: o) } 2330 public var u8: UInt8 { let o = _accessor.offset(VTOFFSET.u8.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt8.self, at: o) } mutatenull2331 @discardableResult public func mutate(u8: UInt8) -> Bool {let o = _accessor.offset(VTOFFSET.u8.v); return _accessor.mutate(u8, index: o) } 2332 public var i16: Int16 { let o = _accessor.offset(VTOFFSET.i16.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int16.self, at: o) } mutatenull2333 @discardableResult public func mutate(i16: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.i16.v); return _accessor.mutate(i16, index: o) } 2334 public var u16: UInt16 { let o = _accessor.offset(VTOFFSET.u16.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) } mutatenull2335 @discardableResult public func mutate(u16: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.u16.v); return _accessor.mutate(u16, index: o) } 2336 public var i32: Int32 { let o = _accessor.offset(VTOFFSET.i32.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) } mutatenull2337 @discardableResult public func mutate(i32: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.i32.v); return _accessor.mutate(i32, index: o) } 2338 public var u32: UInt32 { let o = _accessor.offset(VTOFFSET.u32.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) } mutatenull2339 @discardableResult public func mutate(u32: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.u32.v); return _accessor.mutate(u32, index: o) } 2340 public var i64: Int64 { let o = _accessor.offset(VTOFFSET.i64.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) } mutatenull2341 @discardableResult public func mutate(i64: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.i64.v); return _accessor.mutate(i64, index: o) } 2342 public var u64: UInt64 { let o = _accessor.offset(VTOFFSET.u64.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } mutatenull2343 @discardableResult public func mutate(u64: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.u64.v); return _accessor.mutate(u64, index: o) } 2344 public var f32: Float32 { let o = _accessor.offset(VTOFFSET.f32.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) } mutatenull2345 @discardableResult public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.f32.v); return _accessor.mutate(f32, index: o) } 2346 public var f64: Double { let o = _accessor.offset(VTOFFSET.f64.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) } mutatenull2347 @discardableResult public func mutate(f64: Double) -> Bool {let o = _accessor.offset(VTOFFSET.f64.v); return _accessor.mutate(f64, index: o) } 2348 public var hasV8: Bool { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? false : true } 2349 public var v8Count: Int32 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.vector(count: o) } v8null2350 public func v8(at index: Int32) -> Int8 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.directRead(of: Int8.self, offset: _accessor.vector(at: o) + index * 1) } 2351 public var v8: [Int8] { return _accessor.getVector(at: VTOFFSET.v8.v) ?? [] } mutatenull2352 public func mutate(v8: Int8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.v8.v); return _accessor.directMutate(v8, index: _accessor.vector(at: o) + index * 1) } 2353 public var hasVf64: Bool { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? false : true } 2354 public var vf64Count: Int32 { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.vector(count: o) } vf64null2355 public func vf64(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) } 2356 public var vf64: [Double] { return _accessor.getVector(at: VTOFFSET.vf64.v) ?? [] } mutatenull2357 public func mutate(vf64: Double, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vf64.v); return _accessor.directMutate(vf64, index: _accessor.vector(at: o) + index * 8) } startTypeAliasesnull2358 public static func startTypeAliases(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 12) } addnull2359 public static func add(i8: Int8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: i8, def: 0, at: VTOFFSET.i8.p) } addnull2360 public static func add(u8: UInt8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: u8, def: 0, at: VTOFFSET.u8.p) } addnull2361 public static func add(i16: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: i16, def: 0, at: VTOFFSET.i16.p) } addnull2362 public static func add(u16: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: u16, def: 0, at: VTOFFSET.u16.p) } addnull2363 public static func add(i32: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: i32, def: 0, at: VTOFFSET.i32.p) } addnull2364 public static func add(u32: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: u32, def: 0, at: VTOFFSET.u32.p) } addnull2365 public static func add(i64: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: i64, def: 0, at: VTOFFSET.i64.p) } addnull2366 public static func add(u64: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: u64, def: 0, at: VTOFFSET.u64.p) } addnull2367 public static func add(f32: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: f32, def: 0.0, at: VTOFFSET.f32.p) } addnull2368 public static func add(f64: Double, _ fbb: inout FlatBufferBuilder) { fbb.add(element: f64, def: 0.0, at: VTOFFSET.f64.p) } addVectorOfnull2369 public static func addVectorOf(v8: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: v8, at: VTOFFSET.v8.p) } addVectorOfnull2370 public static func addVectorOf(vf64: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: vf64, at: VTOFFSET.vf64.p) } endTypeAliasesnull2371 public static func endTypeAliases(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 2372 public static func createTypeAliases( 2373 _ fbb: inout FlatBufferBuilder, 2374 i8: Int8 = 0, 2375 u8: UInt8 = 0, 2376 i16: Int16 = 0, 2377 u16: UInt16 = 0, 2378 i32: Int32 = 0, 2379 u32: UInt32 = 0, 2380 i64: Int64 = 0, 2381 u64: UInt64 = 0, 2382 f32: Float32 = 0.0, 2383 f64: Double = 0.0, 2384 v8VectorOffset v8: Offset = Offset(), 2385 vf64VectorOffset vf64: Offset = Offset() 2386 ) -> Offset { 2387 let __start = MyGame_Example_TypeAliases.startTypeAliases(&fbb) 2388 MyGame_Example_TypeAliases.add(i8: i8, &fbb) 2389 MyGame_Example_TypeAliases.add(u8: u8, &fbb) 2390 MyGame_Example_TypeAliases.add(i16: i16, &fbb) 2391 MyGame_Example_TypeAliases.add(u16: u16, &fbb) 2392 MyGame_Example_TypeAliases.add(i32: i32, &fbb) 2393 MyGame_Example_TypeAliases.add(u32: u32, &fbb) 2394 MyGame_Example_TypeAliases.add(i64: i64, &fbb) 2395 MyGame_Example_TypeAliases.add(u64: u64, &fbb) 2396 MyGame_Example_TypeAliases.add(f32: f32, &fbb) 2397 MyGame_Example_TypeAliases.add(f64: f64, &fbb) 2398 MyGame_Example_TypeAliases.addVectorOf(v8: v8, &fbb) 2399 MyGame_Example_TypeAliases.addVectorOf(vf64: vf64, &fbb) 2400 return MyGame_Example_TypeAliases.endTypeAliases(&fbb, start: __start) 2401 } 2402 2403 unpacknull2404 public mutating func unpack() -> MyGame_Example_TypeAliasesT { 2405 return MyGame_Example_TypeAliasesT(&self) 2406 } packnull2407 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_TypeAliasesT?) -> Offset { 2408 guard var obj = obj else { return Offset() } 2409 return pack(&builder, obj: &obj) 2410 } 2411 packnull2412 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_TypeAliasesT) -> Offset { 2413 let __v8 = builder.createVector(obj.v8) 2414 let __vf64 = builder.createVector(obj.vf64) 2415 let __root = MyGame_Example_TypeAliases.startTypeAliases(&builder) 2416 MyGame_Example_TypeAliases.add(i8: obj.i8, &builder) 2417 MyGame_Example_TypeAliases.add(u8: obj.u8, &builder) 2418 MyGame_Example_TypeAliases.add(i16: obj.i16, &builder) 2419 MyGame_Example_TypeAliases.add(u16: obj.u16, &builder) 2420 MyGame_Example_TypeAliases.add(i32: obj.i32, &builder) 2421 MyGame_Example_TypeAliases.add(u32: obj.u32, &builder) 2422 MyGame_Example_TypeAliases.add(i64: obj.i64, &builder) 2423 MyGame_Example_TypeAliases.add(u64: obj.u64, &builder) 2424 MyGame_Example_TypeAliases.add(f32: obj.f32, &builder) 2425 MyGame_Example_TypeAliases.add(f64: obj.f64, &builder) 2426 MyGame_Example_TypeAliases.addVectorOf(v8: __v8, &builder) 2427 MyGame_Example_TypeAliases.addVectorOf(vf64: __vf64, &builder) 2428 return MyGame_Example_TypeAliases.endTypeAliases(&builder, start: __root) 2429 } 2430 verify<T>null2431 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 2432 var _v = try verifier.visitTable(at: position) 2433 try _v.visit(field: VTOFFSET.i8.p, fieldName: "i8", required: false, type: Int8.self) 2434 try _v.visit(field: VTOFFSET.u8.p, fieldName: "u8", required: false, type: UInt8.self) 2435 try _v.visit(field: VTOFFSET.i16.p, fieldName: "i16", required: false, type: Int16.self) 2436 try _v.visit(field: VTOFFSET.u16.p, fieldName: "u16", required: false, type: UInt16.self) 2437 try _v.visit(field: VTOFFSET.i32.p, fieldName: "i32", required: false, type: Int32.self) 2438 try _v.visit(field: VTOFFSET.u32.p, fieldName: "u32", required: false, type: UInt32.self) 2439 try _v.visit(field: VTOFFSET.i64.p, fieldName: "i64", required: false, type: Int64.self) 2440 try _v.visit(field: VTOFFSET.u64.p, fieldName: "u64", required: false, type: UInt64.self) 2441 try _v.visit(field: VTOFFSET.f32.p, fieldName: "f32", required: false, type: Float32.self) 2442 try _v.visit(field: VTOFFSET.f64.p, fieldName: "f64", required: false, type: Double.self) 2443 try _v.visit(field: VTOFFSET.v8.p, fieldName: "v8", required: false, type: ForwardOffset<Vector<Int8, Int8>>.self) 2444 try _v.visit(field: VTOFFSET.vf64.p, fieldName: "vf64", required: false, type: ForwardOffset<Vector<Double, Double>>.self) 2445 _v.finish() 2446 } 2447 } 2448 2449 extension MyGame_Example_TypeAliases: Encodable { 2450 2451 enum CodingKeys: String, CodingKey { 2452 case i8 = "i8" 2453 case u8 = "u8" 2454 case i16 = "i16" 2455 case u16 = "u16" 2456 case i32 = "i32" 2457 case u32 = "u32" 2458 case i64 = "i64" 2459 case u64 = "u64" 2460 case f32 = "f32" 2461 case f64 = "f64" 2462 case v8 = "v8" 2463 case vf64 = "vf64" 2464 } encodenull2465 public func encode(to encoder: Encoder) throws { 2466 var container = encoder.container(keyedBy: CodingKeys.self) 2467 if i8 != 0 { 2468 try container.encodeIfPresent(i8, forKey: .i8) 2469 } 2470 if u8 != 0 { 2471 try container.encodeIfPresent(u8, forKey: .u8) 2472 } 2473 if i16 != 0 { 2474 try container.encodeIfPresent(i16, forKey: .i16) 2475 } 2476 if u16 != 0 { 2477 try container.encodeIfPresent(u16, forKey: .u16) 2478 } 2479 if i32 != 0 { 2480 try container.encodeIfPresent(i32, forKey: .i32) 2481 } 2482 if u32 != 0 { 2483 try container.encodeIfPresent(u32, forKey: .u32) 2484 } 2485 if i64 != 0 { 2486 try container.encodeIfPresent(i64, forKey: .i64) 2487 } 2488 if u64 != 0 { 2489 try container.encodeIfPresent(u64, forKey: .u64) 2490 } 2491 if f32 != 0.0 { 2492 try container.encodeIfPresent(f32, forKey: .f32) 2493 } 2494 if f64 != 0.0 { 2495 try container.encodeIfPresent(f64, forKey: .f64) 2496 } 2497 if v8Count > 0 { 2498 try container.encodeIfPresent(v8, forKey: .v8) 2499 } 2500 if vf64Count > 0 { 2501 try container.encodeIfPresent(vf64, forKey: .vf64) 2502 } 2503 } 2504 } 2505 2506 public class MyGame_Example_TypeAliasesT: NativeObject { 2507 2508 public var i8: Int8 2509 public var u8: UInt8 2510 public var i16: Int16 2511 public var u16: UInt16 2512 public var i32: Int32 2513 public var u32: UInt32 2514 public var i64: Int64 2515 public var u64: UInt64 2516 public var f32: Float32 2517 public var f64: Double 2518 public var v8: [Int8] 2519 public var vf64: [Double] 2520 2521 public init(_ _t: inout MyGame_Example_TypeAliases) { 2522 i8 = _t.i8 2523 u8 = _t.u8 2524 i16 = _t.i16 2525 u16 = _t.u16 2526 i32 = _t.i32 2527 u32 = _t.u32 2528 i64 = _t.i64 2529 u64 = _t.u64 2530 f32 = _t.f32 2531 f64 = _t.f64 2532 v8 = [] 2533 for index in 0..<_t.v8Count { 2534 v8.append(_t.v8(at: index)) 2535 } 2536 vf64 = [] 2537 for index in 0..<_t.vf64Count { 2538 vf64.append(_t.vf64(at: index)) 2539 } 2540 } 2541 2542 public init() { 2543 i8 = 0 2544 u8 = 0 2545 i16 = 0 2546 u16 = 0 2547 i32 = 0 2548 u32 = 0 2549 i64 = 0 2550 u64 = 0 2551 f32 = 0.0 2552 f64 = 0.0 2553 v8 = [] 2554 vf64 = [] 2555 } 2556 serializenull2557 public func serialize() -> ByteBuffer { return serialize(type: MyGame_Example_TypeAliases.self) } 2558 2559 } 2560