Swift/Kotlin generated code version updates
[platform/upstream/flatbuffers.git] / tests / namespace_test / NamespaceA / TableInFirstNS.kt
1 // automatically generated by the FlatBuffers compiler, do not modify
2
3 package NamespaceA
4
5 import java.nio.*
6 import kotlin.math.sign
7 import com.google.flatbuffers.*
8
9 @Suppress("unused")
10 @ExperimentalUnsignedTypes
11 class TableInFirstNS : Table() {
12
13     fun __init(_i: Int, _bb: ByteBuffer)  {
14         __reset(_i, _bb)
15     }
16     fun __assign(_i: Int, _bb: ByteBuffer) : TableInFirstNS {
17         __init(_i, _bb)
18         return this
19     }
20     val fooTable : NamespaceA.NamespaceB.TableInNestedNS? get() = fooTable(NamespaceA.NamespaceB.TableInNestedNS())
21     fun fooTable(obj: NamespaceA.NamespaceB.TableInNestedNS) : NamespaceA.NamespaceB.TableInNestedNS? {
22         val o = __offset(4)
23         return if (o != 0) {
24             obj.__assign(__indirect(o + bb_pos), bb)
25         } else {
26             null
27         }
28     }
29     val fooEnum : Byte
30         get() {
31             val o = __offset(6)
32             return if(o != 0) bb.get(o + bb_pos) else 0
33         }
34     fun mutateFooEnum(fooEnum: Byte) : Boolean {
35         val o = __offset(6)
36         return if (o != 0) {
37             bb.put(o + bb_pos, fooEnum)
38             true
39         } else {
40             false
41         }
42     }
43     val fooUnionType : UByte
44         get() {
45             val o = __offset(8)
46             return if(o != 0) bb.get(o + bb_pos).toUByte() else 0u
47         }
48     fun mutateFooUnionType(fooUnionType: UByte) : Boolean {
49         val o = __offset(8)
50         return if (o != 0) {
51             bb.put(o + bb_pos, fooUnionType.toByte())
52             true
53         } else {
54             false
55         }
56     }
57     fun fooUnion(obj: Table) : Table? {
58         val o = __offset(10); return if (o != 0) __union(obj, o + bb_pos) else null
59     }
60     val fooStruct : NamespaceA.NamespaceB.StructInNestedNS? get() = fooStruct(NamespaceA.NamespaceB.StructInNestedNS())
61     fun fooStruct(obj: NamespaceA.NamespaceB.StructInNestedNS) : NamespaceA.NamespaceB.StructInNestedNS? {
62         val o = __offset(12)
63         return if (o != 0) {
64             obj.__assign(o + bb_pos, bb)
65         } else {
66             null
67         }
68     }
69     companion object {
70         fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
71         fun getRootAsTableInFirstNS(_bb: ByteBuffer): TableInFirstNS = getRootAsTableInFirstNS(_bb, TableInFirstNS())
72         fun getRootAsTableInFirstNS(_bb: ByteBuffer, obj: TableInFirstNS): TableInFirstNS {
73             _bb.order(ByteOrder.LITTLE_ENDIAN)
74             return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
75         }
76         fun startTableInFirstNS(builder: FlatBufferBuilder) = builder.startTable(5)
77         fun addFooTable(builder: FlatBufferBuilder, fooTable: Int) = builder.addOffset(0, fooTable, 0)
78         fun addFooEnum(builder: FlatBufferBuilder, fooEnum: Byte) = builder.addByte(1, fooEnum, 0)
79         fun addFooUnionType(builder: FlatBufferBuilder, fooUnionType: UByte) = builder.addByte(2, fooUnionType.toByte(), 0)
80         fun addFooUnion(builder: FlatBufferBuilder, fooUnion: Int) = builder.addOffset(3, fooUnion, 0)
81         fun addFooStruct(builder: FlatBufferBuilder, fooStruct: Int) = builder.addStruct(4, fooStruct, 0)
82         fun endTableInFirstNS(builder: FlatBufferBuilder) : Int {
83             val o = builder.endTable()
84             return o
85         }
86     }
87 }