mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-12 07:50:59 +00:00
bulk code format fix (#8707)
This commit is contained in:
@@ -4,13 +4,17 @@ package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class EnumInNestedNS {
|
||||
private EnumInNestedNS() { }
|
||||
private EnumInNestedNS() {}
|
||||
|
||||
public static final byte A = 0;
|
||||
public static final byte B = 1;
|
||||
public static final byte C = 2;
|
||||
|
||||
public static final String[] names = { "A", "B", "C", };
|
||||
public static final String[] names = {
|
||||
"A", "B", "C",
|
||||
};
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
public static String name(int e) {
|
||||
return names[e];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ package NamespaceA.NamespaceB
|
||||
@Suppress("unused")
|
||||
@ExperimentalUnsignedTypes
|
||||
class EnumInNestedNS private constructor() {
|
||||
companion object {
|
||||
const val A: Byte = 0
|
||||
const val B: Byte = 1
|
||||
const val C: Byte = 2
|
||||
val names : Array<String> = arrayOf("A", "B", "C")
|
||||
fun name(e: Int) : String = names[e]
|
||||
}
|
||||
companion object {
|
||||
const val A: Byte = 0
|
||||
const val B: Byte = 1
|
||||
const val C: Byte = 2
|
||||
val names: Array<String> = arrayOf("A", "B", "C")
|
||||
|
||||
fun name(e: Int): String = names[e]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
|
||||
class EnumInNestedNS(object):
|
||||
A = 0
|
||||
B = 1
|
||||
C = 2
|
||||
A = 0
|
||||
B = 1
|
||||
C = 2
|
||||
|
||||
@@ -12,7 +12,9 @@ type StructInNestedNST struct {
|
||||
}
|
||||
|
||||
func (t *StructInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
return CreateStructInNestedNS(builder, t.A, t.B)
|
||||
}
|
||||
func (rcv *StructInNestedNS) UnPackTo(t *StructInNestedNST) {
|
||||
@@ -21,7 +23,9 @@ func (rcv *StructInNestedNS) UnPackTo(t *StructInNestedNST) {
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) UnPack() *StructInNestedNST {
|
||||
if rcv == nil { return nil }
|
||||
if rcv == nil {
|
||||
return nil
|
||||
}
|
||||
t := &StructInNestedNST{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
|
||||
@@ -2,20 +2,36 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class StructInNestedNS extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public StructInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
public void __init(int _i, ByteBuffer _bb) {
|
||||
__reset(_i, _bb);
|
||||
}
|
||||
|
||||
public int a() { return bb.getInt(bb_pos + 0); }
|
||||
public void mutateA(int a) { bb.putInt(bb_pos + 0, a); }
|
||||
public int b() { return bb.getInt(bb_pos + 4); }
|
||||
public void mutateB(int b) { bb.putInt(bb_pos + 4, b); }
|
||||
public StructInNestedNS __assign(int _i, ByteBuffer _bb) {
|
||||
__init(_i, _bb);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return bb.getInt(bb_pos + 0);
|
||||
}
|
||||
|
||||
public void mutateA(int a) {
|
||||
bb.putInt(bb_pos + 0, a);
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return bb.getInt(bb_pos + 4);
|
||||
}
|
||||
|
||||
public void mutateB(int b) {
|
||||
bb.putInt(bb_pos + 4, b);
|
||||
}
|
||||
|
||||
public static int createStructInNestedNS(FlatBufferBuilder builder, int a, int b) {
|
||||
builder.prep(4, 8);
|
||||
@@ -25,28 +41,35 @@ public final class StructInNestedNS extends Struct {
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) {
|
||||
__reset(_vector, _element_size, _bb);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StructInNestedNS get(int j) { return get(new StructInNestedNS(), j); }
|
||||
public StructInNestedNS get(StructInNestedNS obj, int j) { return obj.__assign(__element(j), bb); }
|
||||
public StructInNestedNS get(int j) {
|
||||
return get(new StructInNestedNS(), j);
|
||||
}
|
||||
|
||||
public StructInNestedNS get(StructInNestedNS obj, int j) {
|
||||
return obj.__assign(__element(j), bb);
|
||||
}
|
||||
}
|
||||
|
||||
public StructInNestedNST unpack() {
|
||||
StructInNestedNST _o = new StructInNestedNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
|
||||
public void unpackTo(StructInNestedNST _o) {
|
||||
int _oA = a();
|
||||
_o.setA(_oA);
|
||||
int _oB = b();
|
||||
_o.setB(_oB);
|
||||
}
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, StructInNestedNST _o) {
|
||||
if (_o == null) return 0;
|
||||
return createStructInNestedNS(
|
||||
builder,
|
||||
_o.getA(),
|
||||
_o.getB());
|
||||
return createStructInNestedNS(builder, _o.getA(), _o.getB());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,43 +2,39 @@
|
||||
|
||||
package NamespaceA.NamespaceB
|
||||
|
||||
import com.google.flatbuffers.BaseVector
|
||||
import com.google.flatbuffers.BooleanVector
|
||||
import com.google.flatbuffers.ByteVector
|
||||
import com.google.flatbuffers.Constants
|
||||
import com.google.flatbuffers.DoubleVector
|
||||
import com.google.flatbuffers.FlatBufferBuilder
|
||||
import com.google.flatbuffers.FloatVector
|
||||
import com.google.flatbuffers.LongVector
|
||||
import com.google.flatbuffers.StringVector
|
||||
import com.google.flatbuffers.Struct
|
||||
import com.google.flatbuffers.Table
|
||||
import com.google.flatbuffers.UnionVector
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import kotlin.math.sign
|
||||
|
||||
@Suppress("unused")
|
||||
@ExperimentalUnsignedTypes
|
||||
class StructInNestedNS : Struct() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : StructInNestedNS {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val a : Int get() = bb.getInt(bb_pos + 0)
|
||||
fun mutateA(a: Int) : ByteBuffer = bb.putInt(bb_pos + 0, a)
|
||||
val b : Int get() = bb.getInt(bb_pos + 4)
|
||||
fun mutateB(b: Int) : ByteBuffer = bb.putInt(bb_pos + 4, b)
|
||||
companion object {
|
||||
fun createStructInNestedNS(builder: FlatBufferBuilder, a: Int, b: Int) : Int {
|
||||
builder.prep(4, 8)
|
||||
builder.putInt(b)
|
||||
builder.putInt(a)
|
||||
return builder.offset()
|
||||
}
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
|
||||
fun __assign(_i: Int, _bb: ByteBuffer): StructInNestedNS {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
|
||||
val a: Int
|
||||
get() = bb.getInt(bb_pos + 0)
|
||||
|
||||
fun mutateA(a: Int): ByteBuffer = bb.putInt(bb_pos + 0, a)
|
||||
|
||||
val b: Int
|
||||
get() = bb.getInt(bb_pos + 4)
|
||||
|
||||
fun mutateB(b: Int): ByteBuffer = bb.putInt(bb_pos + 4, b)
|
||||
|
||||
companion object {
|
||||
fun createStructInNestedNS(builder: FlatBufferBuilder, a: Int, b: Int): Int {
|
||||
builder.prep(4, 8)
|
||||
builder.putInt(b)
|
||||
builder.putInt(a)
|
||||
return builder.offset()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,57 +4,69 @@
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
|
||||
np = import_numpy()
|
||||
|
||||
|
||||
class StructInNestedNS(object):
|
||||
__slots__ = ['_tab']
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls):
|
||||
return 8
|
||||
@classmethod
|
||||
def SizeOf(cls):
|
||||
return 8
|
||||
|
||||
# StructInNestedNS
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
# StructInNestedNS
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# StructInNestedNS
|
||||
def A(self):
|
||||
return self._tab.Get(
|
||||
flatbuffers.number_types.Int32Flags,
|
||||
self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0),
|
||||
)
|
||||
|
||||
# StructInNestedNS
|
||||
def B(self):
|
||||
return self._tab.Get(
|
||||
flatbuffers.number_types.Int32Flags,
|
||||
self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4),
|
||||
)
|
||||
|
||||
# StructInNestedNS
|
||||
def A(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
|
||||
# StructInNestedNS
|
||||
def B(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
|
||||
|
||||
def CreateStructInNestedNS(builder, a, b):
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependInt32(b)
|
||||
builder.PrependInt32(a)
|
||||
return builder.Offset()
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependInt32(b)
|
||||
builder.PrependInt32(a)
|
||||
return builder.Offset()
|
||||
|
||||
|
||||
class StructInNestedNST(object):
|
||||
|
||||
# StructInNestedNST
|
||||
def __init__(self):
|
||||
self.a = 0 # type: int
|
||||
self.b = 0 # type: int
|
||||
# StructInNestedNST
|
||||
def __init__(self):
|
||||
self.a = 0 # type: int
|
||||
self.b = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
structInNestedNS = StructInNestedNS()
|
||||
structInNestedNS.Init(buf, pos)
|
||||
return cls.InitFromObj(structInNestedNS)
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
structInNestedNS = StructInNestedNS()
|
||||
structInNestedNS.Init(buf, pos)
|
||||
return cls.InitFromObj(structInNestedNS)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, structInNestedNS):
|
||||
x = StructInNestedNST()
|
||||
x._UnPack(structInNestedNS)
|
||||
return x
|
||||
@classmethod
|
||||
def InitFromObj(cls, structInNestedNS):
|
||||
x = StructInNestedNST()
|
||||
x._UnPack(structInNestedNS)
|
||||
return x
|
||||
|
||||
# StructInNestedNST
|
||||
def _UnPack(self, structInNestedNS):
|
||||
if structInNestedNS is None:
|
||||
return
|
||||
self.a = structInNestedNS.A()
|
||||
self.b = structInNestedNS.B()
|
||||
# StructInNestedNST
|
||||
def _UnPack(self, structInNestedNS):
|
||||
if structInNestedNS is None:
|
||||
return
|
||||
self.a = structInNestedNS.A()
|
||||
self.b = structInNestedNS.B()
|
||||
|
||||
# StructInNestedNST
|
||||
def Pack(self, builder):
|
||||
return CreateStructInNestedNS(builder, self.a, self.b)
|
||||
# StructInNestedNST
|
||||
def Pack(self, builder):
|
||||
return CreateStructInNestedNS(builder, self.a, self.b)
|
||||
|
||||
@@ -2,27 +2,32 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
public class StructInNestedNST {
|
||||
private int a;
|
||||
private int b;
|
||||
|
||||
public int getA() { return a; }
|
||||
public int getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public void setA(int a) { this.a = a; }
|
||||
public void setA(int a) {
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
public int getB() { return b; }
|
||||
|
||||
public void setB(int b) { this.b = b; }
|
||||
public int getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public void setB(int b) {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public StructInNestedNST() {
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ type TableInNestedNST struct {
|
||||
}
|
||||
|
||||
func (t *TableInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
TableInNestedNSStart(builder)
|
||||
TableInNestedNSAddFoo(builder, t.Foo)
|
||||
return TableInNestedNSEnd(builder)
|
||||
@@ -22,7 +24,9 @@ func (rcv *TableInNestedNS) UnPackTo(t *TableInNestedNST) {
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) UnPack() *TableInNestedNST {
|
||||
if rcv == nil { return nil }
|
||||
if rcv == nil {
|
||||
return nil
|
||||
}
|
||||
t := &TableInNestedNST{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
|
||||
@@ -2,56 +2,96 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class TableInNestedNS extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
public static void ValidateVersion() {
|
||||
Constants.FLATBUFFERS_25_2_10();
|
||||
}
|
||||
|
||||
public int foo() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public boolean mutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.putInt(o + bb_pos, foo); return true; } else { return false; } }
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) {
|
||||
return getRootAsTableInNestedNS(_bb, new TableInNestedNS());
|
||||
}
|
||||
|
||||
public static int createTableInNestedNS(FlatBufferBuilder builder,
|
||||
int foo) {
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb));
|
||||
}
|
||||
|
||||
public void __init(int _i, ByteBuffer _bb) {
|
||||
__reset(_i, _bb);
|
||||
}
|
||||
|
||||
public TableInNestedNS __assign(int _i, ByteBuffer _bb) {
|
||||
__init(_i, _bb);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int foo() {
|
||||
int o = __offset(4);
|
||||
return o != 0 ? bb.getInt(o + bb_pos) : 0;
|
||||
}
|
||||
|
||||
public boolean mutateFoo(int foo) {
|
||||
int o = __offset(4);
|
||||
if (o != 0) {
|
||||
bb.putInt(o + bb_pos, foo);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static int createTableInNestedNS(FlatBufferBuilder builder, int foo) {
|
||||
builder.startTable(1);
|
||||
TableInNestedNS.addFoo(builder, foo);
|
||||
return TableInNestedNS.endTableInNestedNS(builder);
|
||||
}
|
||||
|
||||
public static void startTableInNestedNS(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addFoo(FlatBufferBuilder builder, int foo) { builder.addInt(0, foo, 0); }
|
||||
public static void startTableInNestedNS(FlatBufferBuilder builder) {
|
||||
builder.startTable(1);
|
||||
}
|
||||
|
||||
public static void addFoo(FlatBufferBuilder builder, int foo) {
|
||||
builder.addInt(0, foo, 0);
|
||||
}
|
||||
|
||||
public static int endTableInNestedNS(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) {
|
||||
__reset(_vector, _element_size, _bb);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TableInNestedNS get(int j) { return get(new TableInNestedNS(), j); }
|
||||
public TableInNestedNS get(TableInNestedNS obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
public TableInNestedNS get(int j) {
|
||||
return get(new TableInNestedNS(), j);
|
||||
}
|
||||
|
||||
public TableInNestedNS get(TableInNestedNS obj, int j) {
|
||||
return obj.__assign(__indirect(__element(j), bb), bb);
|
||||
}
|
||||
}
|
||||
|
||||
public TableInNestedNST unpack() {
|
||||
TableInNestedNST _o = new TableInNestedNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
|
||||
public void unpackTo(TableInNestedNST _o) {
|
||||
int _oFoo = foo();
|
||||
_o.setFoo(_oFoo);
|
||||
}
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, TableInNestedNST _o) {
|
||||
if (_o == null) return 0;
|
||||
return createTableInNestedNS(
|
||||
builder,
|
||||
_o.getFoo());
|
||||
return createTableInNestedNS(builder, _o.getFoo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,64 +2,65 @@
|
||||
|
||||
package NamespaceA.NamespaceB
|
||||
|
||||
import com.google.flatbuffers.BaseVector
|
||||
import com.google.flatbuffers.BooleanVector
|
||||
import com.google.flatbuffers.ByteVector
|
||||
import com.google.flatbuffers.Constants
|
||||
import com.google.flatbuffers.DoubleVector
|
||||
import com.google.flatbuffers.FlatBufferBuilder
|
||||
import com.google.flatbuffers.FloatVector
|
||||
import com.google.flatbuffers.LongVector
|
||||
import com.google.flatbuffers.StringVector
|
||||
import com.google.flatbuffers.Struct
|
||||
import com.google.flatbuffers.Table
|
||||
import com.google.flatbuffers.UnionVector
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import kotlin.math.sign
|
||||
|
||||
@Suppress("unused")
|
||||
@ExperimentalUnsignedTypes
|
||||
class TableInNestedNS : Table() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
|
||||
fun __assign(_i: Int, _bb: ByteBuffer): TableInNestedNS {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
get() {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) bb.getInt(o + bb_pos) else 0
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : TableInNestedNS {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
|
||||
fun mutateFoo(foo: Int): Boolean {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
bb.putInt(o + bb_pos, foo)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
val foo : Int
|
||||
get() {
|
||||
val o = __offset(4)
|
||||
return if(o != 0) bb.getInt(o + bb_pos) else 0
|
||||
}
|
||||
fun mutateFoo(foo: Int) : Boolean {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
bb.putInt(o + bb_pos, foo)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_25_2_10()
|
||||
|
||||
fun getRootAsTableInNestedNS(_bb: ByteBuffer): TableInNestedNS =
|
||||
getRootAsTableInNestedNS(_bb, TableInNestedNS())
|
||||
|
||||
fun getRootAsTableInNestedNS(_bb: ByteBuffer, obj: TableInNestedNS): TableInNestedNS {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_25_2_10()
|
||||
fun getRootAsTableInNestedNS(_bb: ByteBuffer): TableInNestedNS = getRootAsTableInNestedNS(_bb, TableInNestedNS())
|
||||
fun getRootAsTableInNestedNS(_bb: ByteBuffer, obj: TableInNestedNS): TableInNestedNS {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
fun createTableInNestedNS(builder: FlatBufferBuilder, foo: Int) : Int {
|
||||
builder.startTable(1)
|
||||
addFoo(builder, foo)
|
||||
return endTableInNestedNS(builder)
|
||||
}
|
||||
fun startTableInNestedNS(builder: FlatBufferBuilder) = builder.startTable(1)
|
||||
fun addFoo(builder: FlatBufferBuilder, foo: Int) = builder.addInt(0, foo, 0)
|
||||
fun endTableInNestedNS(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
|
||||
fun createTableInNestedNS(builder: FlatBufferBuilder, foo: Int): Int {
|
||||
builder.startTable(1)
|
||||
addFoo(builder, foo)
|
||||
return endTableInNestedNS(builder)
|
||||
}
|
||||
|
||||
fun startTableInNestedNS(builder: FlatBufferBuilder) = builder.startTable(1)
|
||||
|
||||
fun addFoo(builder: FlatBufferBuilder, foo: Int) = builder.addInt(0, foo, 0)
|
||||
|
||||
fun endTableInNestedNS(builder: FlatBufferBuilder): Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,70 +4,90 @@
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
|
||||
np = import_numpy()
|
||||
|
||||
|
||||
class TableInNestedNS(object):
|
||||
__slots__ = ['_tab']
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TableInNestedNS()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TableInNestedNS()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsTableInNestedNS(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# TableInNestedNS
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
@classmethod
|
||||
def GetRootAsTableInNestedNS(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
|
||||
# TableInNestedNS
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TableInNestedNS
|
||||
def Foo(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
|
||||
|
||||
|
||||
def TableInNestedNSStart(builder):
|
||||
builder.StartObject(1)
|
||||
|
||||
# TableInNestedNS
|
||||
def Foo(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
|
||||
|
||||
def TableInNestedNSStart(builder): builder.StartObject(1)
|
||||
def Start(builder):
|
||||
return TableInNestedNSStart(builder)
|
||||
def TableInNestedNSAddFoo(builder, foo): builder.PrependInt32Slot(0, foo, 0)
|
||||
return TableInNestedNSStart(builder)
|
||||
|
||||
|
||||
def TableInNestedNSAddFoo(builder, foo):
|
||||
builder.PrependInt32Slot(0, foo, 0)
|
||||
|
||||
|
||||
def AddFoo(builder, foo):
|
||||
return TableInNestedNSAddFoo(builder, foo)
|
||||
def TableInNestedNSEnd(builder): return builder.EndObject()
|
||||
return TableInNestedNSAddFoo(builder, foo)
|
||||
|
||||
|
||||
def TableInNestedNSEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
|
||||
def End(builder):
|
||||
return TableInNestedNSEnd(builder)
|
||||
return TableInNestedNSEnd(builder)
|
||||
|
||||
|
||||
class TableInNestedNST(object):
|
||||
|
||||
# TableInNestedNST
|
||||
def __init__(self):
|
||||
self.foo = 0 # type: int
|
||||
# TableInNestedNST
|
||||
def __init__(self):
|
||||
self.foo = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
tableInNestedNS = TableInNestedNS()
|
||||
tableInNestedNS.Init(buf, pos)
|
||||
return cls.InitFromObj(tableInNestedNS)
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
tableInNestedNS = TableInNestedNS()
|
||||
tableInNestedNS.Init(buf, pos)
|
||||
return cls.InitFromObj(tableInNestedNS)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, tableInNestedNS):
|
||||
x = TableInNestedNST()
|
||||
x._UnPack(tableInNestedNS)
|
||||
return x
|
||||
@classmethod
|
||||
def InitFromObj(cls, tableInNestedNS):
|
||||
x = TableInNestedNST()
|
||||
x._UnPack(tableInNestedNS)
|
||||
return x
|
||||
|
||||
# TableInNestedNST
|
||||
def _UnPack(self, tableInNestedNS):
|
||||
if tableInNestedNS is None:
|
||||
return
|
||||
self.foo = tableInNestedNS.Foo()
|
||||
# TableInNestedNST
|
||||
def _UnPack(self, tableInNestedNS):
|
||||
if tableInNestedNS is None:
|
||||
return
|
||||
self.foo = tableInNestedNS.Foo()
|
||||
|
||||
# TableInNestedNST
|
||||
def Pack(self, builder):
|
||||
TableInNestedNSStart(builder)
|
||||
TableInNestedNSAddFoo(builder, self.foo)
|
||||
tableInNestedNS = TableInNestedNSEnd(builder)
|
||||
return tableInNestedNS
|
||||
# TableInNestedNST
|
||||
def Pack(self, builder):
|
||||
TableInNestedNSStart(builder)
|
||||
TableInNestedNSAddFoo(builder, self.foo)
|
||||
tableInNestedNS = TableInNestedNSEnd(builder)
|
||||
return tableInNestedNS
|
||||
|
||||
@@ -2,21 +2,22 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
public class TableInNestedNST {
|
||||
private int foo;
|
||||
|
||||
public int getFoo() { return foo; }
|
||||
|
||||
public void setFoo(int foo) { this.foo = foo; }
|
||||
public int getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(int foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
public TableInNestedNST() {
|
||||
this.foo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
type UnionInNestedNST struct {
|
||||
Type UnionInNestedNS
|
||||
Type UnionInNestedNS
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (rcv UnionInNestedNS) UnPack(table flatbuffers.Table) *UnionInNestedNST {
|
||||
switch rcv {
|
||||
case UnionInNestedNSTableInNestedNS:
|
||||
x := TableInNestedNS{_tab: table}
|
||||
return &NamespaceA__NamespaceB.UnionInNestedNST{ Type: UnionInNestedNSTableInNestedNS, Value: x.UnPack() }
|
||||
return &NamespaceA__NamespaceB.UnionInNestedNST{Type: UnionInNestedNSTableInNestedNS, Value: x.UnPack()}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UnionInNestedNS {
|
||||
private UnionInNestedNS() { }
|
||||
private UnionInNestedNS() {}
|
||||
|
||||
public static final byte NONE = 0;
|
||||
public static final byte TableInNestedNS = 1;
|
||||
|
||||
public static final String[] names = { "NONE", "TableInNestedNS", };
|
||||
public static final String[] names = {
|
||||
"NONE", "TableInNestedNS",
|
||||
};
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
public static String name(int e) {
|
||||
return names[e];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ package NamespaceA.NamespaceB
|
||||
@Suppress("unused")
|
||||
@ExperimentalUnsignedTypes
|
||||
class UnionInNestedNS private constructor() {
|
||||
companion object {
|
||||
const val NONE: UByte = 0u
|
||||
const val TableInNestedNS: UByte = 1u
|
||||
val names : Array<String> = arrayOf("NONE", "TableInNestedNS")
|
||||
fun name(e: Int) : String = names[e]
|
||||
}
|
||||
companion object {
|
||||
const val NONE: UByte = 0u
|
||||
const val TableInNestedNS: UByte = 1u
|
||||
val names: Array<String> = arrayOf("NONE", "TableInNestedNS")
|
||||
|
||||
fun name(e: Int): String = names[e]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
|
||||
class UnionInNestedNS(object):
|
||||
NONE = 0
|
||||
TableInNestedNS = 1
|
||||
NONE = 0
|
||||
TableInNestedNS = 1
|
||||
|
||||
|
||||
def UnionInNestedNSCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == UnionInNestedNS().TableInNestedNS:
|
||||
return TableInNestedNST.InitFromBuf(table.Bytes, table.Pos)
|
||||
from flatbuffers.table import Table
|
||||
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == UnionInNestedNS().TableInNestedNS:
|
||||
return TableInNestedNST.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
|
||||
@@ -8,26 +8,37 @@ public class UnionInNestedNSUnion {
|
||||
private byte type;
|
||||
private Object value;
|
||||
|
||||
public byte getType() { return type; }
|
||||
public byte getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(byte type) { this.type = type; }
|
||||
public void setType(byte type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Object getValue() { return value; }
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) { this.value = value; }
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public UnionInNestedNSUnion() {
|
||||
this.type = UnionInNestedNS.NONE;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNST asTableInNestedNS() { return (NamespaceA.NamespaceB.TableInNestedNST) value; }
|
||||
public NamespaceA.NamespaceB.TableInNestedNST asTableInNestedNS() {
|
||||
return (NamespaceA.NamespaceB.TableInNestedNST) value;
|
||||
}
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
|
||||
switch (_o.type) {
|
||||
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.asTableInNestedNS());
|
||||
default: return 0;
|
||||
case UnionInNestedNS.TableInNestedNS:
|
||||
return NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.asTableInNestedNS());
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user