mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 12:21:23 +00:00
Add support for fixed-size arrays (#5313)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
0d2cebccfe
commit
e635141d5b
29
tests/MyGame/Example/NestedStruct.py
Normal file
29
tests/MyGame/Example/NestedStruct.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
|
||||
class NestedStruct(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
# NestedStruct
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# NestedStruct
|
||||
def A(self): return [self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0 + i * 4)) for i in range(2)]
|
||||
# NestedStruct
|
||||
def B(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(8))
|
||||
# NestedStruct
|
||||
def C(self): return [self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(9 + i * 1)) for i in range(2)]
|
||||
|
||||
def CreateNestedStruct(builder, a, b, c):
|
||||
builder.Prep(4, 12)
|
||||
builder.Pad(1)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt8(c[_idx0-1])
|
||||
builder.PrependInt8(b)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt32(a[_idx0-1])
|
||||
return builder.Offset()
|
||||
Reference in New Issue
Block a user