• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // automatically generated by the FlatBuffers compiler, do not modify
2 
3 package MyGame.Example
4 
5 import java.nio.*
6 import kotlin.math.sign
7 import com.google.flatbuffers.*
8 
9 @Suppress("unused")
10 @ExperimentalUnsignedTypes
11 class TestSimpleTableWithEnum : Table() {
12 
__initnull13     fun __init(_i: Int, _bb: ByteBuffer)  {
14         __reset(_i, _bb)
15     }
__assignnull16     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         }
mutateColornull25     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 {
validateVersionnull35         fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
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         }
createTestSimpleTableWithEnumnull41         fun createTestSimpleTableWithEnum(builder: FlatBufferBuilder, color: UByte) : Int {
42             builder.startTable(1)
43             addColor(builder, color)
44             return endTestSimpleTableWithEnum(builder)
45         }
startTestSimpleTableWithEnumnull46         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 }
54