mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 15:16:28 +00:00
55 lines
2.5 KiB
Swift
55 lines
2.5 KiB
Swift
// automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
import FlatBuffers
|
|
|
|
public struct Property: Readable {
|
|
|
|
static func validateVersion() { FlatBuffersVersion_1_12_0() }
|
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
|
private var _accessor: Struct
|
|
|
|
public static var size = 1
|
|
public static var alignment = 1
|
|
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
|
|
|
public var property: Bool { return _accessor.readBuffer(of: Bool.self, at: 0) }
|
|
@discardableResult public func mutate(property: Bool) -> Bool { return _accessor.mutate(property, index: 0) }
|
|
}
|
|
|
|
public func createProperty(property: Bool = false) -> UnsafeMutableRawPointer {
|
|
let memory = UnsafeMutableRawPointer.allocate(byteCount: Property.size, alignment: Property.alignment)
|
|
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Property.size)
|
|
memory.storeBytes(of: property, toByteOffset: 0, as: Bool.self)
|
|
return memory
|
|
}
|
|
|
|
public struct TestMutatingBool: FlatBufferObject {
|
|
|
|
static func validateVersion() { FlatBuffersVersion_1_12_0() }
|
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
|
private var _accessor: Table
|
|
|
|
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))) }
|
|
|
|
private init(_ t: Table) { _accessor = t }
|
|
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
|
|
|
|
enum VTOFFSET: VOffset {
|
|
case b = 4
|
|
var v: Int32 { Int32(self.rawValue) }
|
|
var p: VOffset { self.rawValue }
|
|
}
|
|
|
|
public var b: Property? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : Property(_accessor.bb, o: o + _accessor.postion) }
|
|
public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
|
public static func add(b: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(structOffset: VTOFFSET.b.p) }
|
|
public static func endTestMutatingBool(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
|
public static func createTestMutatingBool(_ fbb: inout FlatBufferBuilder,
|
|
offsetOfB b: Offset<UOffset> = Offset()) -> Offset<UOffset> {
|
|
let __start = TestMutatingBool.startTestMutatingBool(&fbb)
|
|
TestMutatingBool.add(b: b, &fbb)
|
|
return TestMutatingBool.endTestMutatingBool(&fbb, start: __start)
|
|
}
|
|
}
|
|
|