...

Text file src/github.com/google/flatbuffers/tests/namespace_test/NamespaceA/TableInFirstNS.kt

Documentation: github.com/google/flatbuffers/tests/namespace_test/NamespaceA

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

View as plain text