c06f17c19c38c8d511db87fbf37e082101346cf5
[platform/upstream/flatbuffers.git] / tests / FlatBuffers.Test.Swift / Tests / FlatBuffers.Test.SwiftTests / MutatingBool_generated.swift
1 // automatically generated by the FlatBuffers compiler, do not modify
2
3 import FlatBuffers
4
5 public struct Property: NativeStruct {
6
7   static func validateVersion() { FlatBuffersVersion_1_12_0() }
8
9   public var property: Bool
10 }
11
12 public struct Property_Mutable: FlatBufferObject {
13
14     static func validateVersion() { FlatBuffersVersion_1_12_0() }
15     public var __buffer: ByteBuffer! { return _accessor.bb }
16     private var _accessor: Struct
17
18     public static var size = 1
19     public static var alignment = 1
20     public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
21
22     public var property: Bool { return _accessor.readBuffer(of: Bool.self, at: 0) }
23     @discardableResult public func mutate(property: Bool) -> Bool { return _accessor.mutate(property, index: 0) }
24 }
25
26 public struct TestMutatingBool: FlatBufferObject {
27
28     static func validateVersion() { FlatBuffersVersion_1_12_0() }
29     public var __buffer: ByteBuffer! { return _accessor.bb }
30     private var _accessor: Table
31
32     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))) }
33
34     private init(_ t: Table) { _accessor = t }
35     public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
36
37     enum VTOFFSET: VOffset {
38         case b = 4
39         var v: Int32 { Int32(self.rawValue) }
40         var p: VOffset { self.rawValue }
41     }
42
43     public var b: Property? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : _accessor.readBuffer(of: Property.self, at: o) }
44     public var mutableB: Property_Mutable? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : Property_Mutable(_accessor.bb, o: o + _accessor.postion) }
45     public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
46     public static func add(b: Property?, _ fbb: inout FlatBufferBuilder) { guard let b = b else { return }; _ = fbb.create(struct: b, position: VTOFFSET.b.p) }
47     public static func endTestMutatingBool(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
48 }
49