blob: bad852c97f07e59d2c1a1b7657164d6c8574fc2b [file] [log] [blame]
////////////////////////////////////////////////////////////////////////////////
// Do not modify!
// Generated by codergen
////////////////////////////////////////////////////////////////////////////////
package builder
import (
"android.googlesource.com/platform/tools/gpu/binary"
"android.googlesource.com/platform/tools/gpu/binary/any"
"android.googlesource.com/platform/tools/gpu/binary/schema"
"android.googlesource.com/platform/tools/gpu/gfxapi"
)
func init() {
Namespace.Add((*testStruct)(nil).Class())
Namespace.Add((*testAtom)(nil).Class())
}
var (
binaryIDtestStruct = binary.ID{0x93, 0x39, 0x46, 0x5d, 0x2e, 0x91, 0x59, 0x69, 0x3a, 0x17, 0x8d, 0x2f, 0xc2, 0x43, 0xb7, 0x33, 0x93, 0xcc, 0xb3, 0x4a}
binaryIDtestAtom = binary.ID{0x71, 0x4f, 0xb5, 0x0a, 0x96, 0x6a, 0x28, 0xb8, 0xc0, 0xd5, 0x05, 0x8a, 0x90, 0x9f, 0x37, 0x61, 0x15, 0xa5, 0xb0, 0x22}
)
type binaryClasstestStruct struct{}
func (*testStruct) Class() binary.Class {
return (*binaryClasstestStruct)(nil)
}
func doEncodetestStruct(e binary.Encoder, o *testStruct) error {
if err := e.String(o.Str); err != nil {
return err
}
if o.Ptr != nil {
if err := e.Object(o.Ptr); err != nil {
return err
}
} else if err := e.Object(nil); err != nil {
return err
}
return nil
}
func doDecodetestStruct(d binary.Decoder, o *testStruct) error {
if obj, err := d.String(); err != nil {
return err
} else {
o.Str = string(obj)
}
if obj, err := d.Object(); err != nil {
return err
} else if obj != nil {
o.Ptr = obj.(*testStruct)
} else {
o.Ptr = nil
}
return nil
}
func doSkiptestStruct(d binary.Decoder) error {
if err := d.SkipString(); err != nil {
return err
}
if _, err := d.SkipObject(); err != nil {
return err
}
return nil
}
func (*binaryClasstestStruct) ID() binary.ID { return binaryIDtestStruct }
func (*binaryClasstestStruct) New() binary.Object { return &testStruct{} }
func (*binaryClasstestStruct) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodetestStruct(e, obj.(*testStruct))
}
func (*binaryClasstestStruct) Decode(d binary.Decoder) (binary.Object, error) {
obj := &testStruct{}
return obj, doDecodetestStruct(d, obj)
}
func (*binaryClasstestStruct) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodetestStruct(d, obj.(*testStruct))
}
func (*binaryClasstestStruct) Skip(d binary.Decoder) error { return doSkiptestStruct(d) }
func (*binaryClasstestStruct) Schema() *schema.Class { return schematestStruct }
var schematestStruct = &schema.Class{
TypeID: binaryIDtestStruct,
Package: "builder",
Name: "testStruct",
Fields: []schema.Field{
{Declared: "Str", Type: &schema.Primitive{Name: "string", Method: schema.String}},
{Declared: "Ptr", Type: &schema.Pointer{Type: &schema.Struct{Name: "testStruct", ID: (*testStruct)(nil).Class().ID()}}},
},
}
type binaryClasstestAtom struct{}
func (*testAtom) Class() binary.Class {
return (*binaryClasstestAtom)(nil)
}
func doEncodetestAtom(e binary.Encoder, o *testAtom) error {
if err := e.ID(binary.ID(o.api)); err != nil {
return err
}
if err := e.String(o.Str); err != nil {
return err
}
if err := e.Uint32(uint32(len(o.Sli))); err != nil {
return err
}
for i := range o.Sli {
if err := e.Bool(o.Sli[i]); err != nil {
return err
}
}
if o.Any != nil {
var boxed binary.Object
boxed, err := any.Box(o.Any)
if err != nil {
return err
}
if err := e.Variant(boxed); err != nil {
return err
}
} else if err := e.Variant(nil); err != nil {
return err
}
if o.Ptr != nil {
if err := e.Object(o.Ptr); err != nil {
return err
}
} else if err := e.Object(nil); err != nil {
return err
}
if err := e.Uint32(uint32(len(o.Map))); err != nil {
return err
}
for k, v := range o.Map {
if err := e.String(k); err != nil {
return err
}
if err := e.String(v); err != nil {
return err
}
}
return nil
}
func doDecodetestAtom(d binary.Decoder, o *testAtom) error {
if obj, err := d.ID(); err != nil {
return err
} else {
o.api = gfxapi.ID(obj)
}
if obj, err := d.String(); err != nil {
return err
} else {
o.Str = string(obj)
}
if count, err := d.Uint32(); err != nil {
return err
} else {
o.Sli = make([]bool, count)
for i := range o.Sli {
if obj, err := d.Bool(); err != nil {
return err
} else {
o.Sli[i] = bool(obj)
}
}
}
if boxed, err := d.Variant(); err != nil {
return err
} else if boxed != nil {
if o.Any, err = any.Unbox(boxed); err != nil {
return err
}
} else {
o.Any = nil
}
if obj, err := d.Object(); err != nil {
return err
} else if obj != nil {
o.Ptr = obj.(*testStruct)
} else {
o.Ptr = nil
}
if count, err := d.Uint32(); err != nil {
return err
} else {
o.Map = make(map[string]string, count)
m := o.Map
for i := uint32(0); i < count; i++ {
var k string
var v string
if obj, err := d.String(); err != nil {
return err
} else {
k = string(obj)
}
if obj, err := d.String(); err != nil {
return err
} else {
v = string(obj)
}
m[k] = v
}
}
return nil
}
func doSkiptestAtom(d binary.Decoder) error {
if err := d.SkipID(); err != nil {
return err
}
if err := d.SkipString(); err != nil {
return err
}
if count, err := d.Uint32(); err != nil {
return err
} else {
for i := uint32(0); i < count; i++ {
if _, err := d.Bool(); err != nil {
return err
}
}
}
if _, err := d.SkipVariant(); err != nil {
return err
}
if _, err := d.SkipObject(); err != nil {
return err
}
if count, err := d.Uint32(); err != nil {
return err
} else {
for i := uint32(0); i < count; i++ {
if err := d.SkipString(); err != nil {
return err
}
if err := d.SkipString(); err != nil {
return err
}
}
}
return nil
}
func (*binaryClasstestAtom) ID() binary.ID { return binaryIDtestAtom }
func (*binaryClasstestAtom) New() binary.Object { return &testAtom{} }
func (*binaryClasstestAtom) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodetestAtom(e, obj.(*testAtom))
}
func (*binaryClasstestAtom) Decode(d binary.Decoder) (binary.Object, error) {
obj := &testAtom{}
return obj, doDecodetestAtom(d, obj)
}
func (*binaryClasstestAtom) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodetestAtom(d, obj.(*testAtom))
}
func (*binaryClasstestAtom) Skip(d binary.Decoder) error { return doSkiptestAtom(d) }
func (*binaryClasstestAtom) Schema() *schema.Class { return schematestAtom }
var schematestAtom = &schema.Class{
TypeID: binaryIDtestAtom,
Package: "builder",
Name: "testAtom",
Fields: []schema.Field{
{Declared: "api", Type: &schema.Primitive{Name: "gfxapi.ID", Method: schema.ID}},
{Declared: "Str", Type: &schema.Primitive{Name: "string", Method: schema.String}},
{Declared: "Sli", Type: &schema.Slice{Alias: "", ValueType: &schema.Primitive{Name: "bool", Method: schema.Bool}}},
{Declared: "Any", Type: &any.Any{}},
{Declared: "Ptr", Type: &schema.Pointer{Type: &schema.Struct{Name: "testStruct", ID: (*testStruct)(nil).Class().ID()}}},
{Declared: "Map", Type: &schema.Map{Alias: "", KeyType: &schema.Primitive{Name: "string", Method: schema.String}, ValueType: &schema.Primitive{Name: "string", Method: schema.String}}},
},
}