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 enum optional_scalars_OptionalByte: Int8, Enum { 8 public typealias T = Int8 9 public static var byteSize: Int { return MemoryLayout<Int8>.size } 10 public var value: Int8 { return self.rawValue } 11 case none_ = 0 12 case one = 1 13 case two = 2 14 15 16 public static var max: optional_scalars_OptionalByte { return .two } 17 public static var min: optional_scalars_OptionalByte { return .none_ } 18 } 19 20 public struct optional_scalars_ScalarStuff: FlatBufferObject { 21 validateVersionnull22 static func validateVersion() { FlatBuffersVersion_2_0_0() } 23 public var __buffer: ByteBuffer! { return _accessor.bb } 24 private var _accessor: Table 25 finishnull26 public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "NULL", addPrefix: prefix) } getRootAsScalarStuffnull27 public static func getRootAsScalarStuff(bb: ByteBuffer) -> optional_scalars_ScalarStuff { return optional_scalars_ScalarStuff(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) } 28 29 private init(_ t: Table) { _accessor = t } 30 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) } 31 32 private enum VTOFFSET: VOffset { 33 case justI8 = 4 34 case maybeI8 = 6 35 case defaultI8 = 8 36 case justU8 = 10 37 case maybeU8 = 12 38 case defaultU8 = 14 39 case justI16 = 16 40 case maybeI16 = 18 41 case defaultI16 = 20 42 case justU16 = 22 43 case maybeU16 = 24 44 case defaultU16 = 26 45 case justI32 = 28 46 case maybeI32 = 30 47 case defaultI32 = 32 48 case justU32 = 34 49 case maybeU32 = 36 50 case defaultU32 = 38 51 case justI64 = 40 52 case maybeI64 = 42 53 case defaultI64 = 44 54 case justU64 = 46 55 case maybeU64 = 48 56 case defaultU64 = 50 57 case justF32 = 52 58 case maybeF32 = 54 59 case defaultF32 = 56 60 case justF64 = 58 61 case maybeF64 = 60 62 case defaultF64 = 62 63 case justBool = 64 64 case maybeBool = 66 65 case defaultBool = 68 66 case justEnum = 70 67 case maybeEnum = 72 68 case defaultEnum = 74 69 var v: Int32 { Int32(self.rawValue) } 70 var p: VOffset { self.rawValue } 71 } 72 73 public var justI8: Int8 { let o = _accessor.offset(VTOFFSET.justI8.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int8.self, at: o) } 74 public var maybeI8: Int8? { let o = _accessor.offset(VTOFFSET.maybeI8.v); return o == 0 ? nil : _accessor.readBuffer(of: Int8.self, at: o) } 75 public var defaultI8: Int8 { let o = _accessor.offset(VTOFFSET.defaultI8.v); return o == 0 ? 42 : _accessor.readBuffer(of: Int8.self, at: o) } 76 public var justU8: UInt8 { let o = _accessor.offset(VTOFFSET.justU8.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt8.self, at: o) } 77 public var maybeU8: UInt8? { let o = _accessor.offset(VTOFFSET.maybeU8.v); return o == 0 ? nil : _accessor.readBuffer(of: UInt8.self, at: o) } 78 public var defaultU8: UInt8 { let o = _accessor.offset(VTOFFSET.defaultU8.v); return o == 0 ? 42 : _accessor.readBuffer(of: UInt8.self, at: o) } 79 public var justI16: Int16 { let o = _accessor.offset(VTOFFSET.justI16.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int16.self, at: o) } 80 public var maybeI16: Int16? { let o = _accessor.offset(VTOFFSET.maybeI16.v); return o == 0 ? nil : _accessor.readBuffer(of: Int16.self, at: o) } 81 public var defaultI16: Int16 { let o = _accessor.offset(VTOFFSET.defaultI16.v); return o == 0 ? 42 : _accessor.readBuffer(of: Int16.self, at: o) } 82 public var justU16: UInt16 { let o = _accessor.offset(VTOFFSET.justU16.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) } 83 public var maybeU16: UInt16? { let o = _accessor.offset(VTOFFSET.maybeU16.v); return o == 0 ? nil : _accessor.readBuffer(of: UInt16.self, at: o) } 84 public var defaultU16: UInt16 { let o = _accessor.offset(VTOFFSET.defaultU16.v); return o == 0 ? 42 : _accessor.readBuffer(of: UInt16.self, at: o) } 85 public var justI32: Int32 { let o = _accessor.offset(VTOFFSET.justI32.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) } 86 public var maybeI32: Int32? { let o = _accessor.offset(VTOFFSET.maybeI32.v); return o == 0 ? nil : _accessor.readBuffer(of: Int32.self, at: o) } 87 public var defaultI32: Int32 { let o = _accessor.offset(VTOFFSET.defaultI32.v); return o == 0 ? 42 : _accessor.readBuffer(of: Int32.self, at: o) } 88 public var justU32: UInt32 { let o = _accessor.offset(VTOFFSET.justU32.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) } 89 public var maybeU32: UInt32? { let o = _accessor.offset(VTOFFSET.maybeU32.v); return o == 0 ? nil : _accessor.readBuffer(of: UInt32.self, at: o) } 90 public var defaultU32: UInt32 { let o = _accessor.offset(VTOFFSET.defaultU32.v); return o == 0 ? 42 : _accessor.readBuffer(of: UInt32.self, at: o) } 91 public var justI64: Int64 { let o = _accessor.offset(VTOFFSET.justI64.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) } 92 public var maybeI64: Int64? { let o = _accessor.offset(VTOFFSET.maybeI64.v); return o == 0 ? nil : _accessor.readBuffer(of: Int64.self, at: o) } 93 public var defaultI64: Int64 { let o = _accessor.offset(VTOFFSET.defaultI64.v); return o == 0 ? 42 : _accessor.readBuffer(of: Int64.self, at: o) } 94 public var justU64: UInt64 { let o = _accessor.offset(VTOFFSET.justU64.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) } 95 public var maybeU64: UInt64? { let o = _accessor.offset(VTOFFSET.maybeU64.v); return o == 0 ? nil : _accessor.readBuffer(of: UInt64.self, at: o) } 96 public var defaultU64: UInt64 { let o = _accessor.offset(VTOFFSET.defaultU64.v); return o == 0 ? 42 : _accessor.readBuffer(of: UInt64.self, at: o) } 97 public var justF32: Float32 { let o = _accessor.offset(VTOFFSET.justF32.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) } 98 public var maybeF32: Float32? { let o = _accessor.offset(VTOFFSET.maybeF32.v); return o == 0 ? nil : _accessor.readBuffer(of: Float32.self, at: o) } 99 public var defaultF32: Float32 { let o = _accessor.offset(VTOFFSET.defaultF32.v); return o == 0 ? 42.0 : _accessor.readBuffer(of: Float32.self, at: o) } 100 public var justF64: Double { let o = _accessor.offset(VTOFFSET.justF64.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) } 101 public var maybeF64: Double? { let o = _accessor.offset(VTOFFSET.maybeF64.v); return o == 0 ? nil : _accessor.readBuffer(of: Double.self, at: o) } 102 public var defaultF64: Double { let o = _accessor.offset(VTOFFSET.defaultF64.v); return o == 0 ? 42.0 : _accessor.readBuffer(of: Double.self, at: o) } 103 public var justBool: Bool { let o = _accessor.offset(VTOFFSET.justBool.v); return o == 0 ? false : 0 != _accessor.readBuffer(of: Byte.self, at: o) } 104 public var maybeBool: Bool? { let o = _accessor.offset(VTOFFSET.maybeBool.v); return o == 0 ? true : 0 != _accessor.readBuffer(of: Byte.self, at: o) } 105 public var defaultBool: Bool { let o = _accessor.offset(VTOFFSET.defaultBool.v); return o == 0 ? true : 0 != _accessor.readBuffer(of: Byte.self, at: o) } 106 public var justEnum: optional_scalars_OptionalByte { let o = _accessor.offset(VTOFFSET.justEnum.v); return o == 0 ? .none_ : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ } 107 public var maybeEnum: optional_scalars_OptionalByte? { let o = _accessor.offset(VTOFFSET.maybeEnum.v); return o == 0 ? nil : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? nil } 108 public var defaultEnum: optional_scalars_OptionalByte { let o = _accessor.offset(VTOFFSET.defaultEnum.v); return o == 0 ? .one : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .one } startScalarStuffnull109 public static func startScalarStuff(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 36) } addnull110 public static func add(justI8: Int8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI8, def: 0, at: VTOFFSET.justI8.p) } addnull111 public static func add(maybeI8: Int8?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI8, at: VTOFFSET.maybeI8.p) } addnull112 public static func add(defaultI8: Int8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI8, def: 42, at: VTOFFSET.defaultI8.p) } addnull113 public static func add(justU8: UInt8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU8, def: 0, at: VTOFFSET.justU8.p) } addnull114 public static func add(maybeU8: UInt8?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU8, at: VTOFFSET.maybeU8.p) } addnull115 public static func add(defaultU8: UInt8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU8, def: 42, at: VTOFFSET.defaultU8.p) } addnull116 public static func add(justI16: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI16, def: 0, at: VTOFFSET.justI16.p) } addnull117 public static func add(maybeI16: Int16?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI16, at: VTOFFSET.maybeI16.p) } addnull118 public static func add(defaultI16: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI16, def: 42, at: VTOFFSET.defaultI16.p) } addnull119 public static func add(justU16: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU16, def: 0, at: VTOFFSET.justU16.p) } addnull120 public static func add(maybeU16: UInt16?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU16, at: VTOFFSET.maybeU16.p) } addnull121 public static func add(defaultU16: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU16, def: 42, at: VTOFFSET.defaultU16.p) } addnull122 public static func add(justI32: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI32, def: 0, at: VTOFFSET.justI32.p) } addnull123 public static func add(maybeI32: Int32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI32, at: VTOFFSET.maybeI32.p) } addnull124 public static func add(defaultI32: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI32, def: 42, at: VTOFFSET.defaultI32.p) } addnull125 public static func add(justU32: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU32, def: 0, at: VTOFFSET.justU32.p) } addnull126 public static func add(maybeU32: UInt32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU32, at: VTOFFSET.maybeU32.p) } addnull127 public static func add(defaultU32: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU32, def: 42, at: VTOFFSET.defaultU32.p) } addnull128 public static func add(justI64: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI64, def: 0, at: VTOFFSET.justI64.p) } addnull129 public static func add(maybeI64: Int64?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI64, at: VTOFFSET.maybeI64.p) } addnull130 public static func add(defaultI64: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI64, def: 42, at: VTOFFSET.defaultI64.p) } addnull131 public static func add(justU64: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU64, def: 0, at: VTOFFSET.justU64.p) } addnull132 public static func add(maybeU64: UInt64?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU64, at: VTOFFSET.maybeU64.p) } addnull133 public static func add(defaultU64: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU64, def: 42, at: VTOFFSET.defaultU64.p) } addnull134 public static func add(justF32: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justF32, def: 0.0, at: VTOFFSET.justF32.p) } addnull135 public static func add(maybeF32: Float32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeF32, at: VTOFFSET.maybeF32.p) } addnull136 public static func add(defaultF32: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultF32, def: 42.0, at: VTOFFSET.defaultF32.p) } addnull137 public static func add(justF64: Double, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justF64, def: 0.0, at: VTOFFSET.justF64.p) } addnull138 public static func add(maybeF64: Double?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeF64, at: VTOFFSET.maybeF64.p) } addnull139 public static func add(defaultF64: Double, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultF64, def: 42.0, at: VTOFFSET.defaultF64.p) } addnull140 public static func add(justBool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justBool, def: false, 141 at: VTOFFSET.justBool.p) } addnull142 public static func add(maybeBool: Bool?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeBool, at: VTOFFSET.maybeBool.p) } addnull143 public static func add(defaultBool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultBool, def: true, 144 at: VTOFFSET.defaultBool.p) } addnull145 public static func add(justEnum: optional_scalars_OptionalByte, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justEnum.rawValue, def: 0, at: VTOFFSET.justEnum.p) } addnull146 public static func add(maybeEnum: optional_scalars_OptionalByte?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeEnum?.rawValue, at: VTOFFSET.maybeEnum.p) } addnull147 public static func add(defaultEnum: optional_scalars_OptionalByte, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultEnum.rawValue, def: 1, at: VTOFFSET.defaultEnum.p) } endScalarStuffnull148 public static func endScalarStuff(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end } 149 public static func createScalarStuff( 150 _ fbb: inout FlatBufferBuilder, 151 justI8: Int8 = 0, 152 maybeI8: Int8? = nil, 153 defaultI8: Int8 = 42, 154 justU8: UInt8 = 0, 155 maybeU8: UInt8? = nil, 156 defaultU8: UInt8 = 42, 157 justI16: Int16 = 0, 158 maybeI16: Int16? = nil, 159 defaultI16: Int16 = 42, 160 justU16: UInt16 = 0, 161 maybeU16: UInt16? = nil, 162 defaultU16: UInt16 = 42, 163 justI32: Int32 = 0, 164 maybeI32: Int32? = nil, 165 defaultI32: Int32 = 42, 166 justU32: UInt32 = 0, 167 maybeU32: UInt32? = nil, 168 defaultU32: UInt32 = 42, 169 justI64: Int64 = 0, 170 maybeI64: Int64? = nil, 171 defaultI64: Int64 = 42, 172 justU64: UInt64 = 0, 173 maybeU64: UInt64? = nil, 174 defaultU64: UInt64 = 42, 175 justF32: Float32 = 0.0, 176 maybeF32: Float32? = nil, 177 defaultF32: Float32 = 42.0, 178 justF64: Double = 0.0, 179 maybeF64: Double? = nil, 180 defaultF64: Double = 42.0, 181 justBool: Bool = false, 182 maybeBool: Bool? = nil, 183 defaultBool: Bool = true, 184 justEnum: optional_scalars_OptionalByte = .none_, 185 maybeEnum: optional_scalars_OptionalByte? = nil, 186 defaultEnum: optional_scalars_OptionalByte = .one 187 ) -> Offset { 188 let __start = optional_scalars_ScalarStuff.startScalarStuff(&fbb) 189 optional_scalars_ScalarStuff.add(justI8: justI8, &fbb) 190 optional_scalars_ScalarStuff.add(maybeI8: maybeI8, &fbb) 191 optional_scalars_ScalarStuff.add(defaultI8: defaultI8, &fbb) 192 optional_scalars_ScalarStuff.add(justU8: justU8, &fbb) 193 optional_scalars_ScalarStuff.add(maybeU8: maybeU8, &fbb) 194 optional_scalars_ScalarStuff.add(defaultU8: defaultU8, &fbb) 195 optional_scalars_ScalarStuff.add(justI16: justI16, &fbb) 196 optional_scalars_ScalarStuff.add(maybeI16: maybeI16, &fbb) 197 optional_scalars_ScalarStuff.add(defaultI16: defaultI16, &fbb) 198 optional_scalars_ScalarStuff.add(justU16: justU16, &fbb) 199 optional_scalars_ScalarStuff.add(maybeU16: maybeU16, &fbb) 200 optional_scalars_ScalarStuff.add(defaultU16: defaultU16, &fbb) 201 optional_scalars_ScalarStuff.add(justI32: justI32, &fbb) 202 optional_scalars_ScalarStuff.add(maybeI32: maybeI32, &fbb) 203 optional_scalars_ScalarStuff.add(defaultI32: defaultI32, &fbb) 204 optional_scalars_ScalarStuff.add(justU32: justU32, &fbb) 205 optional_scalars_ScalarStuff.add(maybeU32: maybeU32, &fbb) 206 optional_scalars_ScalarStuff.add(defaultU32: defaultU32, &fbb) 207 optional_scalars_ScalarStuff.add(justI64: justI64, &fbb) 208 optional_scalars_ScalarStuff.add(maybeI64: maybeI64, &fbb) 209 optional_scalars_ScalarStuff.add(defaultI64: defaultI64, &fbb) 210 optional_scalars_ScalarStuff.add(justU64: justU64, &fbb) 211 optional_scalars_ScalarStuff.add(maybeU64: maybeU64, &fbb) 212 optional_scalars_ScalarStuff.add(defaultU64: defaultU64, &fbb) 213 optional_scalars_ScalarStuff.add(justF32: justF32, &fbb) 214 optional_scalars_ScalarStuff.add(maybeF32: maybeF32, &fbb) 215 optional_scalars_ScalarStuff.add(defaultF32: defaultF32, &fbb) 216 optional_scalars_ScalarStuff.add(justF64: justF64, &fbb) 217 optional_scalars_ScalarStuff.add(maybeF64: maybeF64, &fbb) 218 optional_scalars_ScalarStuff.add(defaultF64: defaultF64, &fbb) 219 optional_scalars_ScalarStuff.add(justBool: justBool, &fbb) 220 optional_scalars_ScalarStuff.add(maybeBool: maybeBool, &fbb) 221 optional_scalars_ScalarStuff.add(defaultBool: defaultBool, &fbb) 222 optional_scalars_ScalarStuff.add(justEnum: justEnum, &fbb) 223 optional_scalars_ScalarStuff.add(maybeEnum: maybeEnum, &fbb) 224 optional_scalars_ScalarStuff.add(defaultEnum: defaultEnum, &fbb) 225 return optional_scalars_ScalarStuff.endScalarStuff(&fbb, start: __start) 226 } 227 } 228 229