blob: 68c6abfde0a87f0261573f880d9cd0762a10e596 [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")
10@ExperimentalUnsignedTypes
11class TestSimpleTableWithEnum : Table() {
12
13 fun __init(_i: Int, _bb: ByteBuffer) {
14 __reset(_i, _bb)
15 }
16 fun __assign(_i: Int, _bb: ByteBuffer) : TestSimpleTableWithEnum {
17 __init(_i, _bb)
18 return this
19 }
20 val color : UByte
21 get() {
22 val o = __offset(4)
23 return if(o != 0) bb.get(o + bb_pos).toUByte() else 2u
24 }
25 fun mutateColor(color: UByte) : Boolean {
26 val o = __offset(4)
27 return if (o != 0) {
28 bb.put(o + bb_pos, color.toByte())
29 true
30 } else {
31 false
32 }
33 }
34 companion object {
35 fun validateVersion() = Constants.FLATBUFFERS_1_11_1()
36 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum())
37 fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum {
38 _bb.order(ByteOrder.LITTLE_ENDIAN)
39 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
40 }
41 fun createTestSimpleTableWithEnum(builder: FlatBufferBuilder, color: UByte) : Int {
42 builder.startTable(1)
43 addColor(builder, color)
44 return endTestSimpleTableWithEnum(builder)
45 }
46 fun startTestSimpleTableWithEnum(builder: FlatBufferBuilder) = builder.startTable(1)
47 fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(0, color.toByte(), 2)
48 fun endTestSimpleTableWithEnum(builder: FlatBufferBuilder) : Int {
49 val o = builder.endTable()
50 return o
51 }
52 }
53}