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_24_3_25() } 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_24_3_25() } 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_24_3_25() } 78 public var __buffer: ByteBuffer! { return _accessor.bb } 79 private var _accessor: Table 80 81 private init(_ t: Table) { _accessor = t } 82 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 83 84 private enum VTOFFSET: VOffset { 85 case b = 4 86 var v: Int32 { Int32(self.rawValue) } 87 var p: VOffset { self.rawValue } 88 } 89 90 public var b: Property? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : _accessor.readBuffer(of: Property.self, at: o) } 91 public var mutableB: Property_Mutable? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : Property_Mutable(_accessor.bb, o: o + _accessor.postion) } startTestMutatingBoolnull92 public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) } addnull93 public static func add(b: Property?, _ fbb: inout FlatBufferBuilder) { guard let b = b else { return }; fbb.create(struct: b, position: VTOFFSET.b.p) } endTestMutatingBoolnull94 public static func endTestMutatingBool(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 95 public static func createTestMutatingBool( 96 _ fbb: inout FlatBufferBuilder, 97 b: Property? = nil 98 ) -> Offset { 99 let __start = TestMutatingBool.startTestMutatingBool(&fbb) 100 TestMutatingBool.add(b: b, &fbb) 101 return TestMutatingBool.endTestMutatingBool(&fbb, start: __start) 102 } 103 104 unpacknull105 public mutating func unpack() -> TestMutatingBoolT { 106 return TestMutatingBoolT(&self) 107 } packnull108 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout TestMutatingBoolT?) -> Offset { 109 guard var obj = obj else { return Offset() } 110 return pack(&builder, obj: &obj) 111 } 112 packnull113 public static func pack(_ builder: inout FlatBufferBuilder, obj: inout TestMutatingBoolT) -> Offset { 114 let __root = TestMutatingBool.startTestMutatingBool(&builder) 115 TestMutatingBool.add(b: obj.b, &builder) 116 return TestMutatingBool.endTestMutatingBool(&builder, start: __root) 117 } 118 verify<T>null119 public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable { 120 var _v = try verifier.visitTable(at: position) 121 try _v.visit(field: VTOFFSET.b.p, fieldName: "b", required: false, type: Property.self) 122 _v.finish() 123 } 124 } 125 126 extension TestMutatingBool: Encodable { 127 128 enum CodingKeys: String, CodingKey { 129 case b = "b" 130 } encodenull131 public func encode(to encoder: Encoder) throws { 132 var container = encoder.container(keyedBy: CodingKeys.self) 133 try container.encodeIfPresent(b, forKey: .b) 134 } 135 } 136 137 public class TestMutatingBoolT: NativeObject { 138 139 public var b: Property? 140 141 public init(_ _t: inout TestMutatingBool) { 142 b = _t.b 143 } 144 145 public init() { 146 b = Property() 147 } 148 serializenull149 public func serialize() -> ByteBuffer { return serialize(type: TestMutatingBool.self) } 150 151 } 152