Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 2 | // swiftlint:disable all |
| 3 | // swiftformat:disable all |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 4 | |
| 5 | import FlatBuffers |
| 6 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 7 | public struct Property: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 8 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 9 | static func validateVersion() { FlatBuffersVersion_2_0_0() } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 10 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 11 | private var _property: Bool |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 12 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 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 | |
| 32 | 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 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 35 | } |
| 36 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 37 | extension Property: Encodable { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 38 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 39 | enum CodingKeys: String, CodingKey { |
| 40 | case property = "property" |
| 41 | } |
| 42 | 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) |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 46 | } |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 47 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 48 | } |
| 49 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 50 | public struct Property_Mutable: FlatBufferObject { |
| 51 | |
| 52 | 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) } |
| 59 | @discardableResult public func mutate(property: Bool) -> Bool { return _accessor.mutate(property, index: 0) } |
| 60 | |
| 61 | |
| 62 | public mutating func unpack() -> Property { |
| 63 | return Property(&self) |
| 64 | } |
| 65 | 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 | |
| 70 | 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 | |
| 77 | static func validateVersion() { FlatBuffersVersion_2_0_0() } |
| 78 | public var __buffer: ByteBuffer! { return _accessor.bb } |
| 79 | private var _accessor: Table |
| 80 | |
| 81 | 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) } |
| 94 | public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) } |
| 95 | public static func add(b: Property?, _ fbb: inout FlatBufferBuilder) { guard let b = b else { return }; fbb.create(struct: b, position: VTOFFSET.b.p) } |
| 96 | 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 | |
| 107 | public mutating func unpack() -> TestMutatingBoolT { |
| 108 | return TestMutatingBoolT(&self) |
| 109 | } |
| 110 | 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 | |
| 115 | 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 | |
| 121 | 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 | } |
| 133 | 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 | |
| 151 | public func serialize() -> ByteBuffer { return serialize(type: TestMutatingBool.self) } |
| 152 | |
| 153 | } |