# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FBOutput

import tdw.flatbuffers

class Keyboard(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsKeyboard(cls, buf, offset):
        n = tdw.flatbuffers.encode.Get(tdw.flatbuffers.packer.uoffset, buf, offset)
        x = Keyboard()
        x.Init(buf, n + offset)
        return x

    # Keyboard
    def Init(self, buf, pos):
        self._tab = tdw.flatbuffers.table.Table(buf, pos)

    # Keyboard
    def Pressed(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Keyboard
    def PressedLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Keyboard
    def Held(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Keyboard
    def HeldLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Keyboard
    def Released(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Keyboard
    def ReleasedLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def KeyboardStart(builder): builder.StartObject(3)
def KeyboardAddPressed(builder, pressed): builder.PrependUOffsetTRelativeSlot(0, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(pressed), 0)
def KeyboardStartPressedVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def KeyboardAddHeld(builder, held): builder.PrependUOffsetTRelativeSlot(1, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(held), 0)
def KeyboardStartHeldVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def KeyboardAddReleased(builder, released): builder.PrependUOffsetTRelativeSlot(2, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(released), 0)
def KeyboardStartReleasedVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def KeyboardEnd(builder): return builder.EndObject()
