blob: 64bf7e239f58a1543afc342d01be90b5c605e101 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2
3package MyGame.Example
4
5import java.nio.*
6import kotlin.math.sign
7import com.google.flatbuffers.*
8
9@Suppress("unused")
Austin Schuhe89fa2d2019-08-14 20:24:23 -070010class TestSimpleTableWithEnum : Table() {
11
12 fun __init(_i: Int, _bb: ByteBuffer) {
13 __reset(_i, _bb)
14 }
15 fun __assign(_i: Int, _bb: ByteBuffer) : TestSimpleTableWithEnum {
16 __init(_i, _bb)
17 return this
18 }
19 val color : UByte
20 get() {
21 val o = __offset(4)
22 return if(o != 0) bb.get(o + bb_pos).toUByte() else 2u
23 }
24 fun mutateColor(color: UByte) : Boolean {
25 val o = __offset(4)
26 return if (o != 0) {
27 bb.put(o + bb_pos, color.toByte())
28 true
29 } else {
30 false
31 }
32 }
33 companion object {
James Kuszmaul8e62b022022-03-22 09:33:25 -070034 fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
Austin Schuhe89fa2d2019-08-14 20:24:23 -070035 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum())
36 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum {
37 _bb.order(ByteOrder.LITTLE_ENDIAN)
38 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
39 }
40 fun createTestSimpleTableWithEnum(builder: FlatBufferBuilder, color: UByte) : Int {
41 builder.startTable(1)
42 addColor(builder, color)
43 return endTestSimpleTableWithEnum(builder)
44 }
45 fun startTestSimpleTableWithEnum(builder: FlatBufferBuilder) = builder.startTable(1)
46 fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(0, color.toByte(), 2)
47 fun endTestSimpleTableWithEnum(builder: FlatBufferBuilder) : Int {
48 val o = builder.endTable()
49 return o
50 }
51 }
52}