...

Source file src/github.com/google/flatbuffers/tests/MyGame/Example/StructOfStructs.go

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1  // Code generated by the FlatBuffers compiler. DO NOT EDIT.
     2  
     3  package Example
     4  
     5  import (
     6  	flatbuffers "github.com/google/flatbuffers/go"
     7  )
     8  
     9  type StructOfStructsT struct {
    10  	A *AbilityT `json:"a"`
    11  	B *TestT `json:"b"`
    12  	C *AbilityT `json:"c"`
    13  }
    14  
    15  func (t *StructOfStructsT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
    16  	if t == nil {
    17  		return 0
    18  	}
    19  	return CreateStructOfStructs(builder, t.A.Id, t.A.Distance, t.B.A, t.B.B, t.C.Id, t.C.Distance)
    20  }
    21  func (rcv *StructOfStructs) UnPackTo(t *StructOfStructsT) {
    22  	t.A = rcv.A(nil).UnPack()
    23  	t.B = rcv.B(nil).UnPack()
    24  	t.C = rcv.C(nil).UnPack()
    25  }
    26  
    27  func (rcv *StructOfStructs) UnPack() *StructOfStructsT {
    28  	if rcv == nil {
    29  		return nil
    30  	}
    31  	t := &StructOfStructsT{}
    32  	rcv.UnPackTo(t)
    33  	return t
    34  }
    35  
    36  type StructOfStructs struct {
    37  	_tab flatbuffers.Struct
    38  }
    39  
    40  func (rcv *StructOfStructs) Init(buf []byte, i flatbuffers.UOffsetT) {
    41  	rcv._tab.Bytes = buf
    42  	rcv._tab.Pos = i
    43  }
    44  
    45  func (rcv *StructOfStructs) Table() flatbuffers.Table {
    46  	return rcv._tab.Table
    47  }
    48  
    49  func (rcv *StructOfStructs) A(obj *Ability) *Ability {
    50  	if obj == nil {
    51  		obj = new(Ability)
    52  	}
    53  	obj.Init(rcv._tab.Bytes, rcv._tab.Pos+0)
    54  	return obj
    55  }
    56  func (rcv *StructOfStructs) B(obj *Test) *Test {
    57  	if obj == nil {
    58  		obj = new(Test)
    59  	}
    60  	obj.Init(rcv._tab.Bytes, rcv._tab.Pos+8)
    61  	return obj
    62  }
    63  func (rcv *StructOfStructs) C(obj *Ability) *Ability {
    64  	if obj == nil {
    65  		obj = new(Ability)
    66  	}
    67  	obj.Init(rcv._tab.Bytes, rcv._tab.Pos+12)
    68  	return obj
    69  }
    70  
    71  func CreateStructOfStructs(builder *flatbuffers.Builder, a_id uint32, a_distance uint32, b_a int16, b_b int8, c_id uint32, c_distance uint32) flatbuffers.UOffsetT {
    72  	builder.Prep(4, 20)
    73  	builder.Prep(4, 8)
    74  	builder.PrependUint32(c_distance)
    75  	builder.PrependUint32(c_id)
    76  	builder.Prep(2, 4)
    77  	builder.Pad(1)
    78  	builder.PrependInt8(b_b)
    79  	builder.PrependInt16(b_a)
    80  	builder.Prep(4, 8)
    81  	builder.PrependUint32(a_distance)
    82  	builder.PrependUint32(a_id)
    83  	return builder.Offset()
    84  }
    85  

View as plain text