1 // automatically generated by the FlatBuffers compiler, do not modify 2 // swiftlint:disable all 3 // swiftformat:disable all 4 5 import FlatBuffers 6 7 public struct Property: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { 8 validateVersionnull9 static func validateVersion() { FlatBuffersVersion_2_0_0() } 10 11 private var _property: Bool 12 13 public init(_ bb: ByteBuffer, o: Int32) { 14 let _accessor = Struct(bb: bb, position: o) 15 _property = _accessor.readBuffer(of: Bool.self, at: 0) 16 } 17 18 public init(property: Bool) { 19 _property = property 20 } 21 22 public init() { 23 _property = false 24 } 25 26 public init(_ _t: inout Property_Mutable) { 27 _property = _t.property 28 } 29 30 public var property: Bool { _property } 31 verify<T>null32 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 33 try verifier.inBuffer(position: position, of: Property.self) 34 } 35 } 36 37 extension Property: Encodable { 38 39 enum CodingKeys: String, CodingKey { 40 case property = "property" 41 } encodenull42 public func encode(to encoder: Encoder) throws { 43 var container = encoder.container(keyedBy: CodingKeys.self) 44 if property != false { 45 try container.encodeIfPresent(property, forKey: .property) 46 } 47 } 48 } 49 50 public struct Property_Mutable: FlatBufferObject { 51 validateVersionnull52 static func validateVersion() { FlatBuffersVersion_2_0_0() } 53 public var __buffer: ByteBuffer! { return _accessor.bb } 54 private var _accessor: Struct 55 56 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) } 57 58 public var property: Bool { return _accessor.readBuffer(of: Bool.self, at: 0) } mutatenull59 @discardableResult public func mutate(property: Bool) -> Bool { return _accessor.mutate(property, index: 0) } 60 61 unpacknull62 public mutating func unpack() -> Property { 63 return Property(&self) 64 } packnull65 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout Property?) -> Offset { 66 guard var obj = obj else { return Offset() } 67 return pack(&builder, obj: &obj) 68 } 69 packnull70 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout Property) -> Offset { 71 return builder.create(struct: obj) 72 } 73 } 74 75 public struct TestMutatingBool: FlatBufferObject, Verifiable, ObjectAPIPacker { 76 validateVersionnull77 static func validateVersion() { FlatBuffersVersion_2_0_0() } 78 public var __buffer: ByteBuffer! { return _accessor.bb } 79 private var _accessor: Table 80 getRootAsTestMutatingBoolnull81 public static func getRootAsTestMutatingBool(bb: ByteBuffer) -> TestMutatingBool { return TestMutatingBool(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 82 83 private init(_ t: Table) { _accessor = t } 84 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 85 86 private enum VTOFFSET: VOffset { 87 case b = 4 88 var v: Int32 { Int32(self.rawValue) } 89 var p: VOffset { self.rawValue } 90 } 91 92 public var b: Property? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : _accessor.readBuffer(of: Property.self, at: o) } 93 public var mutableB: Property_Mutable? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : Property_Mutable(_accessor.bb, o: o + _accessor.postion) } startTestMutatingBoolnull94 public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) } addnull95 public static func add(b: Property?, _ fbb: inout FlatBufferBuilder) { guard let b = b else { return }; fbb.create(struct: b, position: VTOFFSET.b.p) } endTestMutatingBoolnull96 public static func endTestMutatingBool(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 97 public static func createTestMutatingBool( 98 _ fbb: inout FlatBufferBuilder, 99 b: Property? = nil 100 ) -> Offset { 101 let __start = TestMutatingBool.startTestMutatingBool(&fbb) 102 TestMutatingBool.add(b: b, &fbb) 103 return TestMutatingBool.endTestMutatingBool(&fbb, start: __start) 104 } 105 106 unpacknull107 public mutating func unpack() -> TestMutatingBoolT { 108 return TestMutatingBoolT(&self) 109 } packnull110 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout TestMutatingBoolT?) -> Offset { 111 guard var obj = obj else { return Offset() } 112 return pack(&builder, obj: &obj) 113 } 114 packnull115 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout TestMutatingBoolT) -> Offset { 116 let __root = TestMutatingBool.startTestMutatingBool(&builder) 117 TestMutatingBool.add(b: obj.b, &builder) 118 return TestMutatingBool.endTestMutatingBool(&builder, start: __root) 119 } 120 verify<T>null121 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 122 var _v = try verifier.visitTable(at: position) 123 try _v.visit(field: VTOFFSET.b.p, fieldName: "b", required: false, type: Property.self) 124 _v.finish() 125 } 126 } 127 128 extension TestMutatingBool: Encodable { 129 130 enum CodingKeys: String, CodingKey { 131 case b = "b" 132 } encodenull133 public func encode(to encoder: Encoder) throws { 134 var container = encoder.container(keyedBy: CodingKeys.self) 135 try container.encodeIfPresent(b, forKey: .b) 136 } 137 } 138 139 public class TestMutatingBoolT: NativeObject { 140 141 public var b: Property? 142 143 public init(_ _t: inout TestMutatingBool) { 144 b = _t.b 145 } 146 147 public init() { 148 b = Property() 149 } 150 serializenull151 public func serialize() -> ByteBuffer { return serialize(type: TestMutatingBool.self) } 152 153 } 154