func (x *RawResponse) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys6Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys6Slc
	var yyhl6 bool = l >= 0
	for yyj6 := 0; ; yyj6++ {
		if yyhl6 {
			if yyj6 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
			if yyj6 > 0 {
				r.ReadMapEntrySeparator()
			}
		}
		yys6Slc = r.DecodeBytes(yys6Slc, true, true)
		yys6 := string(yys6Slc)
		if !yyhl6 {
			r.ReadMapKVSeparator()
		}
		switch yys6 {
		case "StatusCode":
			if r.TryDecodeAsNil() {
				x.StatusCode = 0
			} else {
				x.StatusCode = int(r.DecodeInt(codecSelferBitsize4402))
			}
		case "Body":
			if r.TryDecodeAsNil() {
				x.Body = nil
			} else {
				yyv8 := &x.Body
				*yyv8 = r.DecodeBytes(*(*[]byte)(yyv8), false, false)
			}
		case "Header":
			if r.TryDecodeAsNil() {
				x.Header = nil
			} else {
				yyv9 := &x.Header
				h.dechttp_Header((*http.Header)(yyv9), d)
			}
		default:
			z.DecStructFieldNotFound(-1, yys6)
		} // end switch yys6
	} // end for yyj6
	if !yyhl6 {
		r.ReadMapEnd()
	}
}
func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	if r.IsContainerType(codecSelverValueTypeMap4402) {
		yyl45 := r.ReadMapStart()
		if yyl45 == 0 {
			r.ReadMapEnd()
		} else {
			x.codecDecodeSelfFromMap(yyl45, d)
		}
	} else if r.IsContainerType(codecSelverValueTypeArray4402) {
		yyl45 := r.ReadArrayStart()
		if yyl45 == 0 {
			r.ReadArrayEnd()
		} else {
			x.codecDecodeSelfFromArray(yyl45, d)
		}
	} else {
		panic(codecSelferOnlyMapOrArrayEncodeToStructErr4402)
	}
}
func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys46Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys46Slc
	var yyhl46 bool = l >= 0
	for yyj46 := 0; ; yyj46++ {
		if yyhl46 {
			if yyj46 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
			if yyj46 > 0 {
				r.ReadMapEntrySeparator()
			}
		}
		yys46Slc = r.DecodeBytes(yys46Slc, true, true)
		yys46 := string(yys46Slc)
		if !yyhl46 {
			r.ReadMapKVSeparator()
		}
		switch yys46 {
		case "key":
			if r.TryDecodeAsNil() {
				x.Key = ""
			} else {
				x.Key = string(r.DecodeString())
			}
		case "value":
			if r.TryDecodeAsNil() {
				x.Value = ""
			} else {
				x.Value = string(r.DecodeString())
			}
		case "dir":
			if r.TryDecodeAsNil() {
				x.Dir = false
			} else {
				x.Dir = bool(r.DecodeBool())
			}
		case "expiration":
			if r.TryDecodeAsNil() {
				if x.Expiration != nil {
					x.Expiration = nil
				}
			} else {
				if x.Expiration == nil {
					x.Expiration = new(time.Time)
				}
				z.DecFallback(x.Expiration, false)
			}
		case "ttl":
			if r.TryDecodeAsNil() {
				x.TTL = 0
			} else {
				x.TTL = int64(r.DecodeInt(64))
			}
		case "nodes":
			if r.TryDecodeAsNil() {
				x.Nodes = nil
			} else {
				yyv52 := &x.Nodes
				yyv52.CodecDecodeSelf(d)
			}
		case "modifiedIndex":
			if r.TryDecodeAsNil() {
				x.ModifiedIndex = 0
			} else {
				x.ModifiedIndex = uint64(r.DecodeUint(64))
			}
		case "createdIndex":
			if r.TryDecodeAsNil() {
				x.CreatedIndex = 0
			} else {
				x.CreatedIndex = uint64(r.DecodeUint(64))
			}
		default:
			z.DecStructFieldNotFound(-1, yys46)
		} // end switch yys46
	} // end for yyj46
	if !yyhl46 {
		r.ReadMapEnd()
	}
}
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj29 int
	var yyb29 bool
	var yyhl29 bool = l >= 0
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Action = ""
	} else {
		x.Action = string(r.DecodeString())
	}
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		if x.Node != nil {
			x.Node = nil
		}
	} else {
		if x.Node == nil {
			x.Node = new(Node)
		}
		x.Node.CodecDecodeSelf(d)
	}
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		if x.PrevNode != nil {
			x.PrevNode = nil
		}
	} else {
		if x.PrevNode == nil {
			x.PrevNode = new(Node)
		}
		x.PrevNode.CodecDecodeSelf(d)
	}
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.EtcdIndex = 0
	} else {
		x.EtcdIndex = uint64(r.DecodeUint(64))
	}
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.RaftIndex = 0
	} else {
		x.RaftIndex = uint64(r.DecodeUint(64))
	}
	yyj29++
	if yyhl29 {
		yyb29 = yyj29 > l
	} else {
		yyb29 = r.CheckBreak()
	}
	if yyb29 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.RaftTerm = 0
	} else {
		x.RaftTerm = uint64(r.DecodeUint(64))
	}
	for {
		yyj29++
		if yyhl29 {
			yyb29 = yyj29 > l
		} else {
			yyb29 = r.CheckBreak()
		}
		if yyb29 {
			break
		}
		if yyj29 > 1 {
			r.ReadArrayEntrySeparator()
		}
		z.DecStructFieldNotFound(yyj29-1, "")
	}
	r.ReadArrayEnd()
}
func (x *responseType) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	*((*int)(x)) = int(r.DecodeInt(codecSelferBitsize4402))
}
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys22Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys22Slc
	var yyhl22 bool = l >= 0
	for yyj22 := 0; ; yyj22++ {
		if yyhl22 {
			if yyj22 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
			if yyj22 > 0 {
				r.ReadMapEntrySeparator()
			}
		}
		yys22Slc = r.DecodeBytes(yys22Slc, true, true)
		yys22 := string(yys22Slc)
		if !yyhl22 {
			r.ReadMapKVSeparator()
		}
		switch yys22 {
		case "action":
			if r.TryDecodeAsNil() {
				x.Action = ""
			} else {
				x.Action = string(r.DecodeString())
			}
		case "node":
			if r.TryDecodeAsNil() {
				if x.Node != nil {
					x.Node = nil
				}
			} else {
				if x.Node == nil {
					x.Node = new(Node)
				}
				x.Node.CodecDecodeSelf(d)
			}
		case "prevNode":
			if r.TryDecodeAsNil() {
				if x.PrevNode != nil {
					x.PrevNode = nil
				}
			} else {
				if x.PrevNode == nil {
					x.PrevNode = new(Node)
				}
				x.PrevNode.CodecDecodeSelf(d)
			}
		case "etcdIndex":
			if r.TryDecodeAsNil() {
				x.EtcdIndex = 0
			} else {
				x.EtcdIndex = uint64(r.DecodeUint(64))
			}
		case "raftIndex":
			if r.TryDecodeAsNil() {
				x.RaftIndex = 0
			} else {
				x.RaftIndex = uint64(r.DecodeUint(64))
			}
		case "raftTerm":
			if r.TryDecodeAsNil() {
				x.RaftTerm = 0
			} else {
				x.RaftTerm = uint64(r.DecodeUint(64))
			}
		default:
			z.DecStructFieldNotFound(-1, yys22)
		} // end switch yys22
	} // end for yyj22
	if !yyhl22 {
		r.ReadMapEnd()
	}
}
func (x *RawResponse) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj10 int
	var yyb10 bool
	var yyhl10 bool = l >= 0
	yyj10++
	if yyhl10 {
		yyb10 = yyj10 > l
	} else {
		yyb10 = r.CheckBreak()
	}
	if yyb10 {
		r.ReadArrayEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.StatusCode = 0
	} else {
		x.StatusCode = int(r.DecodeInt(codecSelferBitsize4402))
	}
	yyj10++
	if yyhl10 {
		yyb10 = yyj10 > l
	} else {
		yyb10 = r.CheckBreak()
	}
	if yyb10 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.Body = nil
	} else {
		yyv12 := &x.Body
		*yyv12 = r.DecodeBytes(*(*[]byte)(yyv12), false, false)
	}
	yyj10++
	if yyhl10 {
		yyb10 = yyj10 > l
	} else {
		yyb10 = r.CheckBreak()
	}
	if yyb10 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.Header = nil
	} else {
		yyv13 := &x.Header
		h.dechttp_Header((*http.Header)(yyv13), d)
	}
	for {
		yyj10++
		if yyhl10 {
			yyb10 = yyj10 > l
		} else {
			yyb10 = r.CheckBreak()
		}
		if yyb10 {
			break
		}
		if yyj10 > 1 {
			r.ReadArrayEntrySeparator()
		}
		z.DecStructFieldNotFound(yyj10-1, "")
	}
	r.ReadArrayEnd()
}
func (x codecSelfer4402) decNodes(v *Nodes, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r

	yyv71 := *v
	yyh71, yyl71 := z.DecSliceHelperStart()

	var yyc71 bool
	if yyv71 == nil {
		if yyl71 <= 0 {
			yyv71 = make(Nodes, 0)
		} else {
			yyv71 = make(Nodes, yyl71)
		}
		yyc71 = true
	}

	if yyl71 == 0 {
		if len(yyv71) != 0 {
			yyv71 = yyv71[:0]
			yyc71 = true
		}
	} else if yyl71 > 0 {

		yyn71 := yyl71
		if yyl71 > cap(yyv71) {
			yyv71 = make([]*Node, yyl71, yyl71)
			yyc71 = true

		} else if yyl71 != len(yyv71) {
			yyv71 = yyv71[:yyl71]
			yyc71 = true
		}
		yyj71 := 0
		for ; yyj71 < yyn71; yyj71++ {
			if r.TryDecodeAsNil() {
				if yyv71[yyj71] != nil {
					*yyv71[yyj71] = Node{}
				}
			} else {
				if yyv71[yyj71] == nil {
					yyv71[yyj71] = new(Node)
				}
				yyw72 := yyv71[yyj71]
				yyw72.CodecDecodeSelf(d)
			}

		}

	} else {
		for yyj71 := 0; !r.CheckBreak(); yyj71++ {
			if yyj71 >= len(yyv71) {
				yyv71 = append(yyv71, nil) // var yyz71 *Node
				yyc71 = true
			}
			if yyj71 > 0 {
				yyh71.Sep(yyj71)
			}

			if yyj71 < len(yyv71) {
				if r.TryDecodeAsNil() {
					if yyv71[yyj71] != nil {
						*yyv71[yyj71] = Node{}
					}
				} else {
					if yyv71[yyj71] == nil {
						yyv71[yyj71] = new(Node)
					}
					yyw73 := yyv71[yyj71]
					yyw73.CodecDecodeSelf(d)
				}

			} else {
				z.DecSwallow()
			}

		}
		yyh71.End()
	}
	if yyc71 {
		*v = yyv71
	}
}
func (x codecSelfer4402) dechttp_Header(v *http.Header, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r

	yyv65 := *v
	yyl65 := r.ReadMapStart()
	if yyv65 == nil {
		if yyl65 > 0 {
			yyv65 = make(map[string][]string, yyl65)
		} else {
			yyv65 = make(map[string][]string) // supports indefinite-length, etc
		}
		*v = yyv65
	}
	if yyl65 > 0 {
		for yyj65 := 0; yyj65 < yyl65; yyj65++ {
			var yymk65 string
			if r.TryDecodeAsNil() {
				yymk65 = ""
			} else {
				yymk65 = string(r.DecodeString())
			}

			yymv65 := yyv65[yymk65]
			if r.TryDecodeAsNil() {
				yymv65 = nil
			} else {
				yyv67 := &yymv65
				z.F.DecSliceStringX(yyv67, false, d)
			}

			if yyv65 != nil {
				yyv65[yymk65] = yymv65
			}
		}
	} else if yyl65 < 0 {
		for yyj65 := 0; !r.CheckBreak(); yyj65++ {
			if yyj65 > 0 {
				r.ReadMapEntrySeparator()
			}
			var yymk65 string
			if r.TryDecodeAsNil() {
				yymk65 = ""
			} else {
				yymk65 = string(r.DecodeString())
			}

			r.ReadMapKVSeparator()
			yymv65 := yyv65[yymk65]
			if r.TryDecodeAsNil() {
				yymv65 = nil
			} else {
				yyv69 := &yymv65
				z.F.DecSliceStringX(yyv69, false, d)
			}

			if yyv65 != nil {
				yyv65[yymk65] = yymv65
			}
		}
		r.ReadMapEnd()
	} // else len==0: TODO: Should we clear map entries?
}
Esempio n. 10
0
func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	h.decNodes((*Nodes)(x), d)
}
Esempio n. 11
0
func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer4402
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj55 int
	var yyb55 bool
	var yyhl55 bool = l >= 0
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Key = ""
	} else {
		x.Key = string(r.DecodeString())
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.Value = ""
	} else {
		x.Value = string(r.DecodeString())
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.Dir = false
	} else {
		x.Dir = bool(r.DecodeBool())
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		if x.Expiration != nil {
			x.Expiration = nil
		}
	} else {
		if x.Expiration == nil {
			x.Expiration = new(time.Time)
		}
		z.DecFallback(x.Expiration, false)
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.TTL = 0
	} else {
		x.TTL = int64(r.DecodeInt(64))
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.Nodes = nil
	} else {
		yyv61 := &x.Nodes
		yyv61.CodecDecodeSelf(d)
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.ModifiedIndex = 0
	} else {
		x.ModifiedIndex = uint64(r.DecodeUint(64))
	}
	yyj55++
	if yyhl55 {
		yyb55 = yyj55 > l
	} else {
		yyb55 = r.CheckBreak()
	}
	if yyb55 {
		r.ReadArrayEnd()
		return
	}
	r.ReadArrayEntrySeparator()
	if r.TryDecodeAsNil() {
		x.CreatedIndex = 0
	} else {
		x.CreatedIndex = uint64(r.DecodeUint(64))
	}
	for {
		yyj55++
		if yyhl55 {
			yyb55 = yyj55 > l
		} else {
			yyb55 = r.CheckBreak()
		}
		if yyb55 {
			break
		}
		if yyj55 > 1 {
			r.ReadArrayEntrySeparator()
		}
		z.DecStructFieldNotFound(yyj55-1, "")
	}
	r.ReadArrayEnd()
}