# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

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

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = QueryScreenResult()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsQueryScreenResult(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # QueryScreenResult
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # QueryScreenResult
    def Width(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # QueryScreenResult
    def Height(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

def QueryScreenResultStart(builder): builder.StartObject(2)
def Start(builder):
    return QueryScreenResultStart(builder)
def QueryScreenResultAddWidth(builder, width): builder.PrependInt32Slot(0, width, 0)
def AddWidth(builder, width):
    return QueryScreenResultAddWidth(builder, width)
def QueryScreenResultAddHeight(builder, height): builder.PrependInt32Slot(1, height, 0)
def AddHeight(builder, height):
    return QueryScreenResultAddHeight(builder, height)
def QueryScreenResultEnd(builder): return builder.EndObject()
def End(builder):
    return QueryScreenResultEnd(builder)

class QueryScreenResultT(object):

    # QueryScreenResultT
    def __init__(self):
        self.width = 0  # type: int
        self.height = 0  # type: int

    @classmethod
    def InitFromBuf(cls, buf, pos):
        queryScreenResult = QueryScreenResult()
        queryScreenResult.Init(buf, pos)
        return cls.InitFromObj(queryScreenResult)

    @classmethod
    def InitFromPackedBuf(cls, buf, pos=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
        return cls.InitFromBuf(buf, pos+n)

    @classmethod
    def InitFromObj(cls, queryScreenResult):
        x = QueryScreenResultT()
        x._UnPack(queryScreenResult)
        return x

    # QueryScreenResultT
    def _UnPack(self, queryScreenResult):
        if queryScreenResult is None:
            return
        self.width = queryScreenResult.Width()
        self.height = queryScreenResult.Height()

    # QueryScreenResultT
    def Pack(self, builder):
        QueryScreenResultStart(builder)
        QueryScreenResultAddWidth(builder, self.width)
        QueryScreenResultAddHeight(builder, self.height)
        queryScreenResult = QueryScreenResultEnd(builder)
        return queryScreenResult
