mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-19 13:33:05 +00:00
Support binary search for struct in cpp (#4245)
* Support binary search for struct in cpp CreateVectorOfSortedStruct is provided for convenience. * fix continuous-integration error * add generated files * compile Ability.cs in csharp test * compile Ability.cs in csharp * modify according to code review
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
89041a1686
commit
a5cc2092a6
41
tests/MyGame/Example/Ability.go
Normal file
41
tests/MyGame/Example/Ability.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type Ability struct {
|
||||
_tab flatbuffers.Struct
|
||||
}
|
||||
|
||||
func (rcv *Ability) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *Ability) Table() flatbuffers.Table {
|
||||
return rcv._tab.Table
|
||||
}
|
||||
|
||||
func (rcv *Ability) Id() uint32 {
|
||||
return rcv._tab.GetUint32(rcv._tab.Pos + flatbuffers.UOffsetT(0))
|
||||
}
|
||||
func (rcv *Ability) MutateId(n uint32) bool {
|
||||
return rcv._tab.MutateUint32(rcv._tab.Pos+flatbuffers.UOffsetT(0), n)
|
||||
}
|
||||
|
||||
func (rcv *Ability) Distance() uint32 {
|
||||
return rcv._tab.GetUint32(rcv._tab.Pos + flatbuffers.UOffsetT(4))
|
||||
}
|
||||
func (rcv *Ability) MutateDistance(n uint32) bool {
|
||||
return rcv._tab.MutateUint32(rcv._tab.Pos+flatbuffers.UOffsetT(4), n)
|
||||
}
|
||||
|
||||
func CreateAbility(builder *flatbuffers.Builder, id uint32, distance uint32) flatbuffers.UOffsetT {
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependUint32(distance)
|
||||
builder.PrependUint32(id)
|
||||
return builder.Offset()
|
||||
}
|
||||
Reference in New Issue
Block a user