"Fossies" - the Fresh Open Source Software Archive

Member "flatbuffers-23.1.21/android/app/src/main/java/generated/com/fbs/app/Animal.kt" (21 Jan 2023, 3092 Bytes) of package /linux/misc/flatbuffers-23.1.21.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Kotlin source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Animal.kt": 23.1.20_vs_23.1.21.

    1 // automatically generated by the FlatBuffers compiler, do not modify
    2 
    3 package com.fbs.app
    4 
    5 import com.google.flatbuffers.BaseVector
    6 import com.google.flatbuffers.BooleanVector
    7 import com.google.flatbuffers.ByteVector
    8 import com.google.flatbuffers.Constants
    9 import com.google.flatbuffers.DoubleVector
   10 import com.google.flatbuffers.FlatBufferBuilder
   11 import com.google.flatbuffers.FloatVector
   12 import com.google.flatbuffers.LongVector
   13 import com.google.flatbuffers.StringVector
   14 import com.google.flatbuffers.Struct
   15 import com.google.flatbuffers.Table
   16 import com.google.flatbuffers.UnionVector
   17 import java.nio.ByteBuffer
   18 import java.nio.ByteOrder
   19 import kotlin.math.sign
   20 
   21 @Suppress("unused")
   22 class Animal : Table() {
   23 
   24     fun __init(_i: Int, _bb: ByteBuffer)  {
   25         __reset(_i, _bb)
   26     }
   27     fun __assign(_i: Int, _bb: ByteBuffer) : Animal {
   28         __init(_i, _bb)
   29         return this
   30     }
   31     val name : String?
   32         get() {
   33             val o = __offset(4)
   34             return if (o != 0) __string(o + bb_pos) else null
   35         }
   36     val nameAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(4, 1)
   37     fun nameInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 4, 1)
   38     val sound : String?
   39         get() {
   40             val o = __offset(6)
   41             return if (o != 0) __string(o + bb_pos) else null
   42         }
   43     val soundAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(6, 1)
   44     fun soundInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 6, 1)
   45     val weight : UShort
   46         get() {
   47             val o = __offset(8)
   48             return if(o != 0) bb.getShort(o + bb_pos).toUShort() else 0u
   49         }
   50     companion object {
   51         fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
   52         fun getRootAsAnimal(_bb: ByteBuffer): Animal = getRootAsAnimal(_bb, Animal())
   53         fun getRootAsAnimal(_bb: ByteBuffer, obj: Animal): Animal {
   54             _bb.order(ByteOrder.LITTLE_ENDIAN)
   55             return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
   56         }
   57         fun createAnimal(builder: FlatBufferBuilder, nameOffset: Int, soundOffset: Int, weight: UShort) : Int {
   58             builder.startTable(3)
   59             addSound(builder, soundOffset)
   60             addName(builder, nameOffset)
   61             addWeight(builder, weight)
   62             return endAnimal(builder)
   63         }
   64         fun startAnimal(builder: FlatBufferBuilder) = builder.startTable(3)
   65         fun addName(builder: FlatBufferBuilder, name: Int) = builder.addOffset(0, name, 0)
   66         fun addSound(builder: FlatBufferBuilder, sound: Int) = builder.addOffset(1, sound, 0)
   67         fun addWeight(builder: FlatBufferBuilder, weight: UShort) = builder.addShort(2, weight.toShort(), 0)
   68         fun endAnimal(builder: FlatBufferBuilder) : Int {
   69             val o = builder.endTable()
   70             return o
   71         }
   72         fun finishAnimalBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset)
   73         fun finishSizePrefixedAnimalBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset)
   74     }
   75 }