Example #1
0
func _Map_Point_Point_Read(m wire.MapItemList) ([]struct {
	Key   *structs.Point
	Value *structs.Point
}, error) {
	if m.KeyType() != wire.TStruct {
		return nil, nil
	}
	if m.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make([]struct {
		Key   *structs.Point
		Value *structs.Point
	}, 0, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _Point_Read(x.Key)
		if err != nil {
			return err
		}
		v, err := _Point_Read(x.Value)
		if err != nil {
			return err
		}
		o = append(o, struct {
			Key   *structs.Point
			Value *structs.Point
		}{k, v})
		return nil
	})
	m.Close()
	return o, err
}
Example #2
0
func _Map_Map_String_I32_I64_Read(m wire.MapItemList) ([]struct {
	Key   map[string]int32
	Value int64
}, error) {
	if m.KeyType() != wire.TMap {
		return nil, nil
	}
	if m.ValueType() != wire.TI64 {
		return nil, nil
	}
	o := make([]struct {
		Key   map[string]int32
		Value int64
	}, 0, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _Map_String_I32_Read(x.Key.GetMap())
		if err != nil {
			return err
		}
		v, err := x.Value.GetI64(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, struct {
			Key   map[string]int32
			Value int64
		}{k, v})
		return nil
	})
	m.Close()
	return o, err
}
Example #3
0
func _Map_List_I32_Set_I64_Read(m wire.MapItemList) ([]struct {
	Key   []int32
	Value map[int64]struct{}
}, error) {
	if m.KeyType() != wire.TList {
		return nil, nil
	}
	if m.ValueType() != wire.TSet {
		return nil, nil
	}
	o := make([]struct {
		Key   []int32
		Value map[int64]struct{}
	}, 0, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _List_I32_Read(x.Key.GetList())
		if err != nil {
			return err
		}
		v, err := _Set_I64_Read(x.Value.GetSet())
		if err != nil {
			return err
		}
		o = append(o, struct {
			Key   []int32
			Value map[int64]struct{}
		}{k, v})
		return nil
	})
	m.Close()
	return o, err
}
Example #4
0
func _Map_Binary_String_Read(m wire.MapItemList) ([]struct {
	Key   []byte
	Value string
}, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}
	if m.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make([]struct {
		Key   []byte
		Value string
	}, 0, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetBinary(), error(nil)
		if err != nil {
			return err
		}
		v, err := x.Value.GetString(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, struct {
			Key   []byte
			Value string
		}{k, v})
		return nil
	})
	m.Close()
	return o, err
}
Example #5
0
func _Map_I16_String_Read(m wire.MapItemList) (map[int16]string, error) {
	if m.KeyType() != wire.TI16 {
		return nil, nil
	}
	if m.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make(map[int16]string, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetI16(), error(nil)
		if err != nil {
			return err
		}
		v, err := x.Value.GetString(), error(nil)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
func _Map_UserId_Map_Numberz_Insanity_Read(m wire.MapItemList) (map[UserId]map[Numberz]*Insanity, error) {
	if m.KeyType() != wire.TI64 {
		return nil, nil
	}
	if m.ValueType() != wire.TMap {
		return nil, nil
	}
	o := make(map[UserId]map[Numberz]*Insanity, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _UserId_Read(x.Key)
		if err != nil {
			return err
		}
		v, err := _Map_Numberz_Insanity_Read(x.Value.GetMap())
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
func _Map_Numberz_Insanity_Read(m wire.MapItemList) (map[Numberz]*Insanity, error) {
	if m.KeyType() != wire.TI32 {
		return nil, nil
	}
	if m.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make(map[Numberz]*Insanity, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _Numberz_Read(x.Key)
		if err != nil {
			return err
		}
		v, err := _Insanity_Read(x.Value)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
Example #8
0
func _Map_I32_I32_Read(m wire.MapItemList) (map[int32]int32, error) {
	if m.KeyType() != wire.TI32 {
		return nil, nil
	}
	if m.ValueType() != wire.TI32 {
		return nil, nil
	}
	o := make(map[int32]int32, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetI32(), error(nil)
		if err != nil {
			return err
		}
		v, err := x.Value.GetI32(), error(nil)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
Example #9
0
func _Map_I64_Double_Read(m wire.MapItemList) (map[int64]float64, error) {
	if m.KeyType() != wire.TI64 {
		return nil, nil
	}
	if m.ValueType() != wire.TDouble {
		return nil, nil
	}
	o := make(map[int64]float64, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetI64(), error(nil)
		if err != nil {
			return err
		}
		v, err := x.Value.GetDouble(), error(nil)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
Example #10
0
func _Map_String_ArbitraryValue_Read(m wire.MapItemList) (map[string]*ArbitraryValue, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}
	if m.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make(map[string]*ArbitraryValue, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}
		v, err := _ArbitraryValue_Read(x.Value)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
Example #11
0
func _Map_ModuleID_Module_Read(m wire.MapItemList) (map[ModuleID]*Module, error) {
	if m.KeyType() != wire.TI32 {
		return nil, nil
	}
	if m.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make(map[ModuleID]*Module, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := _ModuleID_Read(x.Key)
		if err != nil {
			return err
		}
		v, err := _Module_Read(x.Value)
		if err != nil {
			return err
		}
		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}
Example #12
0
func (bw *Writer) writeMap(m wire.MapItemList) error {
	// ktype:1
	if err := bw.writeByte(byte(m.KeyType())); err != nil {
		return err
	}

	// vtype:1
	if err := bw.writeByte(byte(m.ValueType())); err != nil {
		return err
	}

	// length:4
	if err := bw.writeInt32(int32(m.Size())); err != nil {
		return err
	}

	return m.ForEach(bw.writeMapItem)
}