1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package MyGame.Example 4 5 import com.google.flatbuffers.BaseVector 6 import com.google.flatbuffers.BooleanVector 7 import com.google.flatbuffers.ByteVector 8 import com.google.flatbuffers.Constants 9 import com.google.flatbuffers.DoubleVector 10 import com.google.flatbuffers.FlatBufferBuilder 11 import com.google.flatbuffers.FloatVector 12 import com.google.flatbuffers.LongVector 13 import com.google.flatbuffers.StringVector 14 import com.google.flatbuffers.Struct 15 import com.google.flatbuffers.Table 16 import com.google.flatbuffers.UnionVector 17 import java.nio.ByteBuffer 18 import java.nio.ByteOrder 19 import kotlin.math.sign 20 21 @Suppress("unused") 22 class TestSimpleTableWithEnum : Table() { 23 __initnull24 fun __init(_i: Int, _bb: ByteBuffer) { 25 __reset(_i, _bb) 26 } __assignnull27 fun __assign(_i: Int, _bb: ByteBuffer) : TestSimpleTableWithEnum { 28 __init(_i, _bb) 29 return this 30 } 31 val color : UByte 32 get() { 33 val o = __offset(4) 34 return if(o != 0) bb.get(o + bb_pos).toUByte() else 2u 35 } mutateColornull36 fun mutateColor(color: UByte) : Boolean { 37 val o = __offset(4) 38 return if (o != 0) { 39 bb.put(o + bb_pos, color.toByte()) 40 true 41 } else { 42 false 43 } 44 } 45 companion object { validateVersionnull46 fun validateVersion() = Constants.FLATBUFFERS_25_1_24() 47 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum()) 48 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum { 49 _bb.order(ByteOrder.LITTLE_ENDIAN) 50 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 51 } createTestSimpleTableWithEnumnull52 fun createTestSimpleTableWithEnum(builder: FlatBufferBuilder, color: UByte) : Int { 53 builder.startTable(1) 54 addColor(builder, color) 55 return endTestSimpleTableWithEnum(builder) 56 } startTestSimpleTableWithEnumnull57 fun startTestSimpleTableWithEnum(builder: FlatBufferBuilder) = builder.startTable(1) 58 fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(0, color.toByte(), 2) 59 fun endTestSimpleTableWithEnum(builder: FlatBufferBuilder) : Int { 60 val o = builder.endTable() 61 return o 62 } 63 } 64 } 65