當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Builder.PrependInt8Slot方法代碼示例

本文整理匯總了Golang中github.com/google/flatbuffers/go.Builder.PrependInt8Slot方法的典型用法代碼示例。如果您正苦於以下問題:Golang Builder.PrependInt8Slot方法的具體用法?Golang Builder.PrependInt8Slot怎麽用?Golang Builder.PrependInt8Slot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/google/flatbuffers/go.Builder的用法示例。


在下文中一共展示了Builder.PrependInt8Slot方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: MonsterAddColor

func MonsterAddColor(builder *flatbuffers.Builder, color int8) { builder.PrependInt8Slot(6, color, 8) }
開發者ID:BlueBrain,項目名稱:flatbuffers,代碼行數:1,代碼來源:Monster.go

示例2: TestSimpleTableWithEnumAddColor

func TestSimpleTableWithEnumAddColor(builder *flatbuffers.Builder, color int8) {
	builder.PrependInt8Slot(0, color, 2)
}
開發者ID:google,項目名稱:flatbuffers,代碼行數:3,代碼來源:TestSimpleTableWithEnum.go

示例3: CheckByteLayout


//.........這裏部分代碼省略.........
		0x34, 0x12, // value 1
		0, 0, 0, // padding
		55, // value 0
	})

	// test 15: vtable with 1 vector of 2 struct of 2 int8
	b = flatbuffers.NewBuilder(0)
	b.StartVector(flatbuffers.SizeInt8*2, 2, 1)
	b.PrependInt8(33)
	b.PrependInt8(44)
	b.PrependInt8(55)
	b.PrependInt8(66)
	vecend = b.EndVector(2)
	b.StartObject(1)
	b.PrependUOffsetTSlot(0, vecend, 0)
	b.EndObject()
	check([]byte{
		6, 0, // vtable bytes
		8, 0,
		4, 0, // offset of vector offset
		6, 0, 0, 0, // offset for start of vtable (int32)
		4, 0, 0, 0, // vector start offset

		2, 0, 0, 0, // vector length
		66, // vector value 1,1
		55, // vector value 1,0
		44, // vector value 0,1
		33, // vector value 0,0
	})

	// test 16: table with some elements
	b = flatbuffers.NewBuilder(0)
	b.StartObject(2)
	b.PrependInt8Slot(0, 33, 0)
	b.PrependInt16Slot(1, 66, 0)
	off := b.EndObject()
	b.Finish(off)

	check([]byte{
		12, 0, 0, 0, // root of table: points to vtable offset

		8, 0, // vtable bytes
		8, 0, // end of object from here
		7, 0, // start of value 0
		4, 0, // start of value 1

		8, 0, 0, 0, // offset for start of vtable (int32)

		66, 0, // value 1
		0,  // padding
		33, // value 0
	})

	// test 17: one unfinished table and one finished table
	b = flatbuffers.NewBuilder(0)
	b.StartObject(2)
	b.PrependInt8Slot(0, 33, 0)
	b.PrependInt8Slot(1, 44, 0)
	off = b.EndObject()
	b.Finish(off)

	b.StartObject(3)
	b.PrependInt8Slot(0, 55, 0)
	b.PrependInt8Slot(1, 66, 0)
	b.PrependInt8Slot(2, 77, 0)
	off = b.EndObject()
開發者ID:bunnyblue,項目名稱:flatbuffers,代碼行數:67,代碼來源:go_test.go

示例4: TableInFirstNSAddFooEnum

func TableInFirstNSAddFooEnum(builder *flatbuffers.Builder, fooEnum int8) {
	builder.PrependInt8Slot(1, fooEnum, 0)
}
開發者ID:google,項目名稱:flatbuffers,代碼行數:3,代碼來源:TableInFirstNS.go


注:本文中的github.com/google/flatbuffers/go.Builder.PrependInt8Slot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。