1*890232f2SAndroid Build Coastguard Worker // automatically generated by the FlatBuffers compiler, do not modify 2*890232f2SAndroid Build Coastguard Worker 3*890232f2SAndroid Build Coastguard Worker package MyGame.Example 4*890232f2SAndroid Build Coastguard Worker 5*890232f2SAndroid Build Coastguard Worker import java.nio.* 6*890232f2SAndroid Build Coastguard Worker import kotlin.math.sign 7*890232f2SAndroid Build Coastguard Worker import com.google.flatbuffers.* 8*890232f2SAndroid Build Coastguard Worker 9*890232f2SAndroid Build Coastguard Worker @Suppress("unused") 10*890232f2SAndroid Build Coastguard Worker class TestSimpleTableWithEnum : Table() { 11*890232f2SAndroid Build Coastguard Worker __initnull12*890232f2SAndroid Build Coastguard Worker fun __init(_i: Int, _bb: ByteBuffer) { 13*890232f2SAndroid Build Coastguard Worker __reset(_i, _bb) 14*890232f2SAndroid Build Coastguard Worker } __assignnull15*890232f2SAndroid Build Coastguard Worker fun __assign(_i: Int, _bb: ByteBuffer) : TestSimpleTableWithEnum { 16*890232f2SAndroid Build Coastguard Worker __init(_i, _bb) 17*890232f2SAndroid Build Coastguard Worker return this 18*890232f2SAndroid Build Coastguard Worker } 19*890232f2SAndroid Build Coastguard Worker val color : UByte 20*890232f2SAndroid Build Coastguard Worker get() { 21*890232f2SAndroid Build Coastguard Worker val o = __offset(4) 22*890232f2SAndroid Build Coastguard Worker return if(o != 0) bb.get(o + bb_pos).toUByte() else 2u 23*890232f2SAndroid Build Coastguard Worker } mutateColornull24*890232f2SAndroid Build Coastguard Worker fun mutateColor(color: UByte) : Boolean { 25*890232f2SAndroid Build Coastguard Worker val o = __offset(4) 26*890232f2SAndroid Build Coastguard Worker return if (o != 0) { 27*890232f2SAndroid Build Coastguard Worker bb.put(o + bb_pos, color.toByte()) 28*890232f2SAndroid Build Coastguard Worker true 29*890232f2SAndroid Build Coastguard Worker } else { 30*890232f2SAndroid Build Coastguard Worker false 31*890232f2SAndroid Build Coastguard Worker } 32*890232f2SAndroid Build Coastguard Worker } 33*890232f2SAndroid Build Coastguard Worker companion object { validateVersionnull34*890232f2SAndroid Build Coastguard Worker fun validateVersion() = Constants.FLATBUFFERS_2_0_0() 35*890232f2SAndroid Build Coastguard Worker fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum()) 36*890232f2SAndroid Build Coastguard Worker fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum { 37*890232f2SAndroid Build Coastguard Worker _bb.order(ByteOrder.LITTLE_ENDIAN) 38*890232f2SAndroid Build Coastguard Worker return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 39*890232f2SAndroid Build Coastguard Worker } createTestSimpleTableWithEnumnull40*890232f2SAndroid Build Coastguard Worker fun createTestSimpleTableWithEnum(builder: FlatBufferBuilder, color: UByte) : Int { 41*890232f2SAndroid Build Coastguard Worker builder.startTable(1) 42*890232f2SAndroid Build Coastguard Worker addColor(builder, color) 43*890232f2SAndroid Build Coastguard Worker return endTestSimpleTableWithEnum(builder) 44*890232f2SAndroid Build Coastguard Worker } startTestSimpleTableWithEnumnull45*890232f2SAndroid Build Coastguard Worker fun startTestSimpleTableWithEnum(builder: FlatBufferBuilder) = builder.startTable(1) 46*890232f2SAndroid Build Coastguard Worker fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(0, color.toByte(), 2) 47*890232f2SAndroid Build Coastguard Worker fun endTestSimpleTableWithEnum(builder: FlatBufferBuilder) : Int { 48*890232f2SAndroid Build Coastguard Worker val o = builder.endTable() 49*890232f2SAndroid Build Coastguard Worker return o 50*890232f2SAndroid Build Coastguard Worker } 51*890232f2SAndroid Build Coastguard Worker } 52*890232f2SAndroid Build Coastguard Worker } 53