Merge commit '0f6aab9da6fe982218a01f4a5b896e65fcced437' as 'third_party/flatbuffers'
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA.NamespaceB
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum EnumInNestedNS : sbyte
|
||||
{
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceB
|
||||
|
||||
import "strconv"
|
||||
|
||||
type EnumInNestedNS int8
|
||||
|
||||
const (
|
||||
EnumInNestedNSA EnumInNestedNS = 0
|
||||
EnumInNestedNSB EnumInNestedNS = 1
|
||||
EnumInNestedNSC EnumInNestedNS = 2
|
||||
)
|
||||
|
||||
var EnumNamesEnumInNestedNS = map[EnumInNestedNS]string{
|
||||
EnumInNestedNSA: "A",
|
||||
EnumInNestedNSB: "B",
|
||||
EnumInNestedNSC: "C",
|
||||
}
|
||||
|
||||
var EnumValuesEnumInNestedNS = map[string]EnumInNestedNS{
|
||||
"A": EnumInNestedNSA,
|
||||
"B": EnumInNestedNSB,
|
||||
"C": EnumInNestedNSC,
|
||||
}
|
||||
|
||||
func (v EnumInNestedNS) String() string {
|
||||
if s, ok := EnumNamesEnumInNestedNS[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "EnumInNestedNS(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class 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 String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
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]
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceB
|
||||
|
||||
local EnumInNestedNS = {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
}
|
||||
|
||||
return EnumInNestedNS -- return the module
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA\NamespaceB;
|
||||
|
||||
class EnumInNestedNS
|
||||
{
|
||||
const A = 0;
|
||||
const B = 1;
|
||||
const C = 2;
|
||||
|
||||
private static $names = array(
|
||||
EnumInNestedNS::A=>"A",
|
||||
EnumInNestedNS::B=>"B",
|
||||
EnumInNestedNS::C=>"C",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
class EnumInNestedNS(object):
|
||||
A = 0
|
||||
B = 1
|
||||
C = 2
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA.NamespaceB
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct StructInNestedNS : IFlatbufferObject
|
||||
{
|
||||
private Struct __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
|
||||
public StructInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int A { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
|
||||
public void MutateA(int a) { __p.bb.PutInt(__p.bb_pos + 0, a); }
|
||||
public int B { get { return __p.bb.GetInt(__p.bb_pos + 4); } }
|
||||
public void MutateB(int b) { __p.bb.PutInt(__p.bb_pos + 4, b); }
|
||||
|
||||
public static Offset<NamespaceA.NamespaceB.StructInNestedNS> CreateStructInNestedNS(FlatBufferBuilder builder, int A, int B) {
|
||||
builder.Prep(4, 8);
|
||||
builder.PutInt(B);
|
||||
builder.PutInt(A);
|
||||
return new Offset<NamespaceA.NamespaceB.StructInNestedNS>(builder.Offset);
|
||||
}
|
||||
public StructInNestedNST UnPack() {
|
||||
var _o = new StructInNestedNST();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(StructInNestedNST _o) {
|
||||
_o.A = this.A;
|
||||
_o.B = this.B;
|
||||
}
|
||||
public static Offset<NamespaceA.NamespaceB.StructInNestedNS> Pack(FlatBufferBuilder builder, StructInNestedNST _o) {
|
||||
if (_o == null) return default(Offset<NamespaceA.NamespaceB.StructInNestedNS>);
|
||||
return CreateStructInNestedNS(
|
||||
builder,
|
||||
_o.A,
|
||||
_o.B);
|
||||
}
|
||||
}
|
||||
|
||||
public class StructInNestedNST
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("a")]
|
||||
public int A { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("b")]
|
||||
public int B { get; set; }
|
||||
|
||||
public StructInNestedNST() {
|
||||
this.A = 0;
|
||||
this.B = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceB
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type StructInNestedNST struct {
|
||||
A int32
|
||||
B int32
|
||||
}
|
||||
|
||||
func (t *StructInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
return CreateStructInNestedNS(builder, t.A, t.B)
|
||||
}
|
||||
func (rcv *StructInNestedNS) UnPackTo(t *StructInNestedNST) {
|
||||
t.A = rcv.A()
|
||||
t.B = rcv.B()
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) UnPack() *StructInNestedNST {
|
||||
if rcv == nil { return nil }
|
||||
t := &StructInNestedNST{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type StructInNestedNS struct {
|
||||
_tab flatbuffers.Struct
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) Table() flatbuffers.Table {
|
||||
return rcv._tab.Table
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) A() int32 {
|
||||
return rcv._tab.GetInt32(rcv._tab.Pos + flatbuffers.UOffsetT(0))
|
||||
}
|
||||
func (rcv *StructInNestedNS) MutateA(n int32) bool {
|
||||
return rcv._tab.MutateInt32(rcv._tab.Pos+flatbuffers.UOffsetT(0), n)
|
||||
}
|
||||
|
||||
func (rcv *StructInNestedNS) B() int32 {
|
||||
return rcv._tab.GetInt32(rcv._tab.Pos + flatbuffers.UOffsetT(4))
|
||||
}
|
||||
func (rcv *StructInNestedNS) MutateB(n int32) bool {
|
||||
return rcv._tab.MutateInt32(rcv._tab.Pos+flatbuffers.UOffsetT(4), n)
|
||||
}
|
||||
|
||||
func CreateStructInNestedNS(builder *flatbuffers.Builder, a int32, b int32) flatbuffers.UOffsetT {
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependInt32(b)
|
||||
builder.PrependInt32(a)
|
||||
return builder.Offset()
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@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 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);
|
||||
builder.putInt(b);
|
||||
builder.putInt(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
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 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());
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceB
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local StructInNestedNS = {} -- the module
|
||||
local StructInNestedNS_mt = {} -- the class metatable
|
||||
|
||||
function StructInNestedNS.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = StructInNestedNS_mt})
|
||||
return o
|
||||
end
|
||||
function StructInNestedNS_mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
function StructInNestedNS_mt:A()
|
||||
return self.view:Get(flatbuffers.N.Int32, self.view.pos + 0)
|
||||
end
|
||||
function StructInNestedNS_mt:B()
|
||||
return self.view:Get(flatbuffers.N.Int32, self.view.pos + 4)
|
||||
end
|
||||
function StructInNestedNS.CreateStructInNestedNS(builder, a, b)
|
||||
builder:Prep(4, 8)
|
||||
builder:PrependInt32(b)
|
||||
builder:PrependInt32(a)
|
||||
return builder:Offset()
|
||||
end
|
||||
|
||||
return StructInNestedNS -- return the module
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA\NamespaceB;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class StructInNestedNS extends Struct
|
||||
{
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return StructInNestedNS
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetA()
|
||||
{
|
||||
return $this->bb->getInt($this->bb_pos + 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetB()
|
||||
{
|
||||
return $this->bb->getInt($this->bb_pos + 4);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int offset
|
||||
*/
|
||||
public static function createStructInNestedNS(FlatBufferBuilder $builder, $a, $b)
|
||||
{
|
||||
$builder->prep(4, 8);
|
||||
$builder->putInt($b);
|
||||
$builder->putInt($a);
|
||||
return $builder->offset();
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class StructInNestedNS(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls):
|
||||
return 8
|
||||
|
||||
# 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))
|
||||
|
||||
def CreateStructInNestedNS(builder, a, b):
|
||||
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
|
||||
|
||||
@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
|
||||
|
||||
# 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)
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class StructInNestedNST {
|
||||
private int a;
|
||||
private int b;
|
||||
|
||||
public int getA() { return a; }
|
||||
|
||||
public void setA(int a) { this.a = a; }
|
||||
|
||||
public int getB() { return b; }
|
||||
|
||||
public void setB(int b) { this.b = b; }
|
||||
|
||||
|
||||
public StructInNestedNST() {
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA.NamespaceB
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct TableInNestedNS : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb) { return GetRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
|
||||
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int Foo { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
public bool MutateFoo(int foo) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, foo); return true; } else { return false; } }
|
||||
|
||||
public static Offset<NamespaceA.NamespaceB.TableInNestedNS> CreateTableInNestedNS(FlatBufferBuilder builder,
|
||||
int foo = 0) {
|
||||
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 Offset<NamespaceA.NamespaceB.TableInNestedNS> EndTableInNestedNS(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<NamespaceA.NamespaceB.TableInNestedNS>(o);
|
||||
}
|
||||
public TableInNestedNST UnPack() {
|
||||
var _o = new TableInNestedNST();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(TableInNestedNST _o) {
|
||||
_o.Foo = this.Foo;
|
||||
}
|
||||
public static Offset<NamespaceA.NamespaceB.TableInNestedNS> Pack(FlatBufferBuilder builder, TableInNestedNST _o) {
|
||||
if (_o == null) return default(Offset<NamespaceA.NamespaceB.TableInNestedNS>);
|
||||
return CreateTableInNestedNS(
|
||||
builder,
|
||||
_o.Foo);
|
||||
}
|
||||
}
|
||||
|
||||
public class TableInNestedNST
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("foo")]
|
||||
public int Foo { get; set; }
|
||||
|
||||
public TableInNestedNST() {
|
||||
this.Foo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class TableInNestedNSVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*Foo*/, 4 /*int*/, 4, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceB
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type TableInNestedNST struct {
|
||||
Foo int32
|
||||
}
|
||||
|
||||
func (t *TableInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
TableInNestedNSStart(builder)
|
||||
TableInNestedNSAddFoo(builder, t.Foo)
|
||||
return TableInNestedNSEnd(builder)
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) UnPackTo(t *TableInNestedNST) {
|
||||
t.Foo = rcv.Foo()
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) UnPack() *TableInNestedNST {
|
||||
if rcv == nil { return nil }
|
||||
t := &TableInNestedNST{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type TableInNestedNS struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsTableInNestedNS(buf []byte, offset flatbuffers.UOffsetT) *TableInNestedNS {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &TableInNestedNS{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsTableInNestedNS(buf []byte, offset flatbuffers.UOffsetT) *TableInNestedNS {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &TableInNestedNS{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) Foo() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TableInNestedNS) MutateFoo(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(4, n)
|
||||
}
|
||||
|
||||
func TableInNestedNSStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(1)
|
||||
}
|
||||
func TableInNestedNSAddFoo(builder *flatbuffers.Builder, foo int32) {
|
||||
builder.PrependInt32Slot(0, foo, 0)
|
||||
}
|
||||
func TableInNestedNSEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class TableInNestedNS extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
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 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 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 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());
|
||||
}
|
||||
}
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
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 __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 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_24_3_25()
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceB
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local TableInNestedNS = {} -- the module
|
||||
local TableInNestedNS_mt = {} -- the class metatable
|
||||
|
||||
function TableInNestedNS.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = TableInNestedNS_mt})
|
||||
return o
|
||||
end
|
||||
function TableInNestedNS.GetRootAsTableInNestedNS(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
end
|
||||
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
|
||||
local o = TableInNestedNS.New()
|
||||
o:Init(buf, n + offset)
|
||||
return o
|
||||
end
|
||||
function TableInNestedNS_mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
function TableInNestedNS_mt:Foo()
|
||||
local o = self.view:Offset(4)
|
||||
if o ~= 0 then
|
||||
return self.view:Get(flatbuffers.N.Int32, o + self.view.pos)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function TableInNestedNS.Start(builder) builder:StartObject(1) end
|
||||
function TableInNestedNS.AddFoo(builder, foo) builder:PrependInt32Slot(0, foo, 0) end
|
||||
function TableInNestedNS.End(builder) return builder:EndObject() end
|
||||
|
||||
return TableInNestedNS -- return the module
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA\NamespaceB;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class TableInNestedNS extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return TableInNestedNS
|
||||
*/
|
||||
public static function getRootAsTableInNestedNS(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new TableInNestedNS();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return TableInNestedNS
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFoo()
|
||||
{
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startTableInNestedNS(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return TableInNestedNS
|
||||
*/
|
||||
public static function createTableInNestedNS(FlatBufferBuilder $builder, $foo)
|
||||
{
|
||||
$builder->startObject(1);
|
||||
self::addFoo($builder, $foo);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addFoo(FlatBufferBuilder $builder, $foo)
|
||||
{
|
||||
$builder->addIntX(0, $foo, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endTableInNestedNS(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class TableInNestedNS(object):
|
||||
__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 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)
|
||||
def Start(builder):
|
||||
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()
|
||||
def End(builder):
|
||||
return TableInNestedNSEnd(builder)
|
||||
|
||||
class TableInNestedNST(object):
|
||||
|
||||
# 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 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 Pack(self, builder):
|
||||
TableInNestedNSStart(builder)
|
||||
TableInNestedNSAddFoo(builder, self.foo)
|
||||
tableInNestedNS = TableInNestedNSEnd(builder)
|
||||
return tableInNestedNS
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class TableInNestedNST {
|
||||
private int foo;
|
||||
|
||||
public int getFoo() { return foo; }
|
||||
|
||||
public void setFoo(int foo) { this.foo = foo; }
|
||||
|
||||
|
||||
public TableInNestedNST() {
|
||||
this.foo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA.NamespaceB
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum UnionInNestedNS : byte
|
||||
{
|
||||
NONE = 0,
|
||||
TableInNestedNS = 1,
|
||||
};
|
||||
|
||||
public class UnionInNestedNSUnion {
|
||||
public UnionInNestedNS Type { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public UnionInNestedNSUnion() {
|
||||
this.Type = UnionInNestedNS.NONE;
|
||||
this.Value = null;
|
||||
}
|
||||
|
||||
public T As<T>() where T : class { return this.Value as T; }
|
||||
public NamespaceA.NamespaceB.TableInNestedNST AsTableInNestedNS() { return this.As<NamespaceA.NamespaceB.TableInNestedNST>(); }
|
||||
public static UnionInNestedNSUnion FromTableInNestedNS(NamespaceA.NamespaceB.TableInNestedNST _tableinnestedns) { return new UnionInNestedNSUnion{ Type = UnionInNestedNS.TableInNestedNS, Value = _tableinnestedns }; }
|
||||
|
||||
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
|
||||
switch (_o.Type) {
|
||||
default: return 0;
|
||||
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.Pack(builder, _o.AsTableInNestedNS()).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UnionInNestedNSUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(UnionInNestedNSUnion) || objectType == typeof(System.Collections.Generic.List<UnionInNestedNSUnion>);
|
||||
}
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = value as System.Collections.Generic.List<UnionInNestedNSUnion>;
|
||||
if (_olist != null) {
|
||||
writer.WriteStartArray();
|
||||
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
|
||||
writer.WriteEndArray();
|
||||
} else {
|
||||
this.WriteJson(writer, value as UnionInNestedNSUnion, serializer);
|
||||
}
|
||||
}
|
||||
public void WriteJson(Newtonsoft.Json.JsonWriter writer, UnionInNestedNSUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return;
|
||||
serializer.Serialize(writer, _o.Value);
|
||||
}
|
||||
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = existingValue as System.Collections.Generic.List<UnionInNestedNSUnion>;
|
||||
if (_olist != null) {
|
||||
for (var _j = 0; _j < _olist.Count; ++_j) {
|
||||
reader.Read();
|
||||
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
|
||||
}
|
||||
reader.Read();
|
||||
return _olist;
|
||||
} else {
|
||||
return this.ReadJson(reader, existingValue as UnionInNestedNSUnion, serializer);
|
||||
}
|
||||
}
|
||||
public UnionInNestedNSUnion ReadJson(Newtonsoft.Json.JsonReader reader, UnionInNestedNSUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return null;
|
||||
switch (_o.Type) {
|
||||
default: break;
|
||||
case UnionInNestedNS.TableInNestedNS: _o.Value = serializer.Deserialize<NamespaceA.NamespaceB.TableInNestedNST>(reader); break;
|
||||
}
|
||||
return _o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class UnionInNestedNSVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((UnionInNestedNS)typeId)
|
||||
{
|
||||
case UnionInNestedNS.TableInNestedNS:
|
||||
result = NamespaceA.NamespaceB.TableInNestedNSVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceB
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
|
||||
NamespaceA__NamespaceB "NamespaceA/NamespaceB"
|
||||
)
|
||||
|
||||
type UnionInNestedNST struct {
|
||||
Type UnionInNestedNS
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func (t *UnionInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
switch t.Type {
|
||||
case UnionInNestedNSTableInNestedNS:
|
||||
return t.Value.(*NamespaceA__NamespaceB.TableInNestedNST).Pack(builder)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
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 nil
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UnionInNestedNS {
|
||||
private UnionInNestedNS() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte TableInNestedNS = 1;
|
||||
|
||||
public static final String[] names = { "NONE", "TableInNestedNS", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
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]
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceB
|
||||
|
||||
local UnionInNestedNS = {
|
||||
NONE = 0,
|
||||
TableInNestedNS = 1,
|
||||
}
|
||||
|
||||
return UnionInNestedNS -- return the module
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA\NamespaceB;
|
||||
|
||||
class UnionInNestedNS
|
||||
{
|
||||
const NONE = 0;
|
||||
const TableInNestedNS = 1;
|
||||
|
||||
private static $names = array(
|
||||
UnionInNestedNS::NONE=>"NONE",
|
||||
UnionInNestedNS::TableInNestedNS=>"TableInNestedNS",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceB
|
||||
|
||||
class UnionInNestedNS(object):
|
||||
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)
|
||||
return None
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
public class UnionInNestedNSUnion {
|
||||
private byte type;
|
||||
private Object value;
|
||||
|
||||
public byte getType() { return type; }
|
||||
|
||||
public void setType(byte type) { this.type = type; }
|
||||
|
||||
public Object getValue() { return 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 static int pack(FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
|
||||
switch (_o.type) {
|
||||
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.asTableInNestedNS());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct SecondTableInA : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb) { return GetRootAsSecondTableInA(_bb, new SecondTableInA()); }
|
||||
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceC.TableInC? ReferToC { get { int o = __p.__offset(4); return o != 0 ? (NamespaceC.TableInC?)(new NamespaceC.TableInC()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
|
||||
|
||||
public static Offset<NamespaceA.SecondTableInA> CreateSecondTableInA(FlatBufferBuilder builder,
|
||||
Offset<NamespaceC.TableInC> refer_to_cOffset = default(Offset<NamespaceC.TableInC>)) {
|
||||
builder.StartTable(1);
|
||||
SecondTableInA.AddReferToC(builder, refer_to_cOffset);
|
||||
return SecondTableInA.EndSecondTableInA(builder);
|
||||
}
|
||||
|
||||
public static void StartSecondTableInA(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||
public static void AddReferToC(FlatBufferBuilder builder, Offset<NamespaceC.TableInC> referToCOffset) { builder.AddOffset(0, referToCOffset.Value, 0); }
|
||||
public static Offset<NamespaceA.SecondTableInA> EndSecondTableInA(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<NamespaceA.SecondTableInA>(o);
|
||||
}
|
||||
public SecondTableInAT UnPack() {
|
||||
var _o = new SecondTableInAT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(SecondTableInAT _o) {
|
||||
_o.ReferToC = this.ReferToC.HasValue ? this.ReferToC.Value.UnPack() : null;
|
||||
}
|
||||
public static Offset<NamespaceA.SecondTableInA> Pack(FlatBufferBuilder builder, SecondTableInAT _o) {
|
||||
if (_o == null) return default(Offset<NamespaceA.SecondTableInA>);
|
||||
var _refer_to_c = _o.ReferToC == null ? default(Offset<NamespaceC.TableInC>) : NamespaceC.TableInC.Pack(builder, _o.ReferToC);
|
||||
return CreateSecondTableInA(
|
||||
builder,
|
||||
_refer_to_c);
|
||||
}
|
||||
}
|
||||
|
||||
public class SecondTableInAT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("refer_to_c")]
|
||||
public NamespaceC.TableInCT ReferToC { get; set; }
|
||||
|
||||
public SecondTableInAT() {
|
||||
this.ReferToC = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class SecondTableInAVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyTable(tablePos, 4 /*ReferToC*/, NamespaceC.TableInCVerify.Verify, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceA
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
|
||||
NamespaceC "NamespaceC"
|
||||
)
|
||||
|
||||
type SecondTableInAT struct {
|
||||
ReferToC *NamespaceC.TableInCT
|
||||
}
|
||||
|
||||
func (t *SecondTableInAT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
referToCOffset := t.ReferToC.Pack(builder)
|
||||
SecondTableInAStart(builder)
|
||||
SecondTableInAAddReferToC(builder, referToCOffset)
|
||||
return SecondTableInAEnd(builder)
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) UnPackTo(t *SecondTableInAT) {
|
||||
t.ReferToC = rcv.ReferToC(nil).UnPack()
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) UnPack() *SecondTableInAT {
|
||||
if rcv == nil { return nil }
|
||||
t := &SecondTableInAT{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type SecondTableInA struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsSecondTableInA(buf []byte, offset flatbuffers.UOffsetT) *SecondTableInA {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &SecondTableInA{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsSecondTableInA(buf []byte, offset flatbuffers.UOffsetT) *SecondTableInA {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &SecondTableInA{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) ReferToC(obj *NamespaceC.TableInC) *NamespaceC.TableInC {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(NamespaceC.TableInC)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SecondTableInAStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(1)
|
||||
}
|
||||
func SecondTableInAAddReferToC(builder *flatbuffers.Builder, referToC flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(referToC), 0)
|
||||
}
|
||||
func SecondTableInAEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SecondTableInA extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); }
|
||||
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA 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 SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceC.TableInC referToC() { return referToC(new NamespaceC.TableInC()); }
|
||||
public NamespaceC.TableInC referToC(NamespaceC.TableInC obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static int createSecondTableInA(FlatBufferBuilder builder,
|
||||
int referToCOffset) {
|
||||
builder.startTable(1);
|
||||
SecondTableInA.addReferToC(builder, referToCOffset);
|
||||
return SecondTableInA.endSecondTableInA(builder);
|
||||
}
|
||||
|
||||
public static void startSecondTableInA(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addReferToC(FlatBufferBuilder builder, int referToCOffset) { builder.addOffset(0, referToCOffset, 0); }
|
||||
public static int endSecondTableInA(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 SecondTableInA get(int j) { return get(new SecondTableInA(), j); }
|
||||
public SecondTableInA get(SecondTableInA obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public SecondTableInAT unpack() {
|
||||
SecondTableInAT _o = new SecondTableInAT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(SecondTableInAT _o) {
|
||||
if (referToC() != null) _o.setReferToC(referToC().unpack());
|
||||
else _o.setReferToC(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, SecondTableInAT _o) {
|
||||
if (_o == null) return 0;
|
||||
int _refer_to_c = _o.getReferToC() == null ? 0 : NamespaceC.TableInC.pack(builder, _o.getReferToC());
|
||||
return createSecondTableInA(
|
||||
builder,
|
||||
_refer_to_c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA
|
||||
|
||||
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 SecondTableInA : Table() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : SecondTableInA {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val referToC : NamespaceC.TableInC? get() = referToC(NamespaceC.TableInC())
|
||||
fun referToC(obj: NamespaceC.TableInC) : NamespaceC.TableInC? {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
obj.__assign(__indirect(o + bb_pos), bb)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_24_3_25()
|
||||
fun getRootAsSecondTableInA(_bb: ByteBuffer): SecondTableInA = getRootAsSecondTableInA(_bb, SecondTableInA())
|
||||
fun getRootAsSecondTableInA(_bb: ByteBuffer, obj: SecondTableInA): SecondTableInA {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
fun createSecondTableInA(builder: FlatBufferBuilder, referToCOffset: Int) : Int {
|
||||
builder.startTable(1)
|
||||
addReferToC(builder, referToCOffset)
|
||||
return endSecondTableInA(builder)
|
||||
}
|
||||
fun startSecondTableInA(builder: FlatBufferBuilder) = builder.startTable(1)
|
||||
fun addReferToC(builder: FlatBufferBuilder, referToC: Int) = builder.addOffset(0, referToC, 0)
|
||||
fun endSecondTableInA(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceA
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local SecondTableInA = {} -- the module
|
||||
local SecondTableInA_mt = {} -- the class metatable
|
||||
|
||||
function SecondTableInA.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = SecondTableInA_mt})
|
||||
return o
|
||||
end
|
||||
function SecondTableInA.GetRootAsSecondTableInA(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
end
|
||||
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
|
||||
local o = SecondTableInA.New()
|
||||
o:Init(buf, n + offset)
|
||||
return o
|
||||
end
|
||||
function SecondTableInA_mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
function SecondTableInA_mt:ReferToC()
|
||||
local o = self.view:Offset(4)
|
||||
if o ~= 0 then
|
||||
local x = self.view:Indirect(o + self.view.pos)
|
||||
local obj = require('NamespaceC.TableInC').New()
|
||||
obj:Init(self.view.bytes, x)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function SecondTableInA.Start(builder) builder:StartObject(1) end
|
||||
function SecondTableInA.AddReferToC(builder, referToC) builder:PrependUOffsetTRelativeSlot(0, referToC, 0) end
|
||||
function SecondTableInA.End(builder) return builder:EndObject() end
|
||||
|
||||
return SecondTableInA -- return the module
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class SecondTableInA extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return SecondTableInA
|
||||
*/
|
||||
public static function getRootAsSecondTableInA(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new SecondTableInA();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return SecondTableInA
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReferToC()
|
||||
{
|
||||
$obj = new TableInC();
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startSecondTableInA(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return SecondTableInA
|
||||
*/
|
||||
public static function createSecondTableInA(FlatBufferBuilder $builder, $refer_to_c)
|
||||
{
|
||||
$builder->startObject(1);
|
||||
self::addReferToC($builder, $refer_to_c);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addReferToC(FlatBufferBuilder $builder, $referToC)
|
||||
{
|
||||
$builder->addOffsetX(0, $referToC, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endSecondTableInA(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceA
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class SecondTableInA(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = SecondTableInA()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsSecondTableInA(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# SecondTableInA
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# SecondTableInA
|
||||
def ReferToC(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
obj = TableInC()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def SecondTableInAStart(builder): builder.StartObject(1)
|
||||
def Start(builder):
|
||||
return SecondTableInAStart(builder)
|
||||
def SecondTableInAAddReferToC(builder, referToC): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToC), 0)
|
||||
def AddReferToC(builder, referToC):
|
||||
return SecondTableInAAddReferToC(builder, referToC)
|
||||
def SecondTableInAEnd(builder): return builder.EndObject()
|
||||
def End(builder):
|
||||
return SecondTableInAEnd(builder)
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
class SecondTableInAT(object):
|
||||
|
||||
# SecondTableInAT
|
||||
def __init__(self):
|
||||
self.referToC = None # type: Optional[TableInCT]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
secondTableInA = SecondTableInA()
|
||||
secondTableInA.Init(buf, pos)
|
||||
return cls.InitFromObj(secondTableInA)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, secondTableInA):
|
||||
x = SecondTableInAT()
|
||||
x._UnPack(secondTableInA)
|
||||
return x
|
||||
|
||||
# SecondTableInAT
|
||||
def _UnPack(self, secondTableInA):
|
||||
if secondTableInA is None:
|
||||
return
|
||||
if secondTableInA.ReferToC() is not None:
|
||||
self.referToC = TableInCT.InitFromObj(secondTableInA.ReferToC())
|
||||
|
||||
# SecondTableInAT
|
||||
def Pack(self, builder):
|
||||
if self.referToC is not None:
|
||||
referToC = self.referToC.Pack(builder)
|
||||
SecondTableInAStart(builder)
|
||||
if self.referToC is not None:
|
||||
SecondTableInAAddReferToC(builder, referToC)
|
||||
secondTableInA = SecondTableInAEnd(builder)
|
||||
return secondTableInA
|
||||
@@ -0,0 +1,22 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class SecondTableInAT {
|
||||
private NamespaceC.TableInCT referToC;
|
||||
|
||||
public NamespaceC.TableInCT getReferToC() { return referToC; }
|
||||
|
||||
public void setReferToC(NamespaceC.TableInCT referToC) { this.referToC = referToC; }
|
||||
|
||||
|
||||
public SecondTableInAT() {
|
||||
this.referToC = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA
|
||||
{
|
||||
|
||||
using System;
|
||||
using Google.FlatBuffers;
|
||||
|
||||
public sealed class TableInC : Table {
|
||||
public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); }
|
||||
public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public TableInC __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||
|
||||
public NamespaceA.TableInFirstNS ReferToA1 { get { return GetReferToA1(new NamespaceA.TableInFirstNS()); } }
|
||||
public NamespaceA.TableInFirstNS GetReferToA1(NamespaceA.TableInFirstNS obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
||||
public SecondTableInA ReferToA2 { get { return GetReferToA2(new SecondTableInA()); } }
|
||||
public SecondTableInA GetReferToA2(SecondTableInA obj) { int o = __offset(6); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder,
|
||||
Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>),
|
||||
Offset<SecondTableInA> refer_to_a2Offset = default(Offset<SecondTableInA>)) {
|
||||
builder.StartObject(2);
|
||||
TableInC.AddReferToA2(builder, refer_to_a2Offset);
|
||||
TableInC.AddReferToA1(builder, refer_to_a1Offset);
|
||||
return TableInC.EndTableInC(builder);
|
||||
}
|
||||
|
||||
public static void StartTableInC(FlatBufferBuilder builder) { builder.StartObject(2); }
|
||||
public static void AddReferToA1(FlatBufferBuilder builder, Offset<NamespaceA.TableInFirstNS> referToA1Offset) { builder.AddOffset(0, referToA1Offset.Value, 0); }
|
||||
public static void AddReferToA2(FlatBufferBuilder builder, Offset<SecondTableInA> referToA2Offset) { builder.AddOffset(1, referToA2Offset.Value, 0); }
|
||||
public static Offset<NamespaceC.TableInC> EndTableInC(FlatBufferBuilder builder) {
|
||||
int o = builder.EndObject();
|
||||
return new Offset<NamespaceC.TableInC>(o);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
type TableInC struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func (rcv *TableInC) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *TableInC) ReferToA1(obj *TableInFirstNS) *TableInFirstNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(TableInFirstNS)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcv *TableInC) ReferToA2(obj *SecondTableInA) *SecondTableInA {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(SecondTableInA)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func TableInCStart(builder *flatbuffers.Builder) { builder.StartObject(2) }
|
||||
func TableInCAddReferToA1(builder *flatbuffers.Builder, referToA1 flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(referToA1), 0) }
|
||||
func TableInCAddReferToA2(builder *flatbuffers.Builder, referToA2 flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(referToA2), 0) }
|
||||
func TableInCEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class TableInC extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return TableInC
|
||||
*/
|
||||
public static function getRootAsTableInC(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new TableInC();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return TableInC
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReferToA1()
|
||||
{
|
||||
$obj = new TableInFirstNS();
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
public function getReferToA2()
|
||||
{
|
||||
$obj = new SecondTableInA();
|
||||
$o = $this->__offset(6);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startTableInC(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return TableInC
|
||||
*/
|
||||
public static function createTableInC(FlatBufferBuilder $builder, $refer_to_a1, $refer_to_a2)
|
||||
{
|
||||
$builder->startObject(2);
|
||||
self::addReferToA1($builder, $refer_to_a1);
|
||||
self::addReferToA2($builder, $refer_to_a2);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addReferToA1(FlatBufferBuilder $builder, $referToA1)
|
||||
{
|
||||
$builder->addOffsetX(0, $referToA1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addReferToA2(FlatBufferBuilder $builder, $referToA2)
|
||||
{
|
||||
$builder->addOffsetX(1, $referToA2, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endTableInC(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceA
|
||||
|
||||
import flatbuffers
|
||||
|
||||
class TableInC(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
# TableInC
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TableInC
|
||||
def ReferToA1(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
from .TableInFirstNS import TableInFirstNS
|
||||
obj = TableInFirstNS()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
# TableInC
|
||||
def ReferToA2(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
from .SecondTableInA import SecondTableInA
|
||||
obj = SecondTableInA()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def TableInCStart(builder): builder.StartObject(2)
|
||||
def TableInCAddReferToA1(builder, referToA1): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToA1), 0)
|
||||
def TableInCAddReferToA2(builder, referToA2): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(referToA2), 0)
|
||||
def TableInCEnd(builder): return builder.EndObject()
|
||||
@@ -0,0 +1,133 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceA
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct TableInFirstNS : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb) { return GetRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
|
||||
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNS? FooTable { get { int o = __p.__offset(4); return o != 0 ? (NamespaceA.NamespaceB.TableInNestedNS?)(new NamespaceA.NamespaceB.TableInNestedNS()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
|
||||
public NamespaceA.NamespaceB.EnumInNestedNS FooEnum { get { int o = __p.__offset(6); return o != 0 ? (NamespaceA.NamespaceB.EnumInNestedNS)__p.bb.GetSbyte(o + __p.bb_pos) : NamespaceA.NamespaceB.EnumInNestedNS.A; } }
|
||||
public bool MutateFooEnum(NamespaceA.NamespaceB.EnumInNestedNS foo_enum) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, (sbyte)foo_enum); return true; } else { return false; } }
|
||||
public NamespaceA.NamespaceB.UnionInNestedNS FooUnionType { get { int o = __p.__offset(8); return o != 0 ? (NamespaceA.NamespaceB.UnionInNestedNS)__p.bb.Get(o + __p.bb_pos) : NamespaceA.NamespaceB.UnionInNestedNS.NONE; } }
|
||||
public TTable? FooUnion<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(10); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
|
||||
public NamespaceA.NamespaceB.TableInNestedNS FooUnionAsTableInNestedNS() { return FooUnion<NamespaceA.NamespaceB.TableInNestedNS>().Value; }
|
||||
public NamespaceA.NamespaceB.StructInNestedNS? FooStruct { get { int o = __p.__offset(12); return o != 0 ? (NamespaceA.NamespaceB.StructInNestedNS?)(new NamespaceA.NamespaceB.StructInNestedNS()).__assign(o + __p.bb_pos, __p.bb) : null; } }
|
||||
|
||||
public static Offset<NamespaceA.TableInFirstNS> CreateTableInFirstNS(FlatBufferBuilder builder,
|
||||
Offset<NamespaceA.NamespaceB.TableInNestedNS> foo_tableOffset = default(Offset<NamespaceA.NamespaceB.TableInNestedNS>),
|
||||
NamespaceA.NamespaceB.EnumInNestedNS foo_enum = NamespaceA.NamespaceB.EnumInNestedNS.A,
|
||||
NamespaceA.NamespaceB.UnionInNestedNS foo_union_type = NamespaceA.NamespaceB.UnionInNestedNS.NONE,
|
||||
int foo_unionOffset = 0,
|
||||
NamespaceA.NamespaceB.StructInNestedNST foo_struct = null) {
|
||||
builder.StartTable(5);
|
||||
TableInFirstNS.AddFooStruct(builder, NamespaceA.NamespaceB.StructInNestedNS.Pack(builder, foo_struct));
|
||||
TableInFirstNS.AddFooUnion(builder, foo_unionOffset);
|
||||
TableInFirstNS.AddFooTable(builder, foo_tableOffset);
|
||||
TableInFirstNS.AddFooUnionType(builder, foo_union_type);
|
||||
TableInFirstNS.AddFooEnum(builder, foo_enum);
|
||||
return TableInFirstNS.EndTableInFirstNS(builder);
|
||||
}
|
||||
|
||||
public static void StartTableInFirstNS(FlatBufferBuilder builder) { builder.StartTable(5); }
|
||||
public static void AddFooTable(FlatBufferBuilder builder, Offset<NamespaceA.NamespaceB.TableInNestedNS> fooTableOffset) { builder.AddOffset(0, fooTableOffset.Value, 0); }
|
||||
public static void AddFooEnum(FlatBufferBuilder builder, NamespaceA.NamespaceB.EnumInNestedNS fooEnum) { builder.AddSbyte(1, (sbyte)fooEnum, 0); }
|
||||
public static void AddFooUnionType(FlatBufferBuilder builder, NamespaceA.NamespaceB.UnionInNestedNS fooUnionType) { builder.AddByte(2, (byte)fooUnionType, 0); }
|
||||
public static void AddFooUnion(FlatBufferBuilder builder, int fooUnionOffset) { builder.AddOffset(3, fooUnionOffset, 0); }
|
||||
public static void AddFooStruct(FlatBufferBuilder builder, Offset<NamespaceA.NamespaceB.StructInNestedNS> fooStructOffset) { builder.AddStruct(4, fooStructOffset.Value, 0); }
|
||||
public static Offset<NamespaceA.TableInFirstNS> EndTableInFirstNS(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<NamespaceA.TableInFirstNS>(o);
|
||||
}
|
||||
public TableInFirstNST UnPack() {
|
||||
var _o = new TableInFirstNST();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(TableInFirstNST _o) {
|
||||
_o.FooTable = this.FooTable.HasValue ? this.FooTable.Value.UnPack() : null;
|
||||
_o.FooEnum = this.FooEnum;
|
||||
_o.FooUnion = new NamespaceA.NamespaceB.UnionInNestedNSUnion();
|
||||
_o.FooUnion.Type = this.FooUnionType;
|
||||
switch (this.FooUnionType) {
|
||||
default: break;
|
||||
case NamespaceA.NamespaceB.UnionInNestedNS.TableInNestedNS:
|
||||
_o.FooUnion.Value = this.FooUnion<NamespaceA.NamespaceB.TableInNestedNS>().HasValue ? this.FooUnion<NamespaceA.NamespaceB.TableInNestedNS>().Value.UnPack() : null;
|
||||
break;
|
||||
}
|
||||
_o.FooStruct = this.FooStruct.HasValue ? this.FooStruct.Value.UnPack() : null;
|
||||
}
|
||||
public static Offset<NamespaceA.TableInFirstNS> Pack(FlatBufferBuilder builder, TableInFirstNST _o) {
|
||||
if (_o == null) return default(Offset<NamespaceA.TableInFirstNS>);
|
||||
var _foo_table = _o.FooTable == null ? default(Offset<NamespaceA.NamespaceB.TableInNestedNS>) : NamespaceA.NamespaceB.TableInNestedNS.Pack(builder, _o.FooTable);
|
||||
var _foo_union_type = _o.FooUnion == null ? NamespaceA.NamespaceB.UnionInNestedNS.NONE : _o.FooUnion.Type;
|
||||
var _foo_union = _o.FooUnion == null ? 0 : NamespaceA.NamespaceB.UnionInNestedNSUnion.Pack(builder, _o.FooUnion);
|
||||
return CreateTableInFirstNS(
|
||||
builder,
|
||||
_foo_table,
|
||||
_o.FooEnum,
|
||||
_foo_union_type,
|
||||
_foo_union,
|
||||
_o.FooStruct);
|
||||
}
|
||||
}
|
||||
|
||||
public class TableInFirstNST
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("foo_table")]
|
||||
public NamespaceA.NamespaceB.TableInNestedNST FooTable { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("foo_enum")]
|
||||
public NamespaceA.NamespaceB.EnumInNestedNS FooEnum { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("foo_union_type")]
|
||||
private NamespaceA.NamespaceB.UnionInNestedNS FooUnionType {
|
||||
get {
|
||||
return this.FooUnion != null ? this.FooUnion.Type : NamespaceA.NamespaceB.UnionInNestedNS.NONE;
|
||||
}
|
||||
set {
|
||||
this.FooUnion = new NamespaceA.NamespaceB.UnionInNestedNSUnion();
|
||||
this.FooUnion.Type = value;
|
||||
}
|
||||
}
|
||||
[Newtonsoft.Json.JsonProperty("foo_union")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(NamespaceA.NamespaceB.UnionInNestedNSUnion_JsonConverter))]
|
||||
public NamespaceA.NamespaceB.UnionInNestedNSUnion FooUnion { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("foo_struct")]
|
||||
public NamespaceA.NamespaceB.StructInNestedNST FooStruct { get; set; }
|
||||
|
||||
public TableInFirstNST() {
|
||||
this.FooTable = null;
|
||||
this.FooEnum = NamespaceA.NamespaceB.EnumInNestedNS.A;
|
||||
this.FooUnion = null;
|
||||
this.FooStruct = new NamespaceA.NamespaceB.StructInNestedNST();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class TableInFirstNSVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyTable(tablePos, 4 /*FooTable*/, NamespaceA.NamespaceB.TableInNestedNSVerify.Verify, false)
|
||||
&& verifier.VerifyField(tablePos, 6 /*FooEnum*/, 1 /*NamespaceA.NamespaceB.EnumInNestedNS*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 8 /*FooUnionType*/, 1 /*NamespaceA.NamespaceB.UnionInNestedNS*/, 1, false)
|
||||
&& verifier.VerifyUnion(tablePos, 8, 10 /*FooUnion*/, NamespaceA.NamespaceB.UnionInNestedNSVerify.Verify, false)
|
||||
&& verifier.VerifyField(tablePos, 12 /*FooStruct*/, 8 /*NamespaceA.NamespaceB.StructInNestedNS*/, 4, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceA
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
|
||||
NamespaceA__NamespaceB "NamespaceA/NamespaceB"
|
||||
)
|
||||
|
||||
type TableInFirstNST struct {
|
||||
FooTable *NamespaceA__NamespaceB.TableInNestedNST
|
||||
FooEnum NamespaceA__NamespaceB.EnumInNestedNS
|
||||
FooUnion *NamespaceA__NamespaceB.UnionInNestedNST
|
||||
FooStruct *NamespaceA__NamespaceB.StructInNestedNST
|
||||
}
|
||||
|
||||
func (t *TableInFirstNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
fooTableOffset := t.FooTable.Pack(builder)
|
||||
fooUnionOffset := t.FooUnion.Pack(builder)
|
||||
|
||||
TableInFirstNSStart(builder)
|
||||
TableInFirstNSAddFooTable(builder, fooTableOffset)
|
||||
TableInFirstNSAddFooEnum(builder, t.FooEnum)
|
||||
if t.FooUnion != nil {
|
||||
TableInFirstNSAddFooUnionType(builder, t.FooUnion.Type)
|
||||
}
|
||||
TableInFirstNSAddFooUnion(builder, fooUnionOffset)
|
||||
fooStructOffset := t.FooStruct.Pack(builder)
|
||||
TableInFirstNSAddFooStruct(builder, fooStructOffset)
|
||||
return TableInFirstNSEnd(builder)
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) UnPackTo(t *TableInFirstNST) {
|
||||
t.FooTable = rcv.FooTable(nil).UnPack()
|
||||
t.FooEnum = rcv.FooEnum()
|
||||
fooUnionTable := flatbuffers.Table{}
|
||||
if rcv.FooUnion(&fooUnionTable) {
|
||||
t.FooUnion = rcv.FooUnionType().UnPack(fooUnionTable)
|
||||
}
|
||||
t.FooStruct = rcv.FooStruct(nil).UnPack()
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) UnPack() *TableInFirstNST {
|
||||
if rcv == nil { return nil }
|
||||
t := &TableInFirstNST{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type TableInFirstNS struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsTableInFirstNS(buf []byte, offset flatbuffers.UOffsetT) *TableInFirstNS {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &TableInFirstNS{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsTableInFirstNS(buf []byte, offset flatbuffers.UOffsetT) *TableInFirstNS {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &TableInFirstNS{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) FooTable(obj *NamespaceA__NamespaceB.TableInNestedNS) *NamespaceA__NamespaceB.TableInNestedNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(NamespaceA__NamespaceB.TableInNestedNS)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) FooEnum() NamespaceA__NamespaceB.EnumInNestedNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||
if o != 0 {
|
||||
return NamespaceA__NamespaceB.EnumInNestedNS(rcv._tab.GetInt8(o + rcv._tab.Pos))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) MutateFooEnum(n NamespaceA__NamespaceB.EnumInNestedNS) bool {
|
||||
return rcv._tab.MutateInt8Slot(6, int8(n))
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) FooUnionType() NamespaceA__NamespaceB.UnionInNestedNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
|
||||
if o != 0 {
|
||||
return NamespaceA__NamespaceB.UnionInNestedNS(rcv._tab.GetByte(o + rcv._tab.Pos))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) MutateFooUnionType(n NamespaceA__NamespaceB.UnionInNestedNS) bool {
|
||||
return rcv._tab.MutateByteSlot(8, byte(n))
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) FooUnion(obj *flatbuffers.Table) bool {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
|
||||
if o != 0 {
|
||||
rcv._tab.Union(obj, o)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (rcv *TableInFirstNS) FooStruct(obj *NamespaceA__NamespaceB.StructInNestedNS) *NamespaceA__NamespaceB.StructInNestedNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
|
||||
if o != 0 {
|
||||
x := o + rcv._tab.Pos
|
||||
if obj == nil {
|
||||
obj = new(NamespaceA__NamespaceB.StructInNestedNS)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func TableInFirstNSStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(5)
|
||||
}
|
||||
func TableInFirstNSAddFooTable(builder *flatbuffers.Builder, fooTable flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(fooTable), 0)
|
||||
}
|
||||
func TableInFirstNSAddFooEnum(builder *flatbuffers.Builder, fooEnum NamespaceA__NamespaceB.EnumInNestedNS) {
|
||||
builder.PrependInt8Slot(1, int8(fooEnum), 0)
|
||||
}
|
||||
func TableInFirstNSAddFooUnionType(builder *flatbuffers.Builder, fooUnionType NamespaceA__NamespaceB.UnionInNestedNS) {
|
||||
builder.PrependByteSlot(2, byte(fooUnionType), 0)
|
||||
}
|
||||
func TableInFirstNSAddFooUnion(builder *flatbuffers.Builder, fooUnion flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(fooUnion), 0)
|
||||
}
|
||||
func TableInFirstNSAddFooStruct(builder *flatbuffers.Builder, fooStruct flatbuffers.UOffsetT) {
|
||||
builder.PrependStructSlot(4, flatbuffers.UOffsetT(fooStruct), 0)
|
||||
}
|
||||
func TableInFirstNSEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class TableInFirstNS extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
|
||||
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS 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 TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNS fooTable() { return fooTable(new NamespaceA.NamespaceB.TableInNestedNS()); }
|
||||
public NamespaceA.NamespaceB.TableInNestedNS fooTable(NamespaceA.NamespaceB.TableInNestedNS obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public byte fooEnum() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public boolean mutateFooEnum(byte foo_enum) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, foo_enum); return true; } else { return false; } }
|
||||
public byte fooUnionType() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public Table fooUnion(Table obj) { int o = __offset(10); return o != 0 ? __union(obj, o + bb_pos) : null; }
|
||||
public NamespaceA.NamespaceB.StructInNestedNS fooStruct() { return fooStruct(new NamespaceA.NamespaceB.StructInNestedNS()); }
|
||||
public NamespaceA.NamespaceB.StructInNestedNS fooStruct(NamespaceA.NamespaceB.StructInNestedNS obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
|
||||
|
||||
public static void startTableInFirstNS(FlatBufferBuilder builder) { builder.startTable(5); }
|
||||
public static void addFooTable(FlatBufferBuilder builder, int fooTableOffset) { builder.addOffset(0, fooTableOffset, 0); }
|
||||
public static void addFooEnum(FlatBufferBuilder builder, byte fooEnum) { builder.addByte(1, fooEnum, 0); }
|
||||
public static void addFooUnionType(FlatBufferBuilder builder, byte fooUnionType) { builder.addByte(2, fooUnionType, 0); }
|
||||
public static void addFooUnion(FlatBufferBuilder builder, int fooUnionOffset) { builder.addOffset(3, fooUnionOffset, 0); }
|
||||
public static void addFooStruct(FlatBufferBuilder builder, int fooStructOffset) { builder.addStruct(4, fooStructOffset, 0); }
|
||||
public static int endTableInFirstNS(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 TableInFirstNS get(int j) { return get(new TableInFirstNS(), j); }
|
||||
public TableInFirstNS get(TableInFirstNS obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public TableInFirstNST unpack() {
|
||||
TableInFirstNST _o = new TableInFirstNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(TableInFirstNST _o) {
|
||||
if (fooTable() != null) _o.setFooTable(fooTable().unpack());
|
||||
else _o.setFooTable(null);
|
||||
byte _oFooEnum = fooEnum();
|
||||
_o.setFooEnum(_oFooEnum);
|
||||
NamespaceA.NamespaceB.UnionInNestedNSUnion _oFooUnion = new NamespaceA.NamespaceB.UnionInNestedNSUnion();
|
||||
byte _oFooUnionType = fooUnionType();
|
||||
_oFooUnion.setType(_oFooUnionType);
|
||||
Table _oFooUnionValue;
|
||||
switch (_oFooUnionType) {
|
||||
case NamespaceA.NamespaceB.UnionInNestedNS.TableInNestedNS:
|
||||
_oFooUnionValue = fooUnion(new NamespaceA.NamespaceB.TableInNestedNS());
|
||||
_oFooUnion.setValue(_oFooUnionValue != null ? ((NamespaceA.NamespaceB.TableInNestedNS) _oFooUnionValue).unpack() : null);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
_o.setFooUnion(_oFooUnion);
|
||||
if (fooStruct() != null) fooStruct().unpackTo(_o.getFooStruct());
|
||||
else _o.setFooStruct(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, TableInFirstNST _o) {
|
||||
if (_o == null) return 0;
|
||||
int _foo_table = _o.getFooTable() == null ? 0 : NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.getFooTable());
|
||||
byte _fooUnionType = _o.getFooUnion() == null ? NamespaceA.NamespaceB.UnionInNestedNS.NONE : _o.getFooUnion().getType();
|
||||
int _fooUnion = _o.getFooUnion() == null ? 0 : NamespaceA.NamespaceB.UnionInNestedNSUnion.pack(builder, _o.getFooUnion());
|
||||
startTableInFirstNS(builder);
|
||||
addFooTable(builder, _foo_table);
|
||||
addFooEnum(builder, _o.getFooEnum());
|
||||
addFooUnionType(builder, _fooUnionType);
|
||||
addFooUnion(builder, _fooUnion);
|
||||
addFooStruct(builder, NamespaceA.NamespaceB.StructInNestedNS.pack(builder, _o.getFooStruct()));
|
||||
return endTableInFirstNS(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA
|
||||
|
||||
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 TableInFirstNS : Table() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : TableInFirstNS {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val fooTable : NamespaceA.NamespaceB.TableInNestedNS? get() = fooTable(NamespaceA.NamespaceB.TableInNestedNS())
|
||||
fun fooTable(obj: NamespaceA.NamespaceB.TableInNestedNS) : NamespaceA.NamespaceB.TableInNestedNS? {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
obj.__assign(__indirect(o + bb_pos), bb)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
val fooEnum : Byte
|
||||
get() {
|
||||
val o = __offset(6)
|
||||
return if(o != 0) bb.get(o + bb_pos) else 0
|
||||
}
|
||||
fun mutateFooEnum(fooEnum: Byte) : Boolean {
|
||||
val o = __offset(6)
|
||||
return if (o != 0) {
|
||||
bb.put(o + bb_pos, fooEnum)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
val fooUnionType : UByte
|
||||
get() {
|
||||
val o = __offset(8)
|
||||
return if(o != 0) bb.get(o + bb_pos).toUByte() else 0u
|
||||
}
|
||||
fun mutateFooUnionType(fooUnionType: UByte) : Boolean {
|
||||
val o = __offset(8)
|
||||
return if (o != 0) {
|
||||
bb.put(o + bb_pos, fooUnionType.toByte())
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
fun fooUnion(obj: Table) : Table? {
|
||||
val o = __offset(10); return if (o != 0) __union(obj, o + bb_pos) else null
|
||||
}
|
||||
val fooStruct : NamespaceA.NamespaceB.StructInNestedNS? get() = fooStruct(NamespaceA.NamespaceB.StructInNestedNS())
|
||||
fun fooStruct(obj: NamespaceA.NamespaceB.StructInNestedNS) : NamespaceA.NamespaceB.StructInNestedNS? {
|
||||
val o = __offset(12)
|
||||
return if (o != 0) {
|
||||
obj.__assign(o + bb_pos, bb)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_24_3_25()
|
||||
fun getRootAsTableInFirstNS(_bb: ByteBuffer): TableInFirstNS = getRootAsTableInFirstNS(_bb, TableInFirstNS())
|
||||
fun getRootAsTableInFirstNS(_bb: ByteBuffer, obj: TableInFirstNS): TableInFirstNS {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
fun startTableInFirstNS(builder: FlatBufferBuilder) = builder.startTable(5)
|
||||
fun addFooTable(builder: FlatBufferBuilder, fooTable: Int) = builder.addOffset(0, fooTable, 0)
|
||||
fun addFooEnum(builder: FlatBufferBuilder, fooEnum: Byte) = builder.addByte(1, fooEnum, 0)
|
||||
fun addFooUnionType(builder: FlatBufferBuilder, fooUnionType: UByte) = builder.addByte(2, fooUnionType.toByte(), 0)
|
||||
fun addFooUnion(builder: FlatBufferBuilder, fooUnion: Int) = builder.addOffset(3, fooUnion, 0)
|
||||
fun addFooStruct(builder: FlatBufferBuilder, fooStruct: Int) = builder.addStruct(4, fooStruct, 0)
|
||||
fun endTableInFirstNS(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceA
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local TableInFirstNS = {} -- the module
|
||||
local TableInFirstNS_mt = {} -- the class metatable
|
||||
|
||||
function TableInFirstNS.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = TableInFirstNS_mt})
|
||||
return o
|
||||
end
|
||||
function TableInFirstNS.GetRootAsTableInFirstNS(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
end
|
||||
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
|
||||
local o = TableInFirstNS.New()
|
||||
o:Init(buf, n + offset)
|
||||
return o
|
||||
end
|
||||
function TableInFirstNS_mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
function TableInFirstNS_mt:FooTable()
|
||||
local o = self.view:Offset(4)
|
||||
if o ~= 0 then
|
||||
local x = self.view:Indirect(o + self.view.pos)
|
||||
local obj = require('NamespaceA.NamespaceB.TableInNestedNS').New()
|
||||
obj:Init(self.view.bytes, x)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function TableInFirstNS_mt:FooEnum()
|
||||
local o = self.view:Offset(6)
|
||||
if o ~= 0 then
|
||||
return self.view:Get(flatbuffers.N.Int8, o + self.view.pos)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function TableInFirstNS_mt:FooUnionType()
|
||||
local o = self.view:Offset(8)
|
||||
if o ~= 0 then
|
||||
return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function TableInFirstNS_mt:FooUnion()
|
||||
local o = self.view:Offset(10)
|
||||
if o ~= 0 then
|
||||
local obj = flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0)
|
||||
self.view:Union(obj, o)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function TableInFirstNS_mt:FooStruct()
|
||||
local o = self.view:Offset(12)
|
||||
if o ~= 0 then
|
||||
local x = o + self.view.pos
|
||||
local obj = require('NamespaceA.NamespaceB.StructInNestedNS').New()
|
||||
obj:Init(self.view.bytes, x)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function TableInFirstNS.Start(builder) builder:StartObject(5) end
|
||||
function TableInFirstNS.AddFooTable(builder, fooTable) builder:PrependUOffsetTRelativeSlot(0, fooTable, 0) end
|
||||
function TableInFirstNS.AddFooEnum(builder, fooEnum) builder:PrependInt8Slot(1, fooEnum, 0) end
|
||||
function TableInFirstNS.AddFooUnionType(builder, fooUnionType) builder:PrependUint8Slot(2, fooUnionType, 0) end
|
||||
function TableInFirstNS.AddFooUnion(builder, fooUnion) builder:PrependUOffsetTRelativeSlot(3, fooUnion, 0) end
|
||||
function TableInFirstNS.AddFooStruct(builder, fooStruct) builder:PrependStructSlot(4, fooStruct, 0) end
|
||||
function TableInFirstNS.End(builder) return builder:EndObject() end
|
||||
|
||||
return TableInFirstNS -- return the module
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceA;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class TableInFirstNS extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return TableInFirstNS
|
||||
*/
|
||||
public static function getRootAsTableInFirstNS(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new TableInFirstNS();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return TableInFirstNS
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFooTable()
|
||||
{
|
||||
$obj = new TableInNestedNS();
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return sbyte
|
||||
*/
|
||||
public function getFooEnum()
|
||||
{
|
||||
$o = $this->__offset(6);
|
||||
return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : \NamespaceA\NamespaceB\EnumInNestedNS::A;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return byte
|
||||
*/
|
||||
public function getFooUnionType()
|
||||
{
|
||||
$o = $this->__offset(8);
|
||||
return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \NamespaceA\NamespaceB\UnionInNestedNS::NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returnint
|
||||
*/
|
||||
public function getFooUnion($obj)
|
||||
{
|
||||
$o = $this->__offset(10);
|
||||
return $o != 0 ? $this->__union($obj, $o) : null;
|
||||
}
|
||||
|
||||
public function getFooStruct()
|
||||
{
|
||||
$obj = new StructInNestedNS();
|
||||
$o = $this->__offset(12);
|
||||
return $o != 0 ? $obj->init($o + $this->bb_pos, $this->bb) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startTableInFirstNS(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return TableInFirstNS
|
||||
*/
|
||||
public static function createTableInFirstNS(FlatBufferBuilder $builder, $foo_table, $foo_enum, $foo_union_type, $foo_union, $foo_struct)
|
||||
{
|
||||
$builder->startObject(5);
|
||||
self::addFooTable($builder, $foo_table);
|
||||
self::addFooEnum($builder, $foo_enum);
|
||||
self::addFooUnionType($builder, $foo_union_type);
|
||||
self::addFooUnion($builder, $foo_union);
|
||||
self::addFooStruct($builder, $foo_struct);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addFooTable(FlatBufferBuilder $builder, $fooTable)
|
||||
{
|
||||
$builder->addOffsetX(0, $fooTable, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param sbyte
|
||||
* @return void
|
||||
*/
|
||||
public static function addFooEnum(FlatBufferBuilder $builder, $fooEnum)
|
||||
{
|
||||
$builder->addSbyteX(1, $fooEnum, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param byte
|
||||
* @return void
|
||||
*/
|
||||
public static function addFooUnionType(FlatBufferBuilder $builder, $fooUnionType)
|
||||
{
|
||||
$builder->addByteX(2, $fooUnionType, 0);
|
||||
}
|
||||
|
||||
public static function addFooUnion(FlatBufferBuilder $builder, $offset)
|
||||
{
|
||||
$builder->addOffsetX(3, $offset, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addFooStruct(FlatBufferBuilder $builder, $fooStruct)
|
||||
{
|
||||
$builder->addStructX(4, $fooStruct, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endTableInFirstNS(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceA
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class TableInFirstNS(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TableInFirstNS()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsTableInFirstNS(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# TableInFirstNS
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TableInFirstNS
|
||||
def FooTable(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
obj = TableInNestedNS()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
# TableInFirstNS
|
||||
def FooEnum(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TableInFirstNS
|
||||
def FooUnionType(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TableInFirstNS
|
||||
def FooUnion(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
||||
if o != 0:
|
||||
from flatbuffers.table import Table
|
||||
obj = Table(bytearray(), 0)
|
||||
self._tab.Union(obj, o)
|
||||
return obj
|
||||
return None
|
||||
|
||||
# TableInFirstNS
|
||||
def FooStruct(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
||||
if o != 0:
|
||||
x = o + self._tab.Pos
|
||||
obj = StructInNestedNS()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def TableInFirstNSStart(builder): builder.StartObject(5)
|
||||
def Start(builder):
|
||||
return TableInFirstNSStart(builder)
|
||||
def TableInFirstNSAddFooTable(builder, fooTable): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(fooTable), 0)
|
||||
def AddFooTable(builder, fooTable):
|
||||
return TableInFirstNSAddFooTable(builder, fooTable)
|
||||
def TableInFirstNSAddFooEnum(builder, fooEnum): builder.PrependInt8Slot(1, fooEnum, 0)
|
||||
def AddFooEnum(builder, fooEnum):
|
||||
return TableInFirstNSAddFooEnum(builder, fooEnum)
|
||||
def TableInFirstNSAddFooUnionType(builder, fooUnionType): builder.PrependUint8Slot(2, fooUnionType, 0)
|
||||
def AddFooUnionType(builder, fooUnionType):
|
||||
return TableInFirstNSAddFooUnionType(builder, fooUnionType)
|
||||
def TableInFirstNSAddFooUnion(builder, fooUnion): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fooUnion), 0)
|
||||
def AddFooUnion(builder, fooUnion):
|
||||
return TableInFirstNSAddFooUnion(builder, fooUnion)
|
||||
def TableInFirstNSAddFooStruct(builder, fooStruct): builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(fooStruct), 0)
|
||||
def AddFooStruct(builder, fooStruct):
|
||||
return TableInFirstNSAddFooStruct(builder, fooStruct)
|
||||
def TableInFirstNSEnd(builder): return builder.EndObject()
|
||||
def End(builder):
|
||||
return TableInFirstNSEnd(builder)
|
||||
try:
|
||||
from typing import Optional, Union
|
||||
except:
|
||||
pass
|
||||
|
||||
class TableInFirstNST(object):
|
||||
|
||||
# TableInFirstNST
|
||||
def __init__(self):
|
||||
self.fooTable = None # type: Optional[TableInNestedNST]
|
||||
self.fooEnum = 0 # type: int
|
||||
self.fooUnionType = 0 # type: int
|
||||
self.fooUnion = None # type: Union[None, TableInNestedNST]
|
||||
self.fooStruct = None # type: Optional[StructInNestedNST]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
tableInFirstNS = TableInFirstNS()
|
||||
tableInFirstNS.Init(buf, pos)
|
||||
return cls.InitFromObj(tableInFirstNS)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, tableInFirstNS):
|
||||
x = TableInFirstNST()
|
||||
x._UnPack(tableInFirstNS)
|
||||
return x
|
||||
|
||||
# TableInFirstNST
|
||||
def _UnPack(self, tableInFirstNS):
|
||||
if tableInFirstNS is None:
|
||||
return
|
||||
if tableInFirstNS.FooTable() is not None:
|
||||
self.fooTable = TableInNestedNST.InitFromObj(tableInFirstNS.FooTable())
|
||||
self.fooEnum = tableInFirstNS.FooEnum()
|
||||
self.fooUnionType = tableInFirstNS.FooUnionType()
|
||||
self.fooUnion = UnionInNestedNSCreator(self.fooUnionType, tableInFirstNS.FooUnion())
|
||||
if tableInFirstNS.FooStruct() is not None:
|
||||
self.fooStruct = StructInNestedNST.InitFromObj(tableInFirstNS.FooStruct())
|
||||
|
||||
# TableInFirstNST
|
||||
def Pack(self, builder):
|
||||
if self.fooTable is not None:
|
||||
fooTable = self.fooTable.Pack(builder)
|
||||
if self.fooUnion is not None:
|
||||
fooUnion = self.fooUnion.Pack(builder)
|
||||
TableInFirstNSStart(builder)
|
||||
if self.fooTable is not None:
|
||||
TableInFirstNSAddFooTable(builder, fooTable)
|
||||
TableInFirstNSAddFooEnum(builder, self.fooEnum)
|
||||
TableInFirstNSAddFooUnionType(builder, self.fooUnionType)
|
||||
if self.fooUnion is not None:
|
||||
TableInFirstNSAddFooUnion(builder, fooUnion)
|
||||
if self.fooStruct is not None:
|
||||
fooStruct = self.fooStruct.Pack(builder)
|
||||
TableInFirstNSAddFooStruct(builder, fooStruct)
|
||||
tableInFirstNS = TableInFirstNSEnd(builder)
|
||||
return tableInFirstNS
|
||||
@@ -0,0 +1,40 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class TableInFirstNST {
|
||||
private NamespaceA.NamespaceB.TableInNestedNST fooTable;
|
||||
private byte fooEnum;
|
||||
private NamespaceA.NamespaceB.UnionInNestedNSUnion fooUnion;
|
||||
private NamespaceA.NamespaceB.StructInNestedNST fooStruct;
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNST getFooTable() { return fooTable; }
|
||||
|
||||
public void setFooTable(NamespaceA.NamespaceB.TableInNestedNST fooTable) { this.fooTable = fooTable; }
|
||||
|
||||
public byte getFooEnum() { return fooEnum; }
|
||||
|
||||
public void setFooEnum(byte fooEnum) { this.fooEnum = fooEnum; }
|
||||
|
||||
public NamespaceA.NamespaceB.UnionInNestedNSUnion getFooUnion() { return fooUnion; }
|
||||
|
||||
public void setFooUnion(NamespaceA.NamespaceB.UnionInNestedNSUnion fooUnion) { this.fooUnion = fooUnion; }
|
||||
|
||||
public NamespaceA.NamespaceB.StructInNestedNST getFooStruct() { return fooStruct; }
|
||||
|
||||
public void setFooStruct(NamespaceA.NamespaceB.StructInNestedNST fooStruct) { this.fooStruct = fooStruct; }
|
||||
|
||||
|
||||
public TableInFirstNST() {
|
||||
this.fooTable = null;
|
||||
this.fooEnum = 0;
|
||||
this.fooUnion = null;
|
||||
this.fooStruct = new NamespaceA.NamespaceB.StructInNestedNST();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace NamespaceC
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct TableInC : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); }
|
||||
public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceA.TableInFirstNS? ReferToA1 { get { int o = __p.__offset(4); return o != 0 ? (NamespaceA.TableInFirstNS?)(new NamespaceA.TableInFirstNS()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
|
||||
public NamespaceA.SecondTableInA? ReferToA2 { get { int o = __p.__offset(6); return o != 0 ? (NamespaceA.SecondTableInA?)(new NamespaceA.SecondTableInA()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
|
||||
|
||||
public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder,
|
||||
Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>),
|
||||
Offset<NamespaceA.SecondTableInA> refer_to_a2Offset = default(Offset<NamespaceA.SecondTableInA>)) {
|
||||
builder.StartTable(2);
|
||||
TableInC.AddReferToA2(builder, refer_to_a2Offset);
|
||||
TableInC.AddReferToA1(builder, refer_to_a1Offset);
|
||||
return TableInC.EndTableInC(builder);
|
||||
}
|
||||
|
||||
public static void StartTableInC(FlatBufferBuilder builder) { builder.StartTable(2); }
|
||||
public static void AddReferToA1(FlatBufferBuilder builder, Offset<NamespaceA.TableInFirstNS> referToA1Offset) { builder.AddOffset(0, referToA1Offset.Value, 0); }
|
||||
public static void AddReferToA2(FlatBufferBuilder builder, Offset<NamespaceA.SecondTableInA> referToA2Offset) { builder.AddOffset(1, referToA2Offset.Value, 0); }
|
||||
public static Offset<NamespaceC.TableInC> EndTableInC(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<NamespaceC.TableInC>(o);
|
||||
}
|
||||
public TableInCT UnPack() {
|
||||
var _o = new TableInCT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(TableInCT _o) {
|
||||
_o.ReferToA1 = this.ReferToA1.HasValue ? this.ReferToA1.Value.UnPack() : null;
|
||||
_o.ReferToA2 = this.ReferToA2.HasValue ? this.ReferToA2.Value.UnPack() : null;
|
||||
}
|
||||
public static Offset<NamespaceC.TableInC> Pack(FlatBufferBuilder builder, TableInCT _o) {
|
||||
if (_o == null) return default(Offset<NamespaceC.TableInC>);
|
||||
var _refer_to_a1 = _o.ReferToA1 == null ? default(Offset<NamespaceA.TableInFirstNS>) : NamespaceA.TableInFirstNS.Pack(builder, _o.ReferToA1);
|
||||
var _refer_to_a2 = _o.ReferToA2 == null ? default(Offset<NamespaceA.SecondTableInA>) : NamespaceA.SecondTableInA.Pack(builder, _o.ReferToA2);
|
||||
return CreateTableInC(
|
||||
builder,
|
||||
_refer_to_a1,
|
||||
_refer_to_a2);
|
||||
}
|
||||
}
|
||||
|
||||
public class TableInCT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("refer_to_a1")]
|
||||
public NamespaceA.TableInFirstNST ReferToA1 { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("refer_to_a2")]
|
||||
public NamespaceA.SecondTableInAT ReferToA2 { get; set; }
|
||||
|
||||
public TableInCT() {
|
||||
this.ReferToA1 = null;
|
||||
this.ReferToA2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class TableInCVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyTable(tablePos, 4 /*ReferToA1*/, NamespaceA.TableInFirstNSVerify.Verify, false)
|
||||
&& verifier.VerifyTable(tablePos, 6 /*ReferToA2*/, NamespaceA.SecondTableInAVerify.Verify, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceC
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
|
||||
NamespaceA "NamespaceA"
|
||||
)
|
||||
|
||||
type TableInCT struct {
|
||||
ReferToA1 *NamespaceA.TableInFirstNST
|
||||
ReferToA2 *NamespaceA.SecondTableInAT
|
||||
}
|
||||
|
||||
func (t *TableInCT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
referToA1Offset := t.ReferToA1.Pack(builder)
|
||||
referToA2Offset := t.ReferToA2.Pack(builder)
|
||||
TableInCStart(builder)
|
||||
TableInCAddReferToA1(builder, referToA1Offset)
|
||||
TableInCAddReferToA2(builder, referToA2Offset)
|
||||
return TableInCEnd(builder)
|
||||
}
|
||||
|
||||
func (rcv *TableInC) UnPackTo(t *TableInCT) {
|
||||
t.ReferToA1 = rcv.ReferToA1(nil).UnPack()
|
||||
t.ReferToA2 = rcv.ReferToA2(nil).UnPack()
|
||||
}
|
||||
|
||||
func (rcv *TableInC) UnPack() *TableInCT {
|
||||
if rcv == nil { return nil }
|
||||
t := &TableInCT{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type TableInC struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsTableInC(buf []byte, offset flatbuffers.UOffsetT) *TableInC {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &TableInC{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsTableInC(buf []byte, offset flatbuffers.UOffsetT) *TableInC {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &TableInC{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func (rcv *TableInC) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *TableInC) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *TableInC) ReferToA1(obj *NamespaceA.TableInFirstNS) *NamespaceA.TableInFirstNS {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(NamespaceA.TableInFirstNS)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcv *TableInC) ReferToA2(obj *NamespaceA.SecondTableInA) *NamespaceA.SecondTableInA {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(NamespaceA.SecondTableInA)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func TableInCStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(2)
|
||||
}
|
||||
func TableInCAddReferToA1(builder *flatbuffers.Builder, referToA1 flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(referToA1), 0)
|
||||
}
|
||||
func TableInCAddReferToA2(builder *flatbuffers.Builder, referToA2 flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(referToA2), 0)
|
||||
}
|
||||
func TableInCEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceC;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class TableInC extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); }
|
||||
public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC 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 TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public NamespaceA.TableInFirstNS referToA1() { return referToA1(new NamespaceA.TableInFirstNS()); }
|
||||
public NamespaceA.TableInFirstNS referToA1(NamespaceA.TableInFirstNS obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public NamespaceA.SecondTableInA referToA2() { return referToA2(new NamespaceA.SecondTableInA()); }
|
||||
public NamespaceA.SecondTableInA referToA2(NamespaceA.SecondTableInA obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static int createTableInC(FlatBufferBuilder builder,
|
||||
int referToA1Offset,
|
||||
int referToA2Offset) {
|
||||
builder.startTable(2);
|
||||
TableInC.addReferToA2(builder, referToA2Offset);
|
||||
TableInC.addReferToA1(builder, referToA1Offset);
|
||||
return TableInC.endTableInC(builder);
|
||||
}
|
||||
|
||||
public static void startTableInC(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addReferToA1(FlatBufferBuilder builder, int referToA1Offset) { builder.addOffset(0, referToA1Offset, 0); }
|
||||
public static void addReferToA2(FlatBufferBuilder builder, int referToA2Offset) { builder.addOffset(1, referToA2Offset, 0); }
|
||||
public static int endTableInC(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 TableInC get(int j) { return get(new TableInC(), j); }
|
||||
public TableInC get(TableInC obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public TableInCT unpack() {
|
||||
TableInCT _o = new TableInCT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(TableInCT _o) {
|
||||
if (referToA1() != null) _o.setReferToA1(referToA1().unpack());
|
||||
else _o.setReferToA1(null);
|
||||
if (referToA2() != null) _o.setReferToA2(referToA2().unpack());
|
||||
else _o.setReferToA2(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, TableInCT _o) {
|
||||
if (_o == null) return 0;
|
||||
int _refer_to_a1 = _o.getReferToA1() == null ? 0 : NamespaceA.TableInFirstNS.pack(builder, _o.getReferToA1());
|
||||
int _refer_to_a2 = _o.getReferToA2() == null ? 0 : NamespaceA.SecondTableInA.pack(builder, _o.getReferToA2());
|
||||
return createTableInC(
|
||||
builder,
|
||||
_refer_to_a1,
|
||||
_refer_to_a2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceC
|
||||
|
||||
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 TableInC : Table() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : TableInC {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val referToA1 : NamespaceA.TableInFirstNS? get() = referToA1(NamespaceA.TableInFirstNS())
|
||||
fun referToA1(obj: NamespaceA.TableInFirstNS) : NamespaceA.TableInFirstNS? {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
obj.__assign(__indirect(o + bb_pos), bb)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
val referToA2 : NamespaceA.SecondTableInA? get() = referToA2(NamespaceA.SecondTableInA())
|
||||
fun referToA2(obj: NamespaceA.SecondTableInA) : NamespaceA.SecondTableInA? {
|
||||
val o = __offset(6)
|
||||
return if (o != 0) {
|
||||
obj.__assign(__indirect(o + bb_pos), bb)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_24_3_25()
|
||||
fun getRootAsTableInC(_bb: ByteBuffer): TableInC = getRootAsTableInC(_bb, TableInC())
|
||||
fun getRootAsTableInC(_bb: ByteBuffer, obj: TableInC): TableInC {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
fun createTableInC(builder: FlatBufferBuilder, referToA1Offset: Int, referToA2Offset: Int) : Int {
|
||||
builder.startTable(2)
|
||||
addReferToA2(builder, referToA2Offset)
|
||||
addReferToA1(builder, referToA1Offset)
|
||||
return endTableInC(builder)
|
||||
}
|
||||
fun startTableInC(builder: FlatBufferBuilder) = builder.startTable(2)
|
||||
fun addReferToA1(builder: FlatBufferBuilder, referToA1: Int) = builder.addOffset(0, referToA1, 0)
|
||||
fun addReferToA2(builder: FlatBufferBuilder, referToA2: Int) = builder.addOffset(1, referToA2, 0)
|
||||
fun endTableInC(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
-- automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
-- namespace: NamespaceC
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local TableInC = {} -- the module
|
||||
local TableInC_mt = {} -- the class metatable
|
||||
|
||||
function TableInC.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = TableInC_mt})
|
||||
return o
|
||||
end
|
||||
function TableInC.GetRootAsTableInC(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
end
|
||||
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
|
||||
local o = TableInC.New()
|
||||
o:Init(buf, n + offset)
|
||||
return o
|
||||
end
|
||||
function TableInC_mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
function TableInC_mt:ReferToA1()
|
||||
local o = self.view:Offset(4)
|
||||
if o ~= 0 then
|
||||
local x = self.view:Indirect(o + self.view.pos)
|
||||
local obj = require('NamespaceA.TableInFirstNS').New()
|
||||
obj:Init(self.view.bytes, x)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function TableInC_mt:ReferToA2()
|
||||
local o = self.view:Offset(6)
|
||||
if o ~= 0 then
|
||||
local x = self.view:Indirect(o + self.view.pos)
|
||||
local obj = require('NamespaceA.SecondTableInA').New()
|
||||
obj:Init(self.view.bytes, x)
|
||||
return obj
|
||||
end
|
||||
end
|
||||
function TableInC.Start(builder) builder:StartObject(2) end
|
||||
function TableInC.AddReferToA1(builder, referToA1) builder:PrependUOffsetTRelativeSlot(0, referToA1, 0) end
|
||||
function TableInC.AddReferToA2(builder, referToA2) builder:PrependUOffsetTRelativeSlot(1, referToA2, 0) end
|
||||
function TableInC.End(builder) return builder:EndObject() end
|
||||
|
||||
return TableInC -- return the module
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace NamespaceC;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class TableInC extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return TableInC
|
||||
*/
|
||||
public static function getRootAsTableInC(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new TableInC();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return TableInC
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReferToA1()
|
||||
{
|
||||
$obj = new TableInFirstNS();
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
public function getReferToA2()
|
||||
{
|
||||
$obj = new SecondTableInA();
|
||||
$o = $this->__offset(6);
|
||||
return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startTableInC(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return TableInC
|
||||
*/
|
||||
public static function createTableInC(FlatBufferBuilder $builder, $refer_to_a1, $refer_to_a2)
|
||||
{
|
||||
$builder->startObject(2);
|
||||
self::addReferToA1($builder, $refer_to_a1);
|
||||
self::addReferToA2($builder, $refer_to_a2);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addReferToA1(FlatBufferBuilder $builder, $referToA1)
|
||||
{
|
||||
$builder->addOffsetX(0, $referToA1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addReferToA2(FlatBufferBuilder $builder, $referToA2)
|
||||
{
|
||||
$builder->addOffsetX(1, $referToA2, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endTableInC(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NamespaceC
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class TableInC(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TableInC()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsTableInC(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# TableInC
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TableInC
|
||||
def ReferToA1(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
obj = TableInFirstNS()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
# TableInC
|
||||
def ReferToA2(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
obj = SecondTableInA()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def TableInCStart(builder): builder.StartObject(2)
|
||||
def Start(builder):
|
||||
return TableInCStart(builder)
|
||||
def TableInCAddReferToA1(builder, referToA1): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToA1), 0)
|
||||
def AddReferToA1(builder, referToA1):
|
||||
return TableInCAddReferToA1(builder, referToA1)
|
||||
def TableInCAddReferToA2(builder, referToA2): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(referToA2), 0)
|
||||
def AddReferToA2(builder, referToA2):
|
||||
return TableInCAddReferToA2(builder, referToA2)
|
||||
def TableInCEnd(builder): return builder.EndObject()
|
||||
def End(builder):
|
||||
return TableInCEnd(builder)
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
class TableInCT(object):
|
||||
|
||||
# TableInCT
|
||||
def __init__(self):
|
||||
self.referToA1 = None # type: Optional[TableInFirstNST]
|
||||
self.referToA2 = None # type: Optional[SecondTableInAT]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
tableInC = TableInC()
|
||||
tableInC.Init(buf, pos)
|
||||
return cls.InitFromObj(tableInC)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, tableInC):
|
||||
x = TableInCT()
|
||||
x._UnPack(tableInC)
|
||||
return x
|
||||
|
||||
# TableInCT
|
||||
def _UnPack(self, tableInC):
|
||||
if tableInC is None:
|
||||
return
|
||||
if tableInC.ReferToA1() is not None:
|
||||
self.referToA1 = TableInFirstNST.InitFromObj(tableInC.ReferToA1())
|
||||
if tableInC.ReferToA2() is not None:
|
||||
self.referToA2 = SecondTableInAT.InitFromObj(tableInC.ReferToA2())
|
||||
|
||||
# TableInCT
|
||||
def Pack(self, builder):
|
||||
if self.referToA1 is not None:
|
||||
referToA1 = self.referToA1.Pack(builder)
|
||||
if self.referToA2 is not None:
|
||||
referToA2 = self.referToA2.Pack(builder)
|
||||
TableInCStart(builder)
|
||||
if self.referToA1 is not None:
|
||||
TableInCAddReferToA1(builder, referToA1)
|
||||
if self.referToA2 is not None:
|
||||
TableInCAddReferToA2(builder, referToA2)
|
||||
tableInC = TableInCEnd(builder)
|
||||
return tableInC
|
||||
@@ -0,0 +1,28 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceC;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class TableInCT {
|
||||
private NamespaceA.TableInFirstNST referToA1;
|
||||
private NamespaceA.SecondTableInAT referToA2;
|
||||
|
||||
public NamespaceA.TableInFirstNST getReferToA1() { return referToA1; }
|
||||
|
||||
public void setReferToA1(NamespaceA.TableInFirstNST referToA1) { this.referToA1 = referToA1; }
|
||||
|
||||
public NamespaceA.SecondTableInAT getReferToA2() { return referToA2; }
|
||||
|
||||
public void setReferToA2(NamespaceA.SecondTableInAT referToA2) { this.referToA2 = referToA2; }
|
||||
|
||||
|
||||
public TableInCT() {
|
||||
this.referToA1 = null;
|
||||
this.referToA2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// Automatically generated by the Flatbuffers compiler. Do not modify.
|
||||
// @generated
|
||||
pub mod namespace_a {
|
||||
use super::*;
|
||||
pub mod namespace_b {
|
||||
use super::*;
|
||||
mod union_in_nested_ns_generated;
|
||||
pub use self::union_in_nested_ns_generated::*;
|
||||
mod enum_in_nested_ns_generated;
|
||||
pub use self::enum_in_nested_ns_generated::*;
|
||||
mod table_in_nested_ns_generated;
|
||||
pub use self::table_in_nested_ns_generated::*;
|
||||
mod struct_in_nested_ns_generated;
|
||||
pub use self::struct_in_nested_ns_generated::*;
|
||||
} // namespace_b
|
||||
mod table_in_first_ns_generated;
|
||||
pub use self::table_in_first_ns_generated::*;
|
||||
mod second_table_in_a_generated;
|
||||
pub use self::second_table_in_a_generated::*;
|
||||
} // namespace_a
|
||||
pub mod namespace_c {
|
||||
use super::*;
|
||||
mod table_in_c_generated;
|
||||
pub use self::table_in_c_generated::*;
|
||||
} // namespace_c
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [
|
||||
EnumInNestedNS::A,
|
||||
EnumInNestedNS::B,
|
||||
EnumInNestedNS::C,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct EnumInNestedNS(pub i8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl EnumInNestedNS {
|
||||
pub const A: Self = Self(0);
|
||||
pub const B: Self = Self(1);
|
||||
pub const C: Self = Self(2);
|
||||
|
||||
pub const ENUM_MIN: i8 = 0;
|
||||
pub const ENUM_MAX: i8 = 2;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::A,
|
||||
Self::B,
|
||||
Self::C,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::A => Some("A"),
|
||||
Self::B => Some("B"),
|
||||
Self::C => Some("C"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for EnumInNestedNS {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<i8>(buf, loc);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for EnumInNestedNS {
|
||||
type Output = EnumInNestedNS;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<i8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for EnumInNestedNS {
|
||||
type Scalar = i8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> i8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: i8) -> Self {
|
||||
let b = i8::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for EnumInNestedNS {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
i8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for EnumInNestedNS {}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
// struct StructInNestedNS, aligned to 4
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub struct StructInNestedNS(pub [u8; 8]);
|
||||
impl Default for StructInNestedNS {
|
||||
fn default() -> Self {
|
||||
Self([0; 8])
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for StructInNestedNS {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
f.debug_struct("StructInNestedNS")
|
||||
.field("a", &self.a())
|
||||
.field("b", &self.b())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for StructInNestedNS {}
|
||||
impl<'a> flatbuffers::Follow<'a> for StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
<&'a StructInNestedNS>::follow(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for &'a StructInNestedNS {
|
||||
type Inner = &'a StructInNestedNS;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
flatbuffers::follow_cast_ref::<StructInNestedNS>(buf, loc)
|
||||
}
|
||||
}
|
||||
impl<'b> flatbuffers::Push for StructInNestedNS {
|
||||
type Output = StructInNestedNS;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
let src = ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size());
|
||||
dst.copy_from_slice(src);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for StructInNestedNS {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.in_buffer::<Self>(pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StructInNestedNS {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
a: i32,
|
||||
b: i32,
|
||||
) -> Self {
|
||||
let mut s = Self([0; 8]);
|
||||
s.set_a(a);
|
||||
s.set_b(b);
|
||||
s
|
||||
}
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"NamespaceA.NamespaceB.StructInNestedNS"
|
||||
}
|
||||
|
||||
pub fn a(&self) -> i32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[0..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_a(&mut self, x: i32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[0..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn b(&self) -> i32 {
|
||||
let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
EndianScalar::from_little_endian(unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
self.0[4..].as_ptr(),
|
||||
mem.as_mut_ptr() as *mut u8,
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
mem.assume_init()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_b(&mut self, x: i32) {
|
||||
let x_le = x.to_little_endian();
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid value in this slot
|
||||
unsafe {
|
||||
core::ptr::copy_nonoverlapping(
|
||||
&x_le as *const _ as *const u8,
|
||||
self.0[4..].as_mut_ptr(),
|
||||
core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> StructInNestedNST {
|
||||
StructInNestedNST {
|
||||
a: self.a(),
|
||||
b: self.b(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct StructInNestedNST {
|
||||
pub a: i32,
|
||||
pub b: i32,
|
||||
}
|
||||
impl StructInNestedNST {
|
||||
pub fn pack(&self) -> StructInNestedNS {
|
||||
StructInNestedNS::new(
|
||||
self.a,
|
||||
self.b,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
third_party/flatbuffers/tests/namespace_test/namespace_a/namespace_b/table_in_nested_ns_generated.rs
Vendored
+141
@@ -0,0 +1,141 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum TableInNestedNSOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableInNestedNS<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> {
|
||||
type Inner = TableInNestedNS<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInNestedNS<'a> {
|
||||
pub const VT_FOO: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"NamespaceA.NamespaceB.TableInNestedNS"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TableInNestedNS { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableInNestedNSArgs
|
||||
) -> flatbuffers::WIPOffset<TableInNestedNS<'bldr>> {
|
||||
let mut builder = TableInNestedNSBuilder::new(_fbb);
|
||||
builder.add_foo(args.foo);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableInNestedNST {
|
||||
let foo = self.foo();
|
||||
TableInNestedNST {
|
||||
foo,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo(&self) -> i32 {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<i32>(TableInNestedNS::VT_FOO, Some(0)).unwrap()}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TableInNestedNS<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<i32>("foo", Self::VT_FOO, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableInNestedNSArgs {
|
||||
pub foo: i32,
|
||||
}
|
||||
impl<'a> Default for TableInNestedNSArgs {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInNestedNSArgs {
|
||||
foo: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInNestedNSBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInNestedNSBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_foo(&mut self, foo: i32) {
|
||||
self.fbb_.push_slot::<i32>(TableInNestedNS::VT_FOO, foo, 0);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInNestedNSBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableInNestedNSBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInNestedNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TableInNestedNS<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInNestedNS");
|
||||
ds.field("foo", &self.foo());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInNestedNST {
|
||||
pub foo: i32,
|
||||
}
|
||||
impl Default for TableInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
foo: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInNestedNST {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TableInNestedNS<'b>> {
|
||||
let foo = self.foo;
|
||||
TableInNestedNS::create(_fbb, &TableInNestedNSArgs{
|
||||
foo,
|
||||
})
|
||||
}
|
||||
}
|
||||
third_party/flatbuffers/tests/namespace_test/namespace_a/namespace_b/union_in_nested_ns_generated.rs
Vendored
+145
@@ -0,0 +1,145 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MIN_UNION_IN_NESTED_NS: u8 = 0;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
pub const ENUM_MAX_UNION_IN_NESTED_NS: u8 = 1;
|
||||
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub const ENUM_VALUES_UNION_IN_NESTED_NS: [UnionInNestedNS; 2] = [
|
||||
UnionInNestedNS::NONE,
|
||||
UnionInNestedNS::TableInNestedNS,
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
#[repr(transparent)]
|
||||
pub struct UnionInNestedNS(pub u8);
|
||||
#[allow(non_upper_case_globals)]
|
||||
impl UnionInNestedNS {
|
||||
pub const NONE: Self = Self(0);
|
||||
pub const TableInNestedNS: Self = Self(1);
|
||||
|
||||
pub const ENUM_MIN: u8 = 0;
|
||||
pub const ENUM_MAX: u8 = 1;
|
||||
pub const ENUM_VALUES: &'static [Self] = &[
|
||||
Self::NONE,
|
||||
Self::TableInNestedNS,
|
||||
];
|
||||
/// Returns the variant's name or "" if unknown.
|
||||
pub fn variant_name(self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::NONE => Some("NONE"),
|
||||
Self::TableInNestedNS => Some("TableInNestedNS"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::fmt::Debug for UnionInNestedNS {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
if let Some(name) = self.variant_name() {
|
||||
f.write_str(name)
|
||||
} else {
|
||||
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'a> flatbuffers::Follow<'a> for UnionInNestedNS {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Push for UnionInNestedNS {
|
||||
type Output = UnionInNestedNS;
|
||||
#[inline]
|
||||
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
|
||||
flatbuffers::emplace_scalar::<u8>(dst, self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::EndianScalar for UnionInNestedNS {
|
||||
type Scalar = u8;
|
||||
#[inline]
|
||||
fn to_little_endian(self) -> u8 {
|
||||
self.0.to_le()
|
||||
}
|
||||
#[inline]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn from_little_endian(v: u8) -> Self {
|
||||
let b = u8::from_le(v);
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Verifiable for UnionInNestedNS {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
u8::run_verifier(v, pos)
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::SimpleToVerifyInSlice for UnionInNestedNS {}
|
||||
pub struct UnionInNestedNSUnionTableOffset {}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum UnionInNestedNST {
|
||||
NONE,
|
||||
TableInNestedNS(Box<TableInNestedNST>),
|
||||
}
|
||||
impl Default for UnionInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self::NONE
|
||||
}
|
||||
}
|
||||
impl UnionInNestedNST {
|
||||
pub fn union_in_nested_ns_type(&self) -> UnionInNestedNS {
|
||||
match self {
|
||||
Self::NONE => UnionInNestedNS::NONE,
|
||||
Self::TableInNestedNS(_) => UnionInNestedNS::TableInNestedNS,
|
||||
}
|
||||
}
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
|
||||
match self {
|
||||
Self::NONE => None,
|
||||
Self::TableInNestedNS(v) => Some(v.pack(fbb).as_union_value()),
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
|
||||
pub fn take_table_in_nested_ns(&mut self) -> Option<Box<TableInNestedNST>> {
|
||||
if let Self::TableInNestedNS(_) = self {
|
||||
let v = core::mem::replace(self, Self::NONE);
|
||||
if let Self::TableInNestedNS(w) = v {
|
||||
Some(w)
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// If the union variant matches, return a reference to the TableInNestedNST.
|
||||
pub fn as_table_in_nested_ns(&self) -> Option<&TableInNestedNST> {
|
||||
if let Self::TableInNestedNS(v) = self { Some(v.as_ref()) } else { None }
|
||||
}
|
||||
/// If the union variant matches, return a mutable reference to the TableInNestedNST.
|
||||
pub fn as_table_in_nested_ns_mut(&mut self) -> Option<&mut TableInNestedNST> {
|
||||
if let Self::TableInNestedNS(v) = self { Some(v.as_mut()) } else { None }
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum SecondTableInAOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct SecondTableInA<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for SecondTableInA<'a> {
|
||||
type Inner = SecondTableInA<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> SecondTableInA<'a> {
|
||||
pub const VT_REFER_TO_C: flatbuffers::VOffsetT = 4;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"NamespaceA.SecondTableInA"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
SecondTableInA { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args SecondTableInAArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<SecondTableInA<'bldr>> {
|
||||
let mut builder = SecondTableInABuilder::new(_fbb);
|
||||
if let Some(x) = args.refer_to_c { builder.add_refer_to_c(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> SecondTableInAT {
|
||||
let refer_to_c = self.refer_to_c().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
SecondTableInAT {
|
||||
refer_to_c,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn refer_to_c(&self) -> Option<super::namespace_c::TableInC<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for SecondTableInA<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC>>("refer_to_c", Self::VT_REFER_TO_C, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct SecondTableInAArgs<'a> {
|
||||
pub refer_to_c: Option<flatbuffers::WIPOffset<super::namespace_c::TableInC<'a>>>,
|
||||
}
|
||||
impl<'a> Default for SecondTableInAArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
SecondTableInAArgs {
|
||||
refer_to_c: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SecondTableInABuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SecondTableInABuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_refer_to_c(&mut self, refer_to_c: flatbuffers::WIPOffset<super::namespace_c::TableInC<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_c::TableInC>>(SecondTableInA::VT_REFER_TO_C, refer_to_c);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SecondTableInABuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
SecondTableInABuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<SecondTableInA<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for SecondTableInA<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("SecondTableInA");
|
||||
ds.field("refer_to_c", &self.refer_to_c());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct SecondTableInAT {
|
||||
pub refer_to_c: Option<Box<super::namespace_c::TableInCT>>,
|
||||
}
|
||||
impl Default for SecondTableInAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
refer_to_c: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl SecondTableInAT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<SecondTableInA<'b>> {
|
||||
let refer_to_c = self.refer_to_c.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
SecondTableInA::create(_fbb, &SecondTableInAArgs{
|
||||
refer_to_c,
|
||||
})
|
||||
}
|
||||
}
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum TableInFirstNSOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableInFirstNS<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInFirstNS<'a> {
|
||||
type Inner = TableInFirstNS<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInFirstNS<'a> {
|
||||
pub const VT_FOO_TABLE: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_FOO_ENUM: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_FOO_UNION_TYPE: flatbuffers::VOffsetT = 8;
|
||||
pub const VT_FOO_UNION: flatbuffers::VOffsetT = 10;
|
||||
pub const VT_FOO_STRUCT: flatbuffers::VOffsetT = 12;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"NamespaceA.TableInFirstNS"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TableInFirstNS { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableInFirstNSArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<TableInFirstNS<'bldr>> {
|
||||
let mut builder = TableInFirstNSBuilder::new(_fbb);
|
||||
if let Some(x) = args.foo_struct { builder.add_foo_struct(x); }
|
||||
if let Some(x) = args.foo_union { builder.add_foo_union(x); }
|
||||
if let Some(x) = args.foo_table { builder.add_foo_table(x); }
|
||||
builder.add_foo_union_type(args.foo_union_type);
|
||||
builder.add_foo_enum(args.foo_enum);
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableInFirstNST {
|
||||
let foo_table = self.foo_table().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
let foo_enum = self.foo_enum();
|
||||
let foo_union = match self.foo_union_type() {
|
||||
namespace_b::UnionInNestedNS::NONE => namespace_b::UnionInNestedNST::NONE,
|
||||
namespace_b::UnionInNestedNS::TableInNestedNS => namespace_b::UnionInNestedNST::TableInNestedNS(Box::new(
|
||||
self.foo_union_as_table_in_nested_ns()
|
||||
.expect("Invalid union table, expected `namespace_b::UnionInNestedNS::TableInNestedNS`.")
|
||||
.unpack()
|
||||
)),
|
||||
_ => namespace_b::UnionInNestedNST::NONE,
|
||||
};
|
||||
let foo_struct = self.foo_struct().map(|x| {
|
||||
x.unpack()
|
||||
});
|
||||
TableInFirstNST {
|
||||
foo_table,
|
||||
foo_enum,
|
||||
foo_union,
|
||||
foo_struct,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn foo_table(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, None)}
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_union_type(&self) -> namespace_b::UnionInNestedNS {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, Some(namespace_b::UnionInNestedNS::NONE)).unwrap()}
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_union(&self) -> Option<flatbuffers::Table<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(TableInFirstNS::VT_FOO_UNION, None)}
|
||||
}
|
||||
#[inline]
|
||||
pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)}
|
||||
}
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn foo_union_as_table_in_nested_ns(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
|
||||
if self.foo_union_type() == namespace_b::UnionInNestedNS::TableInNestedNS {
|
||||
self.foo_union().map(|t| {
|
||||
// Safety:
|
||||
// Created from a valid Table for this object
|
||||
// Which contains a valid union in this slot
|
||||
unsafe { namespace_b::TableInNestedNS::init_from_table(t) }
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TableInFirstNS<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("foo_table", Self::VT_FOO_TABLE, false)?
|
||||
.visit_field::<namespace_b::EnumInNestedNS>("foo_enum", Self::VT_FOO_ENUM, false)?
|
||||
.visit_union::<namespace_b::UnionInNestedNS, _>("foo_union_type", Self::VT_FOO_UNION_TYPE, "foo_union", Self::VT_FOO_UNION, false, |key, v, pos| {
|
||||
match key {
|
||||
namespace_b::UnionInNestedNS::TableInNestedNS => v.verify_union_variant::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS>>("namespace_b::UnionInNestedNS::TableInNestedNS", pos),
|
||||
_ => Ok(()),
|
||||
}
|
||||
})?
|
||||
.visit_field::<namespace_b::StructInNestedNS>("foo_struct", Self::VT_FOO_STRUCT, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableInFirstNSArgs<'a> {
|
||||
pub foo_table: Option<flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'a>>>,
|
||||
pub foo_enum: namespace_b::EnumInNestedNS,
|
||||
pub foo_union_type: namespace_b::UnionInNestedNS,
|
||||
pub foo_union: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
|
||||
pub foo_struct: Option<&'a namespace_b::StructInNestedNS>,
|
||||
}
|
||||
impl<'a> Default for TableInFirstNSArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInFirstNSArgs {
|
||||
foo_table: None,
|
||||
foo_enum: namespace_b::EnumInNestedNS::A,
|
||||
foo_union_type: namespace_b::UnionInNestedNS::NONE,
|
||||
foo_union: None,
|
||||
foo_struct: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInFirstNSBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInFirstNSBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_foo_table(&mut self, foo_table: flatbuffers::WIPOffset<namespace_b::TableInNestedNS<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<namespace_b::TableInNestedNS>>(TableInFirstNS::VT_FOO_TABLE, foo_table);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_foo_enum(&mut self, foo_enum: namespace_b::EnumInNestedNS) {
|
||||
self.fbb_.push_slot::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, foo_enum, namespace_b::EnumInNestedNS::A);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_foo_union_type(&mut self, foo_union_type: namespace_b::UnionInNestedNS) {
|
||||
self.fbb_.push_slot::<namespace_b::UnionInNestedNS>(TableInFirstNS::VT_FOO_UNION_TYPE, foo_union_type, namespace_b::UnionInNestedNS::NONE);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_foo_union(&mut self, foo_union: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TableInFirstNS::VT_FOO_UNION, foo_union);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_foo_struct(&mut self, foo_struct: &namespace_b::StructInNestedNS) {
|
||||
self.fbb_.push_slot_always::<&namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInFirstNSBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableInFirstNSBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInFirstNS<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TableInFirstNS<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInFirstNS");
|
||||
ds.field("foo_table", &self.foo_table());
|
||||
ds.field("foo_enum", &self.foo_enum());
|
||||
ds.field("foo_union_type", &self.foo_union_type());
|
||||
match self.foo_union_type() {
|
||||
namespace_b::UnionInNestedNS::TableInNestedNS => {
|
||||
if let Some(x) = self.foo_union_as_table_in_nested_ns() {
|
||||
ds.field("foo_union", &x)
|
||||
} else {
|
||||
ds.field("foo_union", &"InvalidFlatbuffer: Union discriminant does not match value.")
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
let x: Option<()> = None;
|
||||
ds.field("foo_union", &x)
|
||||
},
|
||||
};
|
||||
ds.field("foo_struct", &self.foo_struct());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInFirstNST {
|
||||
pub foo_table: Option<Box<namespace_b::TableInNestedNST>>,
|
||||
pub foo_enum: namespace_b::EnumInNestedNS,
|
||||
pub foo_union: namespace_b::UnionInNestedNST,
|
||||
pub foo_struct: Option<namespace_b::StructInNestedNST>,
|
||||
}
|
||||
impl Default for TableInFirstNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
foo_table: None,
|
||||
foo_enum: namespace_b::EnumInNestedNS::A,
|
||||
foo_union: namespace_b::UnionInNestedNST::NONE,
|
||||
foo_struct: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInFirstNST {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TableInFirstNS<'b>> {
|
||||
let foo_table = self.foo_table.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
let foo_enum = self.foo_enum;
|
||||
let foo_union_type = self.foo_union.union_in_nested_ns_type();
|
||||
let foo_union = self.foo_union.pack(_fbb);
|
||||
let foo_struct_tmp = self.foo_struct.as_ref().map(|x| x.pack());
|
||||
let foo_struct = foo_struct_tmp.as_ref();
|
||||
TableInFirstNS::create(_fbb, &TableInFirstNSArgs{
|
||||
foo_table,
|
||||
foo_enum,
|
||||
foo_union_type,
|
||||
foo_union,
|
||||
foo_struct,
|
||||
})
|
||||
}
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// @generated
|
||||
extern crate alloc;
|
||||
extern crate flatbuffers;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
use core::cmp::Ordering;
|
||||
use self::flatbuffers::{EndianScalar, Follow};
|
||||
use super::*;
|
||||
pub enum TableInCOffset {}
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
||||
pub struct TableInC<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for TableInC<'a> {
|
||||
type Inner = TableInC<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TableInC<'a> {
|
||||
pub const VT_REFER_TO_A1: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_REFER_TO_A2: flatbuffers::VOffsetT = 6;
|
||||
|
||||
pub const fn get_fully_qualified_name() -> &'static str {
|
||||
"NamespaceC.TableInC"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
TableInC { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
||||
args: &'args TableInCArgs<'args>
|
||||
) -> flatbuffers::WIPOffset<TableInC<'bldr>> {
|
||||
let mut builder = TableInCBuilder::new(_fbb);
|
||||
if let Some(x) = args.refer_to_a2 { builder.add_refer_to_a2(x); }
|
||||
if let Some(x) = args.refer_to_a1 { builder.add_refer_to_a1(x); }
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub fn unpack(&self) -> TableInCT {
|
||||
let refer_to_a1 = self.refer_to_a1().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
let refer_to_a2 = self.refer_to_a2().map(|x| {
|
||||
Box::new(x.unpack())
|
||||
});
|
||||
TableInCT {
|
||||
refer_to_a1,
|
||||
refer_to_a2,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn refer_to_a1(&self) -> Option<super::namespace_a::TableInFirstNS<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, None)}
|
||||
}
|
||||
#[inline]
|
||||
pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
|
||||
// Safety:
|
||||
// Created from valid Table for this object
|
||||
// which contains a valid value in this slot
|
||||
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, None)}
|
||||
}
|
||||
}
|
||||
|
||||
impl flatbuffers::Verifiable for TableInC<'_> {
|
||||
#[inline]
|
||||
fn run_verifier(
|
||||
v: &mut flatbuffers::Verifier, pos: usize
|
||||
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
||||
use self::flatbuffers::Verifiable;
|
||||
v.visit_table(pos)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS>>("refer_to_a1", Self::VT_REFER_TO_A1, false)?
|
||||
.visit_field::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA>>("refer_to_a2", Self::VT_REFER_TO_A2, false)?
|
||||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub struct TableInCArgs<'a> {
|
||||
pub refer_to_a1: Option<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'a>>>,
|
||||
pub refer_to_a2: Option<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'a>>>,
|
||||
}
|
||||
impl<'a> Default for TableInCArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
TableInCArgs {
|
||||
refer_to_a1: None,
|
||||
refer_to_a2: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TableInCBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TableInCBuilder<'a, 'b, A> {
|
||||
#[inline]
|
||||
pub fn add_refer_to_a1(&mut self, refer_to_a1: flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::TableInFirstNS>>(TableInC::VT_REFER_TO_A1, refer_to_a1);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_refer_to_a2(&mut self, refer_to_a2: flatbuffers::WIPOffset<super::namespace_a::SecondTableInA<'b >>) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::namespace_a::SecondTableInA>>(TableInC::VT_REFER_TO_A2, refer_to_a2);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TableInCBuilder<'a, 'b, A> {
|
||||
let start = _fbb.start_table();
|
||||
TableInCBuilder {
|
||||
fbb_: _fbb,
|
||||
start_: start,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<TableInC<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for TableInC<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let mut ds = f.debug_struct("TableInC");
|
||||
ds.field("refer_to_a1", &self.refer_to_a1());
|
||||
ds.field("refer_to_a2", &self.refer_to_a2());
|
||||
ds.finish()
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInCT {
|
||||
pub refer_to_a1: Option<Box<super::namespace_a::TableInFirstNST>>,
|
||||
pub refer_to_a2: Option<Box<super::namespace_a::SecondTableInAT>>,
|
||||
}
|
||||
impl Default for TableInCT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
refer_to_a1: None,
|
||||
refer_to_a2: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInCT {
|
||||
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
|
||||
&self,
|
||||
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
|
||||
) -> flatbuffers::WIPOffset<TableInC<'b>> {
|
||||
let refer_to_a1 = self.refer_to_a1.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
let refer_to_a2 = self.refer_to_a2.as_ref().map(|x|{
|
||||
x.pack(_fbb)
|
||||
});
|
||||
TableInC::create(_fbb, &TableInCArgs{
|
||||
refer_to_a1,
|
||||
refer_to_a2,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace NamespaceA.NamespaceB;
|
||||
|
||||
table TableInNestedNS
|
||||
{
|
||||
foo:int;
|
||||
}
|
||||
|
||||
union UnionInNestedNS {
|
||||
TableInNestedNS,
|
||||
}
|
||||
|
||||
enum EnumInNestedNS:byte
|
||||
{
|
||||
A, B, C
|
||||
}
|
||||
|
||||
struct StructInNestedNS
|
||||
{
|
||||
a:int;
|
||||
b:int;
|
||||
}
|
||||
@@ -0,0 +1,465 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
#define FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace NamespaceA {
|
||||
namespace NamespaceB {
|
||||
|
||||
struct TableInNestedNS;
|
||||
struct TableInNestedNSBuilder;
|
||||
struct TableInNestedNST;
|
||||
|
||||
struct StructInNestedNS;
|
||||
|
||||
bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
|
||||
bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
|
||||
bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable();
|
||||
|
||||
enum UnionInNestedNS : uint8_t {
|
||||
UnionInNestedNS_NONE = 0,
|
||||
UnionInNestedNS_TableInNestedNS = 1,
|
||||
UnionInNestedNS_MIN = UnionInNestedNS_NONE,
|
||||
UnionInNestedNS_MAX = UnionInNestedNS_TableInNestedNS
|
||||
};
|
||||
|
||||
inline const UnionInNestedNS (&EnumValuesUnionInNestedNS())[2] {
|
||||
static const UnionInNestedNS values[] = {
|
||||
UnionInNestedNS_NONE,
|
||||
UnionInNestedNS_TableInNestedNS
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesUnionInNestedNS() {
|
||||
static const char * const names[3] = {
|
||||
"NONE",
|
||||
"TableInNestedNS",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameUnionInNestedNS(UnionInNestedNS e) {
|
||||
if (::flatbuffers::IsOutRange(e, UnionInNestedNS_NONE, UnionInNestedNS_TableInNestedNS)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesUnionInNestedNS()[index];
|
||||
}
|
||||
|
||||
template<typename T> struct UnionInNestedNSTraits {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionInNestedNSTraits<NamespaceA::NamespaceB::TableInNestedNS> {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||
};
|
||||
|
||||
template<typename T> struct UnionInNestedNSUnionTraits {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
|
||||
};
|
||||
|
||||
template<> struct UnionInNestedNSUnionTraits<NamespaceA::NamespaceB::TableInNestedNST> {
|
||||
static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
|
||||
};
|
||||
|
||||
struct UnionInNestedNSUnion {
|
||||
UnionInNestedNS type;
|
||||
void *value;
|
||||
|
||||
UnionInNestedNSUnion() : type(UnionInNestedNS_NONE), value(nullptr) {}
|
||||
UnionInNestedNSUnion(UnionInNestedNSUnion&& u) FLATBUFFERS_NOEXCEPT :
|
||||
type(UnionInNestedNS_NONE), value(nullptr)
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); }
|
||||
UnionInNestedNSUnion(const UnionInNestedNSUnion &);
|
||||
UnionInNestedNSUnion &operator=(const UnionInNestedNSUnion &u)
|
||||
{ UnionInNestedNSUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
|
||||
UnionInNestedNSUnion &operator=(UnionInNestedNSUnion &&u) FLATBUFFERS_NOEXCEPT
|
||||
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
|
||||
~UnionInNestedNSUnion() { Reset(); }
|
||||
|
||||
void Reset();
|
||||
|
||||
template <typename T>
|
||||
void Set(T&& val) {
|
||||
typedef typename std::remove_reference<T>::type RT;
|
||||
Reset();
|
||||
type = UnionInNestedNSUnionTraits<RT>::enum_value;
|
||||
if (type != UnionInNestedNS_NONE) {
|
||||
value = new RT(std::forward<T>(val));
|
||||
}
|
||||
}
|
||||
|
||||
static void *UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver);
|
||||
::flatbuffers::Offset<void> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||
|
||||
NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() {
|
||||
return type == UnionInNestedNS_TableInNestedNS ?
|
||||
reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
|
||||
}
|
||||
const NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() const {
|
||||
return type == UnionInNestedNS_TableInNestedNS ?
|
||||
reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline bool operator==(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
|
||||
if (lhs.type != rhs.type) return false;
|
||||
switch (lhs.type) {
|
||||
case UnionInNestedNS_NONE: {
|
||||
return true;
|
||||
}
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
return *(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(lhs.value)) ==
|
||||
*(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(rhs.value));
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator!=(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type);
|
||||
bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types);
|
||||
|
||||
enum EnumInNestedNS : int8_t {
|
||||
EnumInNestedNS_A = 0,
|
||||
EnumInNestedNS_B = 1,
|
||||
EnumInNestedNS_C = 2,
|
||||
EnumInNestedNS_MIN = EnumInNestedNS_A,
|
||||
EnumInNestedNS_MAX = EnumInNestedNS_C
|
||||
};
|
||||
|
||||
inline const EnumInNestedNS (&EnumValuesEnumInNestedNS())[3] {
|
||||
static const EnumInNestedNS values[] = {
|
||||
EnumInNestedNS_A,
|
||||
EnumInNestedNS_B,
|
||||
EnumInNestedNS_C
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesEnumInNestedNS() {
|
||||
static const char * const names[4] = {
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameEnumInNestedNS(EnumInNestedNS e) {
|
||||
if (::flatbuffers::IsOutRange(e, EnumInNestedNS_A, EnumInNestedNS_C)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnumInNestedNS()[index];
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
int32_t a_;
|
||||
int32_t b_;
|
||||
|
||||
public:
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return StructInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.StructInNestedNS";
|
||||
}
|
||||
StructInNestedNS()
|
||||
: a_(0),
|
||||
b_(0) {
|
||||
}
|
||||
StructInNestedNS(int32_t _a, int32_t _b)
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
}
|
||||
int32_t a() const {
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
void mutate_a(int32_t _a) {
|
||||
::flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
int32_t b() const {
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
void mutate_b(int32_t _b) {
|
||||
::flatbuffers::WriteScalar(&b_, _b);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(StructInNestedNS, 8);
|
||||
|
||||
inline bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a()) &&
|
||||
(lhs.b() == rhs.b());
|
||||
}
|
||||
|
||||
inline bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TableInNestedNST : public ::flatbuffers::NativeTable {
|
||||
typedef TableInNestedNS TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.TableInNestedNST";
|
||||
}
|
||||
int32_t foo = 0;
|
||||
};
|
||||
|
||||
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInNestedNST NativeTableType;
|
||||
typedef TableInNestedNSBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.TableInNestedNS";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_FOO = 4
|
||||
};
|
||||
int32_t foo() const {
|
||||
return GetField<int32_t>(VT_FOO, 0);
|
||||
}
|
||||
bool mutate_foo(int32_t _foo = 0) {
|
||||
return SetField<int32_t>(VT_FOO, _foo, 0);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_FOO, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInNestedNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInNestedNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TableInNestedNSBuilder {
|
||||
typedef TableInNestedNS Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_foo(int32_t foo) {
|
||||
fbb_.AddElement<int32_t>(TableInNestedNS::VT_FOO, foo, 0);
|
||||
}
|
||||
explicit TableInNestedNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInNestedNS> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInNestedNS>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t foo = 0) {
|
||||
TableInNestedNSBuilder builder_(_fbb);
|
||||
builder_.add_foo(foo);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return
|
||||
(lhs.foo == rhs.foo);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInNestedNST *TableInNestedNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInNestedNST>(new TableInNestedNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInNestedNS::UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = foo(); _o->foo = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> TableInNestedNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateTableInNestedNS(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInNestedNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _foo = _o->foo;
|
||||
return NamespaceA::NamespaceB::CreateTableInNestedNS(
|
||||
_fbb,
|
||||
_foo);
|
||||
}
|
||||
|
||||
inline bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type) {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_NONE: {
|
||||
return true;
|
||||
}
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyUnionInNestedNS(
|
||||
verifier, values->Get(i), types->GetEnum<UnionInNestedNS>(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver) {
|
||||
(void)resolver;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher) const {
|
||||
(void)_rehasher;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
||||
return CreateTableInNestedNS(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline UnionInNestedNSUnion::UnionInNestedNSUnion(const UnionInNestedNSUnion &u) : type(u.type), value(nullptr) {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
value = new NamespaceA::NamespaceB::TableInNestedNST(*reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(u.value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void UnionInNestedNSUnion::Reset() {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
auto ptr = reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
value = nullptr;
|
||||
type = UnionInNestedNS_NONE;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *UnionInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::TableInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"TableInNestedNS"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::EnumInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"A",
|
||||
"B",
|
||||
"C"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"foo"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 4, 8 };
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceB
|
||||
} // namespace NamespaceA
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import flatbuffers
|
||||
|
||||
namespace NamespaceA_NamespaceB
|
||||
|
||||
enum UnionInNestedNS:
|
||||
UnionInNestedNS_NONE = 0
|
||||
UnionInNestedNS_TableInNestedNS = 1
|
||||
|
||||
enum EnumInNestedNS:
|
||||
EnumInNestedNS_A = 0
|
||||
EnumInNestedNS_B = 1
|
||||
EnumInNestedNS_C = 2
|
||||
|
||||
class TableInNestedNS
|
||||
|
||||
class StructInNestedNS
|
||||
|
||||
class TableInNestedNS : flatbuffers_handle
|
||||
def foo():
|
||||
return buf_.flatbuffers_field_int32(pos_, 4, 0)
|
||||
|
||||
def GetRootAsTableInNestedNS(buf:string): return TableInNestedNS { buf, buf.flatbuffers_indirect(0) }
|
||||
|
||||
struct TableInNestedNSBuilder:
|
||||
b_:flatbuffers_builder
|
||||
def start():
|
||||
b_.StartObject(1)
|
||||
return this
|
||||
def add_foo(foo:int):
|
||||
b_.PrependInt32Slot(0, foo, 0)
|
||||
return this
|
||||
def end():
|
||||
return b_.EndObject()
|
||||
|
||||
class StructInNestedNS : flatbuffers_handle
|
||||
def a():
|
||||
return buf_.read_int32_le(pos_ + 0)
|
||||
def b():
|
||||
return buf_.read_int32_le(pos_ + 4)
|
||||
|
||||
def CreateStructInNestedNS(b_:flatbuffers_builder, a:int, b:int):
|
||||
b_.Prep(4, 8)
|
||||
b_.PrependInt32(b)
|
||||
b_.PrependInt32(a)
|
||||
return b_.Offset()
|
||||
|
||||
Vendored
+295
@@ -0,0 +1,295 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
|
||||
|
||||
library namespace_a.namespace_b;
|
||||
|
||||
import 'dart:typed_data' show Uint8List;
|
||||
import 'package:flat_buffers/flat_buffers.dart' as fb;
|
||||
|
||||
|
||||
class UnionInNestedNSTypeId {
|
||||
final int value;
|
||||
const UnionInNestedNSTypeId._(this.value);
|
||||
|
||||
factory UnionInNestedNSTypeId.fromValue(int value) {
|
||||
final result = values[value];
|
||||
if (result == null) {
|
||||
throw StateError('Invalid value $value for bit flag enum UnionInNestedNSTypeId');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static UnionInNestedNSTypeId? _createOrNull(int? value) =>
|
||||
value == null ? null : UnionInNestedNSTypeId.fromValue(value);
|
||||
|
||||
static const int minValue = 0;
|
||||
static const int maxValue = 1;
|
||||
static bool containsValue(int value) => values.containsKey(value);
|
||||
|
||||
static const UnionInNestedNSTypeId NONE = UnionInNestedNSTypeId._(0);
|
||||
static const UnionInNestedNSTypeId TableInNestedNS = UnionInNestedNSTypeId._(1);
|
||||
static const Map<int, UnionInNestedNSTypeId> values = {
|
||||
0: NONE,
|
||||
1: TableInNestedNS};
|
||||
|
||||
static const fb.Reader<UnionInNestedNSTypeId> reader = _UnionInNestedNSTypeIdReader();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UnionInNestedNSTypeId{value: $value}';
|
||||
}
|
||||
}
|
||||
|
||||
class _UnionInNestedNSTypeIdReader extends fb.Reader<UnionInNestedNSTypeId> {
|
||||
const _UnionInNestedNSTypeIdReader();
|
||||
|
||||
@override
|
||||
int get size => 1;
|
||||
|
||||
@override
|
||||
UnionInNestedNSTypeId read(fb.BufferContext bc, int offset) =>
|
||||
UnionInNestedNSTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
|
||||
}
|
||||
|
||||
class EnumInNestedNS {
|
||||
final int value;
|
||||
const EnumInNestedNS._(this.value);
|
||||
|
||||
factory EnumInNestedNS.fromValue(int value) {
|
||||
final result = values[value];
|
||||
if (result == null) {
|
||||
throw StateError('Invalid value $value for bit flag enum EnumInNestedNS');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static EnumInNestedNS? _createOrNull(int? value) =>
|
||||
value == null ? null : EnumInNestedNS.fromValue(value);
|
||||
|
||||
static const int minValue = 0;
|
||||
static const int maxValue = 2;
|
||||
static bool containsValue(int value) => values.containsKey(value);
|
||||
|
||||
static const EnumInNestedNS A = EnumInNestedNS._(0);
|
||||
static const EnumInNestedNS B = EnumInNestedNS._(1);
|
||||
static const EnumInNestedNS C = EnumInNestedNS._(2);
|
||||
static const Map<int, EnumInNestedNS> values = {
|
||||
0: A,
|
||||
1: B,
|
||||
2: C};
|
||||
|
||||
static const fb.Reader<EnumInNestedNS> reader = _EnumInNestedNSReader();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EnumInNestedNS{value: $value}';
|
||||
}
|
||||
}
|
||||
|
||||
class _EnumInNestedNSReader extends fb.Reader<EnumInNestedNS> {
|
||||
const _EnumInNestedNSReader();
|
||||
|
||||
@override
|
||||
int get size => 1;
|
||||
|
||||
@override
|
||||
EnumInNestedNS read(fb.BufferContext bc, int offset) =>
|
||||
EnumInNestedNS.fromValue(const fb.Int8Reader().read(bc, offset));
|
||||
}
|
||||
|
||||
class TableInNestedNS {
|
||||
TableInNestedNS._(this._bc, this._bcOffset);
|
||||
factory TableInNestedNS(List<int> bytes) {
|
||||
final rootRef = fb.BufferContext.fromBytes(bytes);
|
||||
return reader.read(rootRef, 0);
|
||||
}
|
||||
|
||||
static const fb.Reader<TableInNestedNS> reader = _TableInNestedNSReader();
|
||||
|
||||
final fb.BufferContext _bc;
|
||||
final int _bcOffset;
|
||||
|
||||
int get foo => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInNestedNS{foo: $foo}';
|
||||
}
|
||||
|
||||
TableInNestedNST unpack() => TableInNestedNST(
|
||||
foo: foo);
|
||||
|
||||
static int pack(fb.Builder fbBuilder, TableInNestedNST? object) {
|
||||
if (object == null) return 0;
|
||||
return object.pack(fbBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
class TableInNestedNST implements fb.Packable {
|
||||
int foo;
|
||||
|
||||
TableInNestedNST({
|
||||
this.foo = 0});
|
||||
|
||||
@override
|
||||
int pack(fb.Builder fbBuilder) {
|
||||
fbBuilder.startTable(1);
|
||||
fbBuilder.addInt32(0, foo);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInNestedNST{foo: $foo}';
|
||||
}
|
||||
}
|
||||
|
||||
class _TableInNestedNSReader extends fb.TableReader<TableInNestedNS> {
|
||||
const _TableInNestedNSReader();
|
||||
|
||||
@override
|
||||
TableInNestedNS createObject(fb.BufferContext bc, int offset) =>
|
||||
TableInNestedNS._(bc, offset);
|
||||
}
|
||||
|
||||
class TableInNestedNSBuilder {
|
||||
TableInNestedNSBuilder(this.fbBuilder);
|
||||
|
||||
final fb.Builder fbBuilder;
|
||||
|
||||
void begin() {
|
||||
fbBuilder.startTable(1);
|
||||
}
|
||||
|
||||
int addFoo(int? foo) {
|
||||
fbBuilder.addInt32(0, foo);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
int finish() {
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
}
|
||||
|
||||
class TableInNestedNSObjectBuilder extends fb.ObjectBuilder {
|
||||
final int? _foo;
|
||||
|
||||
TableInNestedNSObjectBuilder({
|
||||
int? foo,
|
||||
})
|
||||
: _foo = foo;
|
||||
|
||||
/// Finish building, and store into the [fbBuilder].
|
||||
@override
|
||||
int finish(fb.Builder fbBuilder) {
|
||||
fbBuilder.startTable(1);
|
||||
fbBuilder.addInt32(0, _foo);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
/// Convenience method to serialize to byte list.
|
||||
@override
|
||||
Uint8List toBytes([String? fileIdentifier]) {
|
||||
final fbBuilder = fb.Builder(deduplicateTables: false);
|
||||
fbBuilder.finish(finish(fbBuilder), fileIdentifier);
|
||||
return fbBuilder.buffer;
|
||||
}
|
||||
}
|
||||
class StructInNestedNS {
|
||||
StructInNestedNS._(this._bc, this._bcOffset);
|
||||
|
||||
static const fb.Reader<StructInNestedNS> reader = _StructInNestedNSReader();
|
||||
|
||||
final fb.BufferContext _bc;
|
||||
final int _bcOffset;
|
||||
|
||||
int get a => const fb.Int32Reader().read(_bc, _bcOffset + 0);
|
||||
int get b => const fb.Int32Reader().read(_bc, _bcOffset + 4);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StructInNestedNS{a: $a, b: $b}';
|
||||
}
|
||||
|
||||
StructInNestedNST unpack() => StructInNestedNST(
|
||||
a: a,
|
||||
b: b);
|
||||
|
||||
static int pack(fb.Builder fbBuilder, StructInNestedNST? object) {
|
||||
if (object == null) return 0;
|
||||
return object.pack(fbBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
class StructInNestedNST implements fb.Packable {
|
||||
int a;
|
||||
int b;
|
||||
|
||||
StructInNestedNST({
|
||||
required this.a,
|
||||
required this.b});
|
||||
|
||||
@override
|
||||
int pack(fb.Builder fbBuilder) {
|
||||
fbBuilder.putInt32(b);
|
||||
fbBuilder.putInt32(a);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StructInNestedNST{a: $a, b: $b}';
|
||||
}
|
||||
}
|
||||
|
||||
class _StructInNestedNSReader extends fb.StructReader<StructInNestedNS> {
|
||||
const _StructInNestedNSReader();
|
||||
|
||||
@override
|
||||
int get size => 8;
|
||||
|
||||
@override
|
||||
StructInNestedNS createObject(fb.BufferContext bc, int offset) =>
|
||||
StructInNestedNS._(bc, offset);
|
||||
}
|
||||
|
||||
class StructInNestedNSBuilder {
|
||||
StructInNestedNSBuilder(this.fbBuilder);
|
||||
|
||||
final fb.Builder fbBuilder;
|
||||
|
||||
int finish(int a, int b) {
|
||||
fbBuilder.putInt32(b);
|
||||
fbBuilder.putInt32(a);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class StructInNestedNSObjectBuilder extends fb.ObjectBuilder {
|
||||
final int _a;
|
||||
final int _b;
|
||||
|
||||
StructInNestedNSObjectBuilder({
|
||||
required int a,
|
||||
required int b,
|
||||
})
|
||||
: _a = a,
|
||||
_b = b;
|
||||
|
||||
/// Finish building, and store into the [fbBuilder].
|
||||
@override
|
||||
int finish(fb.Builder fbBuilder) {
|
||||
fbBuilder.putInt32(_b);
|
||||
fbBuilder.putInt32(_a);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
/// Convenience method to serialize to byte list.
|
||||
@override
|
||||
Uint8List toBytes([String? fileIdentifier]) {
|
||||
final fbBuilder = fb.Builder(deduplicateTables: false);
|
||||
fbBuilder.finish(finish(fbBuilder), fileIdentifier);
|
||||
return fbBuilder.buffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
include "namespace_test1.fbs";
|
||||
|
||||
namespace NamespaceA;
|
||||
|
||||
table TableInFirstNS
|
||||
{
|
||||
foo_table:NamespaceB.TableInNestedNS;
|
||||
foo_enum:NamespaceB.EnumInNestedNS;
|
||||
foo_union:NamespaceB.UnionInNestedNS;
|
||||
foo_struct:NamespaceB.StructInNestedNS;
|
||||
}
|
||||
|
||||
// Test switching namespaces inside a file.
|
||||
namespace NamespaceC;
|
||||
|
||||
table TableInC {
|
||||
refer_to_a1:NamespaceA.TableInFirstNS;
|
||||
refer_to_a2:NamespaceA.SecondTableInA;
|
||||
}
|
||||
|
||||
namespace NamespaceA;
|
||||
|
||||
table SecondTableInA {
|
||||
refer_to_c:NamespaceC.TableInC;
|
||||
}
|
||||
@@ -0,0 +1,603 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
#define FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct TableInFirstNS;
|
||||
struct TableInFirstNSBuilder;
|
||||
struct TableInFirstNST;
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
struct TableInC;
|
||||
struct TableInCBuilder;
|
||||
struct TableInCT;
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct SecondTableInA;
|
||||
struct SecondTableInABuilder;
|
||||
struct SecondTableInAT;
|
||||
|
||||
bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs);
|
||||
bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs);
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
bool operator==(const TableInCT &lhs, const TableInCT &rhs);
|
||||
bool operator!=(const TableInCT &lhs, const TableInCT &rhs);
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs);
|
||||
bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs);
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInFirstNSTypeTable();
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInCTypeTable();
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *SecondTableInATypeTable();
|
||||
|
||||
struct TableInFirstNST : public ::flatbuffers::NativeTable {
|
||||
typedef TableInFirstNS TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.TableInFirstNST";
|
||||
}
|
||||
std::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST> foo_table{};
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum = NamespaceA::NamespaceB::EnumInNestedNS_A;
|
||||
NamespaceA::NamespaceB::UnionInNestedNSUnion foo_union{};
|
||||
std::unique_ptr<NamespaceA::NamespaceB::StructInNestedNS> foo_struct{};
|
||||
TableInFirstNST() = default;
|
||||
TableInFirstNST(const TableInFirstNST &o);
|
||||
TableInFirstNST(TableInFirstNST&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
TableInFirstNST &operator=(TableInFirstNST o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct TableInFirstNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInFirstNST NativeTableType;
|
||||
typedef TableInFirstNSBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInFirstNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.TableInFirstNS";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_FOO_TABLE = 4,
|
||||
VT_FOO_ENUM = 6,
|
||||
VT_FOO_UNION_TYPE = 8,
|
||||
VT_FOO_UNION = 10,
|
||||
VT_FOO_STRUCT = 12
|
||||
};
|
||||
const NamespaceA::NamespaceB::TableInNestedNS *foo_table() const {
|
||||
return GetPointer<const NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
||||
}
|
||||
NamespaceA::NamespaceB::TableInNestedNS *mutable_foo_table() {
|
||||
return GetPointer<NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
||||
}
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum() const {
|
||||
return static_cast<NamespaceA::NamespaceB::EnumInNestedNS>(GetField<int8_t>(VT_FOO_ENUM, 0));
|
||||
}
|
||||
bool mutate_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS _foo_enum = static_cast<NamespaceA::NamespaceB::EnumInNestedNS>(0)) {
|
||||
return SetField<int8_t>(VT_FOO_ENUM, static_cast<int8_t>(_foo_enum), 0);
|
||||
}
|
||||
NamespaceA::NamespaceB::UnionInNestedNS foo_union_type() const {
|
||||
return static_cast<NamespaceA::NamespaceB::UnionInNestedNS>(GetField<uint8_t>(VT_FOO_UNION_TYPE, 0));
|
||||
}
|
||||
const void *foo_union() const {
|
||||
return GetPointer<const void *>(VT_FOO_UNION);
|
||||
}
|
||||
template<typename T> const T *foo_union_as() const;
|
||||
const NamespaceA::NamespaceB::TableInNestedNS *foo_union_as_TableInNestedNS() const {
|
||||
return foo_union_type() == NamespaceA::NamespaceB::UnionInNestedNS_TableInNestedNS ? static_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(foo_union()) : nullptr;
|
||||
}
|
||||
void *mutable_foo_union() {
|
||||
return GetPointer<void *>(VT_FOO_UNION);
|
||||
}
|
||||
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct() const {
|
||||
return GetStruct<const NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
||||
}
|
||||
NamespaceA::NamespaceB::StructInNestedNS *mutable_foo_struct() {
|
||||
return GetStruct<NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_FOO_TABLE) &&
|
||||
verifier.VerifyTable(foo_table()) &&
|
||||
VerifyField<int8_t>(verifier, VT_FOO_ENUM, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_FOO_UNION_TYPE, 1) &&
|
||||
VerifyOffset(verifier, VT_FOO_UNION) &&
|
||||
VerifyUnionInNestedNS(verifier, foo_union(), foo_union_type()) &&
|
||||
VerifyField<NamespaceA::NamespaceB::StructInNestedNS>(verifier, VT_FOO_STRUCT, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInFirstNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInFirstNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInFirstNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
template<> inline const NamespaceA::NamespaceB::TableInNestedNS *TableInFirstNS::foo_union_as<NamespaceA::NamespaceB::TableInNestedNS>() const {
|
||||
return foo_union_as_TableInNestedNS();
|
||||
}
|
||||
|
||||
struct TableInFirstNSBuilder {
|
||||
typedef TableInFirstNS Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_foo_table(::flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table) {
|
||||
fbb_.AddOffset(TableInFirstNS::VT_FOO_TABLE, foo_table);
|
||||
}
|
||||
void add_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS foo_enum) {
|
||||
fbb_.AddElement<int8_t>(TableInFirstNS::VT_FOO_ENUM, static_cast<int8_t>(foo_enum), 0);
|
||||
}
|
||||
void add_foo_union_type(NamespaceA::NamespaceB::UnionInNestedNS foo_union_type) {
|
||||
fbb_.AddElement<uint8_t>(TableInFirstNS::VT_FOO_UNION_TYPE, static_cast<uint8_t>(foo_union_type), 0);
|
||||
}
|
||||
void add_foo_union(::flatbuffers::Offset<void> foo_union) {
|
||||
fbb_.AddOffset(TableInFirstNS::VT_FOO_UNION, foo_union);
|
||||
}
|
||||
void add_foo_struct(const NamespaceA::NamespaceB::StructInNestedNS *foo_struct) {
|
||||
fbb_.AddStruct(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
|
||||
}
|
||||
explicit TableInFirstNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInFirstNS> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInFirstNS>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table = 0,
|
||||
NamespaceA::NamespaceB::EnumInNestedNS foo_enum = NamespaceA::NamespaceB::EnumInNestedNS_A,
|
||||
NamespaceA::NamespaceB::UnionInNestedNS foo_union_type = NamespaceA::NamespaceB::UnionInNestedNS_NONE,
|
||||
::flatbuffers::Offset<void> foo_union = 0,
|
||||
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct = nullptr) {
|
||||
TableInFirstNSBuilder builder_(_fbb);
|
||||
builder_.add_foo_struct(foo_struct);
|
||||
builder_.add_foo_union(foo_union);
|
||||
builder_.add_foo_table(foo_table);
|
||||
builder_.add_foo_union_type(foo_union_type);
|
||||
builder_.add_foo_enum(foo_enum);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
struct TableInCT : public ::flatbuffers::NativeTable {
|
||||
typedef TableInC TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceC.TableInCT";
|
||||
}
|
||||
std::unique_ptr<NamespaceA::TableInFirstNST> refer_to_a1{};
|
||||
std::unique_ptr<NamespaceA::SecondTableInAT> refer_to_a2{};
|
||||
TableInCT() = default;
|
||||
TableInCT(const TableInCT &o);
|
||||
TableInCT(TableInCT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
TableInCT &operator=(TableInCT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct TableInC FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInCT NativeTableType;
|
||||
typedef TableInCBuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInCTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceC.TableInC";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_REFER_TO_A1 = 4,
|
||||
VT_REFER_TO_A2 = 6
|
||||
};
|
||||
const NamespaceA::TableInFirstNS *refer_to_a1() const {
|
||||
return GetPointer<const NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
||||
}
|
||||
NamespaceA::TableInFirstNS *mutable_refer_to_a1() {
|
||||
return GetPointer<NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
||||
}
|
||||
const NamespaceA::SecondTableInA *refer_to_a2() const {
|
||||
return GetPointer<const NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
||||
}
|
||||
NamespaceA::SecondTableInA *mutable_refer_to_a2() {
|
||||
return GetPointer<NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_A1) &&
|
||||
verifier.VerifyTable(refer_to_a1()) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_A2) &&
|
||||
verifier.VerifyTable(refer_to_a2()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInCT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInCT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInC> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TableInCBuilder {
|
||||
typedef TableInC Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_refer_to_a1(::flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1) {
|
||||
fbb_.AddOffset(TableInC::VT_REFER_TO_A1, refer_to_a1);
|
||||
}
|
||||
void add_refer_to_a2(::flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2) {
|
||||
fbb_.AddOffset(TableInC::VT_REFER_TO_A2, refer_to_a2);
|
||||
}
|
||||
explicit TableInCBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableInC> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableInC>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> CreateTableInC(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1 = 0,
|
||||
::flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2 = 0) {
|
||||
TableInCBuilder builder_(_fbb);
|
||||
builder_.add_refer_to_a2(refer_to_a2);
|
||||
builder_.add_refer_to_a1(refer_to_a1);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<TableInC> CreateTableInC(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
struct SecondTableInAT : public ::flatbuffers::NativeTable {
|
||||
typedef SecondTableInA TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.SecondTableInAT";
|
||||
}
|
||||
std::unique_ptr<NamespaceC::TableInCT> refer_to_c{};
|
||||
SecondTableInAT() = default;
|
||||
SecondTableInAT(const SecondTableInAT &o);
|
||||
SecondTableInAT(SecondTableInAT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
SecondTableInAT &operator=(SecondTableInAT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct SecondTableInA FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef SecondTableInAT NativeTableType;
|
||||
typedef SecondTableInABuilder Builder;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return SecondTableInATypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.SecondTableInA";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_REFER_TO_C = 4
|
||||
};
|
||||
const NamespaceC::TableInC *refer_to_c() const {
|
||||
return GetPointer<const NamespaceC::TableInC *>(VT_REFER_TO_C);
|
||||
}
|
||||
NamespaceC::TableInC *mutable_refer_to_c() {
|
||||
return GetPointer<NamespaceC::TableInC *>(VT_REFER_TO_C);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_REFER_TO_C) &&
|
||||
verifier.VerifyTable(refer_to_c()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
SecondTableInAT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(SecondTableInAT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<SecondTableInA> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct SecondTableInABuilder {
|
||||
typedef SecondTableInA Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_refer_to_c(::flatbuffers::Offset<NamespaceC::TableInC> refer_to_c) {
|
||||
fbb_.AddOffset(SecondTableInA::VT_REFER_TO_C, refer_to_c);
|
||||
}
|
||||
explicit SecondTableInABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<SecondTableInA> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<SecondTableInA>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<NamespaceC::TableInC> refer_to_c = 0) {
|
||||
SecondTableInABuilder builder_(_fbb);
|
||||
builder_.add_refer_to_c(refer_to_c);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return
|
||||
((lhs.foo_table == rhs.foo_table) || (lhs.foo_table && rhs.foo_table && *lhs.foo_table == *rhs.foo_table)) &&
|
||||
(lhs.foo_enum == rhs.foo_enum) &&
|
||||
(lhs.foo_union == rhs.foo_union) &&
|
||||
((lhs.foo_struct == rhs.foo_struct) || (lhs.foo_struct && rhs.foo_struct && *lhs.foo_struct == *rhs.foo_struct));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInFirstNST::TableInFirstNST(const TableInFirstNST &o)
|
||||
: foo_table((o.foo_table) ? new NamespaceA::NamespaceB::TableInNestedNST(*o.foo_table) : nullptr),
|
||||
foo_enum(o.foo_enum),
|
||||
foo_union(o.foo_union),
|
||||
foo_struct((o.foo_struct) ? new NamespaceA::NamespaceB::StructInNestedNS(*o.foo_struct) : nullptr) {
|
||||
}
|
||||
|
||||
inline TableInFirstNST &TableInFirstNST::operator=(TableInFirstNST o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(foo_table, o.foo_table);
|
||||
std::swap(foo_enum, o.foo_enum);
|
||||
std::swap(foo_union, o.foo_union);
|
||||
std::swap(foo_struct, o.foo_struct);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline TableInFirstNST *TableInFirstNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInFirstNST>(new TableInFirstNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInFirstNS::UnPackTo(TableInFirstNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = foo_table(); if (_e) { if(_o->foo_table) { _e->UnPackTo(_o->foo_table.get(), _resolver); } else { _o->foo_table = std::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST>(_e->UnPack(_resolver)); } } else if (_o->foo_table) { _o->foo_table.reset(); } }
|
||||
{ auto _e = foo_enum(); _o->foo_enum = _e; }
|
||||
{ auto _e = foo_union_type(); _o->foo_union.type = _e; }
|
||||
{ auto _e = foo_union(); if (_e) _o->foo_union.value = NamespaceA::NamespaceB::UnionInNestedNSUnion::UnPack(_e, foo_union_type(), _resolver); }
|
||||
{ auto _e = foo_struct(); if (_e) _o->foo_struct = std::unique_ptr<NamespaceA::NamespaceB::StructInNestedNS>(new NamespaceA::NamespaceB::StructInNestedNS(*_e)); }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> TableInFirstNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateTableInFirstNS(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInFirstNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInFirstNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _foo_table = _o->foo_table ? CreateTableInNestedNS(_fbb, _o->foo_table.get(), _rehasher) : 0;
|
||||
auto _foo_enum = _o->foo_enum;
|
||||
auto _foo_union_type = _o->foo_union.type;
|
||||
auto _foo_union = _o->foo_union.Pack(_fbb);
|
||||
auto _foo_struct = _o->foo_struct ? _o->foo_struct.get() : nullptr;
|
||||
return NamespaceA::CreateTableInFirstNS(
|
||||
_fbb,
|
||||
_foo_table,
|
||||
_foo_enum,
|
||||
_foo_union_type,
|
||||
_foo_union,
|
||||
_foo_struct);
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
|
||||
inline bool operator==(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_a1 == rhs.refer_to_a1) || (lhs.refer_to_a1 && rhs.refer_to_a1 && *lhs.refer_to_a1 == *rhs.refer_to_a1)) &&
|
||||
((lhs.refer_to_a2 == rhs.refer_to_a2) || (lhs.refer_to_a2 && rhs.refer_to_a2 && *lhs.refer_to_a2 == *rhs.refer_to_a2));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInCT::TableInCT(const TableInCT &o)
|
||||
: refer_to_a1((o.refer_to_a1) ? new NamespaceA::TableInFirstNST(*o.refer_to_a1) : nullptr),
|
||||
refer_to_a2((o.refer_to_a2) ? new NamespaceA::SecondTableInAT(*o.refer_to_a2) : nullptr) {
|
||||
}
|
||||
|
||||
inline TableInCT &TableInCT::operator=(TableInCT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(refer_to_a1, o.refer_to_a1);
|
||||
std::swap(refer_to_a2, o.refer_to_a2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline TableInCT *TableInC::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInCT>(new TableInCT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInC::UnPackTo(TableInCT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = refer_to_a1(); if (_e) { if(_o->refer_to_a1) { _e->UnPackTo(_o->refer_to_a1.get(), _resolver); } else { _o->refer_to_a1 = std::unique_ptr<NamespaceA::TableInFirstNST>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a1) { _o->refer_to_a1.reset(); } }
|
||||
{ auto _e = refer_to_a2(); if (_e) { if(_o->refer_to_a2) { _e->UnPackTo(_o->refer_to_a2.get(), _resolver); } else { _o->refer_to_a2 = std::unique_ptr<NamespaceA::SecondTableInAT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a2) { _o->refer_to_a2.reset(); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> TableInC::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateTableInC(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableInC> CreateTableInC(::flatbuffers::FlatBufferBuilder &_fbb, const TableInCT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInCT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _refer_to_a1 = _o->refer_to_a1 ? CreateTableInFirstNS(_fbb, _o->refer_to_a1.get(), _rehasher) : 0;
|
||||
auto _refer_to_a2 = _o->refer_to_a2 ? CreateSecondTableInA(_fbb, _o->refer_to_a2.get(), _rehasher) : 0;
|
||||
return NamespaceC::CreateTableInC(
|
||||
_fbb,
|
||||
_refer_to_a1,
|
||||
_refer_to_a2);
|
||||
}
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
|
||||
inline bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_c == rhs.refer_to_c) || (lhs.refer_to_c && rhs.refer_to_c && *lhs.refer_to_c == *rhs.refer_to_c));
|
||||
}
|
||||
|
||||
inline bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline SecondTableInAT::SecondTableInAT(const SecondTableInAT &o)
|
||||
: refer_to_c((o.refer_to_c) ? new NamespaceC::TableInCT(*o.refer_to_c) : nullptr) {
|
||||
}
|
||||
|
||||
inline SecondTableInAT &SecondTableInAT::operator=(SecondTableInAT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(refer_to_c, o.refer_to_c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline SecondTableInAT *SecondTableInA::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<SecondTableInAT>(new SecondTableInAT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void SecondTableInA::UnPackTo(SecondTableInAT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = refer_to_c(); if (_e) { if(_o->refer_to_c) { _e->UnPackTo(_o->refer_to_c.get(), _resolver); } else { _o->refer_to_c = std::unique_ptr<NamespaceC::TableInCT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_c) { _o->refer_to_c.reset(); } }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> SecondTableInA::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateSecondTableInA(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(::flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const SecondTableInAT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _refer_to_c = _o->refer_to_c ? CreateTableInC(_fbb, _o->refer_to_c.get(), _rehasher) : 0;
|
||||
return NamespaceA::CreateSecondTableInA(
|
||||
_fbb,
|
||||
_refer_to_c);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInFirstNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 1 },
|
||||
{ ::flatbuffers::ET_UTYPE, 0, 2 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 2 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 3 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::TableInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::EnumInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::UnionInNestedNSTypeTable,
|
||||
NamespaceA::NamespaceB::StructInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"foo_table",
|
||||
"foo_enum",
|
||||
"foo_union_type",
|
||||
"foo_union",
|
||||
"foo_struct"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 5, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TableInCTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::TableInFirstNSTypeTable,
|
||||
NamespaceA::SecondTableInATypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"refer_to_a1",
|
||||
"refer_to_a2"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceC
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
inline const ::flatbuffers::TypeTable *SecondTableInATypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceC::TableInCTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"refer_to_c"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace NamespaceA
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import flatbuffers
|
||||
|
||||
namespace NamespaceA
|
||||
|
||||
class TableInFirstNS
|
||||
|
||||
namespace NamespaceC
|
||||
|
||||
class TableInC
|
||||
|
||||
namespace NamespaceA
|
||||
|
||||
class SecondTableInA
|
||||
|
||||
class TableInFirstNS : flatbuffers_handle
|
||||
def foo_table():
|
||||
let o = buf_.flatbuffers_field_table(pos_, 4)
|
||||
return if o: NamespaceA_NamespaceB_TableInNestedNS { buf_, o } else: nil
|
||||
def foo_enum():
|
||||
return EnumInNestedNS(buf_.flatbuffers_field_int8(pos_, 6, 0))
|
||||
def foo_union_type():
|
||||
return UnionInNestedNS(buf_.flatbuffers_field_int8(pos_, 8, 0))
|
||||
def foo_union_as_TableInNestedNS():
|
||||
return NamespaceA_NamespaceB_TableInNestedNS { buf_, buf_.flatbuffers_field_table(pos_, 10) }
|
||||
def foo_struct():
|
||||
let o = buf_.flatbuffers_field_struct(pos_, 12)
|
||||
return if o: NamespaceA_NamespaceB_StructInNestedNS { buf_, o } else: nil
|
||||
|
||||
def GetRootAsTableInFirstNS(buf:string): return TableInFirstNS { buf, buf.flatbuffers_indirect(0) }
|
||||
|
||||
struct TableInFirstNSBuilder:
|
||||
b_:flatbuffers_builder
|
||||
def start():
|
||||
b_.StartObject(5)
|
||||
return this
|
||||
def add_foo_table(foo_table:flatbuffers_offset):
|
||||
b_.PrependUOffsetTRelativeSlot(0, foo_table)
|
||||
return this
|
||||
def add_foo_enum(foo_enum:EnumInNestedNS):
|
||||
b_.PrependInt8Slot(1, foo_enum, 0)
|
||||
return this
|
||||
def add_foo_union_type(foo_union_type:UnionInNestedNS):
|
||||
b_.PrependUint8Slot(2, foo_union_type, 0)
|
||||
return this
|
||||
def add_foo_union(foo_union:flatbuffers_offset):
|
||||
b_.PrependUOffsetTRelativeSlot(3, foo_union)
|
||||
return this
|
||||
def add_foo_struct(foo_struct:flatbuffers_offset):
|
||||
b_.PrependStructSlot(4, foo_struct)
|
||||
return this
|
||||
def end():
|
||||
return b_.EndObject()
|
||||
|
||||
namespace NamespaceC
|
||||
|
||||
class TableInC : flatbuffers_handle
|
||||
def refer_to_a1():
|
||||
let o = buf_.flatbuffers_field_table(pos_, 4)
|
||||
return if o: NamespaceA_TableInFirstNS { buf_, o } else: nil
|
||||
def refer_to_a2():
|
||||
let o = buf_.flatbuffers_field_table(pos_, 6)
|
||||
return if o: NamespaceA_SecondTableInA { buf_, o } else: nil
|
||||
|
||||
def GetRootAsTableInC(buf:string): return TableInC { buf, buf.flatbuffers_indirect(0) }
|
||||
|
||||
struct TableInCBuilder:
|
||||
b_:flatbuffers_builder
|
||||
def start():
|
||||
b_.StartObject(2)
|
||||
return this
|
||||
def add_refer_to_a1(refer_to_a1:flatbuffers_offset):
|
||||
b_.PrependUOffsetTRelativeSlot(0, refer_to_a1)
|
||||
return this
|
||||
def add_refer_to_a2(refer_to_a2:flatbuffers_offset):
|
||||
b_.PrependUOffsetTRelativeSlot(1, refer_to_a2)
|
||||
return this
|
||||
def end():
|
||||
return b_.EndObject()
|
||||
|
||||
namespace NamespaceA
|
||||
|
||||
class SecondTableInA : flatbuffers_handle
|
||||
def refer_to_c():
|
||||
let o = buf_.flatbuffers_field_table(pos_, 4)
|
||||
return if o: NamespaceC_TableInC { buf_, o } else: nil
|
||||
|
||||
def GetRootAsSecondTableInA(buf:string): return SecondTableInA { buf, buf.flatbuffers_indirect(0) }
|
||||
|
||||
struct SecondTableInABuilder:
|
||||
b_:flatbuffers_builder
|
||||
def start():
|
||||
b_.StartObject(1)
|
||||
return this
|
||||
def add_refer_to_c(refer_to_c:flatbuffers_offset):
|
||||
b_.PrependUOffsetTRelativeSlot(0, refer_to_c)
|
||||
return this
|
||||
def end():
|
||||
return b_.EndObject()
|
||||
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
|
||||
|
||||
library namespace_a;
|
||||
|
||||
import 'dart:typed_data' show Uint8List;
|
||||
import 'package:flat_buffers/flat_buffers.dart' as fb;
|
||||
|
||||
import './namespace_test2_namespace_c_generated.dart' as namespace_c;
|
||||
|
||||
class TableInFirstNS {
|
||||
TableInFirstNS._(this._bc, this._bcOffset);
|
||||
factory TableInFirstNS(List<int> bytes) {
|
||||
final rootRef = fb.BufferContext.fromBytes(bytes);
|
||||
return reader.read(rootRef, 0);
|
||||
}
|
||||
|
||||
static const fb.Reader<TableInFirstNS> reader = _TableInFirstNSReader();
|
||||
|
||||
final fb.BufferContext _bc;
|
||||
final int _bcOffset;
|
||||
|
||||
namespace_a_namespace_b.TableInNestedNS? get fooTable => namespace_a_namespace_b.TableInNestedNS.reader.vTableGetNullable(_bc, _bcOffset, 4);
|
||||
EnumInNestedNS get fooEnum => EnumInNestedNS.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 6, 0));
|
||||
UnionInNestedNSTypeId? get fooUnionType => UnionInNestedNSTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 8));
|
||||
dynamic get fooUnion {
|
||||
switch (fooUnionType?.value) {
|
||||
case 1: return TableInNestedNS.reader.vTableGetNullable(_bc, _bcOffset, 10);
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
namespace_a_namespace_b.StructInNestedNS? get fooStruct => namespace_a_namespace_b.StructInNestedNS.reader.vTableGetNullable(_bc, _bcOffset, 12);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInFirstNS{fooTable: $fooTable, fooEnum: $fooEnum, fooUnionType: $fooUnionType, fooUnion: $fooUnion, fooStruct: $fooStruct}';
|
||||
}
|
||||
|
||||
TableInFirstNST unpack() => TableInFirstNST(
|
||||
fooTable: fooTable?.unpack(),
|
||||
fooEnum: fooEnum,
|
||||
fooUnionType: fooUnionType,
|
||||
fooUnion: fooUnion,
|
||||
fooStruct: fooStruct?.unpack());
|
||||
|
||||
static int pack(fb.Builder fbBuilder, TableInFirstNST? object) {
|
||||
if (object == null) return 0;
|
||||
return object.pack(fbBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
class TableInFirstNST implements fb.Packable {
|
||||
namespace_a_namespace_b.TableInNestedNST? fooTable;
|
||||
EnumInNestedNS fooEnum;
|
||||
UnionInNestedNSTypeId? fooUnionType;
|
||||
dynamic fooUnion;
|
||||
namespace_a_namespace_b.StructInNestedNST? fooStruct;
|
||||
|
||||
TableInFirstNST({
|
||||
this.fooTable,
|
||||
this.fooEnum = EnumInNestedNS.A,
|
||||
this.fooUnionType,
|
||||
this.fooUnion,
|
||||
this.fooStruct});
|
||||
|
||||
@override
|
||||
int pack(fb.Builder fbBuilder) {
|
||||
final int? fooTableOffset = fooTable?.pack(fbBuilder);
|
||||
final int? fooUnionOffset = fooUnion?.pack(fbBuilder);
|
||||
fbBuilder.startTable(5);
|
||||
fbBuilder.addOffset(0, fooTableOffset);
|
||||
fbBuilder.addInt8(1, fooEnum.value);
|
||||
fbBuilder.addUint8(2, fooUnionType?.value);
|
||||
fbBuilder.addOffset(3, fooUnionOffset);
|
||||
if (fooStruct != null) {
|
||||
fbBuilder.addStruct(4, fooStruct!.pack(fbBuilder));
|
||||
}
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInFirstNST{fooTable: $fooTable, fooEnum: $fooEnum, fooUnionType: $fooUnionType, fooUnion: $fooUnion, fooStruct: $fooStruct}';
|
||||
}
|
||||
}
|
||||
|
||||
class _TableInFirstNSReader extends fb.TableReader<TableInFirstNS> {
|
||||
const _TableInFirstNSReader();
|
||||
|
||||
@override
|
||||
TableInFirstNS createObject(fb.BufferContext bc, int offset) =>
|
||||
TableInFirstNS._(bc, offset);
|
||||
}
|
||||
|
||||
class TableInFirstNSBuilder {
|
||||
TableInFirstNSBuilder(this.fbBuilder);
|
||||
|
||||
final fb.Builder fbBuilder;
|
||||
|
||||
void begin() {
|
||||
fbBuilder.startTable(5);
|
||||
}
|
||||
|
||||
int addFooTableOffset(int? offset) {
|
||||
fbBuilder.addOffset(0, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
int addFooEnum(EnumInNestedNS? fooEnum) {
|
||||
fbBuilder.addInt8(1, fooEnum?.value);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
int addFooUnionType(UnionInNestedNSTypeId? fooUnionType) {
|
||||
fbBuilder.addUint8(2, fooUnionType?.value);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
int addFooUnionOffset(int? offset) {
|
||||
fbBuilder.addOffset(3, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
int addFooStruct(int offset) {
|
||||
fbBuilder.addStruct(4, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
int finish() {
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
}
|
||||
|
||||
class TableInFirstNSObjectBuilder extends fb.ObjectBuilder {
|
||||
final namespace_a_namespace_b.TableInNestedNSObjectBuilder? _fooTable;
|
||||
final EnumInNestedNS? _fooEnum;
|
||||
final UnionInNestedNSTypeId? _fooUnionType;
|
||||
final dynamic _fooUnion;
|
||||
final namespace_a_namespace_b.StructInNestedNSObjectBuilder? _fooStruct;
|
||||
|
||||
TableInFirstNSObjectBuilder({
|
||||
namespace_a_namespace_b.TableInNestedNSObjectBuilder? fooTable,
|
||||
EnumInNestedNS? fooEnum,
|
||||
UnionInNestedNSTypeId? fooUnionType,
|
||||
dynamic fooUnion,
|
||||
namespace_a_namespace_b.StructInNestedNSObjectBuilder? fooStruct,
|
||||
})
|
||||
: _fooTable = fooTable,
|
||||
_fooEnum = fooEnum,
|
||||
_fooUnionType = fooUnionType,
|
||||
_fooUnion = fooUnion,
|
||||
_fooStruct = fooStruct;
|
||||
|
||||
/// Finish building, and store into the [fbBuilder].
|
||||
@override
|
||||
int finish(fb.Builder fbBuilder) {
|
||||
final int? fooTableOffset = _fooTable?.getOrCreateOffset(fbBuilder);
|
||||
final int? fooUnionOffset = _fooUnion?.getOrCreateOffset(fbBuilder);
|
||||
fbBuilder.startTable(5);
|
||||
fbBuilder.addOffset(0, fooTableOffset);
|
||||
fbBuilder.addInt8(1, _fooEnum?.value);
|
||||
fbBuilder.addUint8(2, _fooUnionType?.value);
|
||||
fbBuilder.addOffset(3, fooUnionOffset);
|
||||
if (_fooStruct != null) {
|
||||
fbBuilder.addStruct(4, _fooStruct!.finish(fbBuilder));
|
||||
}
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
/// Convenience method to serialize to byte list.
|
||||
@override
|
||||
Uint8List toBytes([String? fileIdentifier]) {
|
||||
final fbBuilder = fb.Builder(deduplicateTables: false);
|
||||
fbBuilder.finish(finish(fbBuilder), fileIdentifier);
|
||||
return fbBuilder.buffer;
|
||||
}
|
||||
}
|
||||
class SecondTableInA {
|
||||
SecondTableInA._(this._bc, this._bcOffset);
|
||||
factory SecondTableInA(List<int> bytes) {
|
||||
final rootRef = fb.BufferContext.fromBytes(bytes);
|
||||
return reader.read(rootRef, 0);
|
||||
}
|
||||
|
||||
static const fb.Reader<SecondTableInA> reader = _SecondTableInAReader();
|
||||
|
||||
final fb.BufferContext _bc;
|
||||
final int _bcOffset;
|
||||
|
||||
namespace_c.TableInC? get referToC => namespace_c.TableInC.reader.vTableGetNullable(_bc, _bcOffset, 4);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SecondTableInA{referToC: $referToC}';
|
||||
}
|
||||
|
||||
SecondTableInAT unpack() => SecondTableInAT(
|
||||
referToC: referToC?.unpack());
|
||||
|
||||
static int pack(fb.Builder fbBuilder, SecondTableInAT? object) {
|
||||
if (object == null) return 0;
|
||||
return object.pack(fbBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
class SecondTableInAT implements fb.Packable {
|
||||
namespace_c.TableInCT? referToC;
|
||||
|
||||
SecondTableInAT({
|
||||
this.referToC});
|
||||
|
||||
@override
|
||||
int pack(fb.Builder fbBuilder) {
|
||||
final int? referToCOffset = referToC?.pack(fbBuilder);
|
||||
fbBuilder.startTable(1);
|
||||
fbBuilder.addOffset(0, referToCOffset);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SecondTableInAT{referToC: $referToC}';
|
||||
}
|
||||
}
|
||||
|
||||
class _SecondTableInAReader extends fb.TableReader<SecondTableInA> {
|
||||
const _SecondTableInAReader();
|
||||
|
||||
@override
|
||||
SecondTableInA createObject(fb.BufferContext bc, int offset) =>
|
||||
SecondTableInA._(bc, offset);
|
||||
}
|
||||
|
||||
class SecondTableInABuilder {
|
||||
SecondTableInABuilder(this.fbBuilder);
|
||||
|
||||
final fb.Builder fbBuilder;
|
||||
|
||||
void begin() {
|
||||
fbBuilder.startTable(1);
|
||||
}
|
||||
|
||||
int addReferToCOffset(int? offset) {
|
||||
fbBuilder.addOffset(0, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
int finish() {
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
}
|
||||
|
||||
class SecondTableInAObjectBuilder extends fb.ObjectBuilder {
|
||||
final namespace_c.TableInCObjectBuilder? _referToC;
|
||||
|
||||
SecondTableInAObjectBuilder({
|
||||
namespace_c.TableInCObjectBuilder? referToC,
|
||||
})
|
||||
: _referToC = referToC;
|
||||
|
||||
/// Finish building, and store into the [fbBuilder].
|
||||
@override
|
||||
int finish(fb.Builder fbBuilder) {
|
||||
final int? referToCOffset = _referToC?.getOrCreateOffset(fbBuilder);
|
||||
fbBuilder.startTable(1);
|
||||
fbBuilder.addOffset(0, referToCOffset);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
/// Convenience method to serialize to byte list.
|
||||
@override
|
||||
Uint8List toBytes([String? fileIdentifier]) {
|
||||
final fbBuilder = fb.Builder(deduplicateTables: false);
|
||||
fbBuilder.finish(finish(fbBuilder), fileIdentifier);
|
||||
return fbBuilder.buffer;
|
||||
}
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
|
||||
|
||||
library namespace_c;
|
||||
|
||||
import 'dart:typed_data' show Uint8List;
|
||||
import 'package:flat_buffers/flat_buffers.dart' as fb;
|
||||
|
||||
import './namespace_test2_namespace_a_generated.dart' as namespace_a;
|
||||
|
||||
class TableInC {
|
||||
TableInC._(this._bc, this._bcOffset);
|
||||
factory TableInC(List<int> bytes) {
|
||||
final rootRef = fb.BufferContext.fromBytes(bytes);
|
||||
return reader.read(rootRef, 0);
|
||||
}
|
||||
|
||||
static const fb.Reader<TableInC> reader = _TableInCReader();
|
||||
|
||||
final fb.BufferContext _bc;
|
||||
final int _bcOffset;
|
||||
|
||||
namespace_a.TableInFirstNS? get referToA1 => namespace_a.TableInFirstNS.reader.vTableGetNullable(_bc, _bcOffset, 4);
|
||||
namespace_a.SecondTableInA? get referToA2 => namespace_a.SecondTableInA.reader.vTableGetNullable(_bc, _bcOffset, 6);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInC{referToA1: $referToA1, referToA2: $referToA2}';
|
||||
}
|
||||
|
||||
TableInCT unpack() => TableInCT(
|
||||
referToA1: referToA1?.unpack(),
|
||||
referToA2: referToA2?.unpack());
|
||||
|
||||
static int pack(fb.Builder fbBuilder, TableInCT? object) {
|
||||
if (object == null) return 0;
|
||||
return object.pack(fbBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
class TableInCT implements fb.Packable {
|
||||
namespace_a.TableInFirstNST? referToA1;
|
||||
namespace_a.SecondTableInAT? referToA2;
|
||||
|
||||
TableInCT({
|
||||
this.referToA1,
|
||||
this.referToA2});
|
||||
|
||||
@override
|
||||
int pack(fb.Builder fbBuilder) {
|
||||
final int? referToA1Offset = referToA1?.pack(fbBuilder);
|
||||
final int? referToA2Offset = referToA2?.pack(fbBuilder);
|
||||
fbBuilder.startTable(2);
|
||||
fbBuilder.addOffset(0, referToA1Offset);
|
||||
fbBuilder.addOffset(1, referToA2Offset);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableInCT{referToA1: $referToA1, referToA2: $referToA2}';
|
||||
}
|
||||
}
|
||||
|
||||
class _TableInCReader extends fb.TableReader<TableInC> {
|
||||
const _TableInCReader();
|
||||
|
||||
@override
|
||||
TableInC createObject(fb.BufferContext bc, int offset) =>
|
||||
TableInC._(bc, offset);
|
||||
}
|
||||
|
||||
class TableInCBuilder {
|
||||
TableInCBuilder(this.fbBuilder);
|
||||
|
||||
final fb.Builder fbBuilder;
|
||||
|
||||
void begin() {
|
||||
fbBuilder.startTable(2);
|
||||
}
|
||||
|
||||
int addReferToA1Offset(int? offset) {
|
||||
fbBuilder.addOffset(0, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
int addReferToA2Offset(int? offset) {
|
||||
fbBuilder.addOffset(1, offset);
|
||||
return fbBuilder.offset;
|
||||
}
|
||||
|
||||
int finish() {
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
}
|
||||
|
||||
class TableInCObjectBuilder extends fb.ObjectBuilder {
|
||||
final namespace_a.TableInFirstNSObjectBuilder? _referToA1;
|
||||
final namespace_a.SecondTableInAObjectBuilder? _referToA2;
|
||||
|
||||
TableInCObjectBuilder({
|
||||
namespace_a.TableInFirstNSObjectBuilder? referToA1,
|
||||
namespace_a.SecondTableInAObjectBuilder? referToA2,
|
||||
})
|
||||
: _referToA1 = referToA1,
|
||||
_referToA2 = referToA2;
|
||||
|
||||
/// Finish building, and store into the [fbBuilder].
|
||||
@override
|
||||
int finish(fb.Builder fbBuilder) {
|
||||
final int? referToA1Offset = _referToA1?.getOrCreateOffset(fbBuilder);
|
||||
final int? referToA2Offset = _referToA2?.getOrCreateOffset(fbBuilder);
|
||||
fbBuilder.startTable(2);
|
||||
fbBuilder.addOffset(0, referToA1Offset);
|
||||
fbBuilder.addOffset(1, referToA2Offset);
|
||||
return fbBuilder.endTable();
|
||||
}
|
||||
|
||||
/// Convenience method to serialize to byte list.
|
||||
@override
|
||||
Uint8List toBytes([String? fileIdentifier]) {
|
||||
final fbBuilder = fb.Builder(deduplicateTables: false);
|
||||
fbBuilder.finish(finish(fbBuilder), fileIdentifier);
|
||||
return fbBuilder.buffer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user