123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- // comment this out // + build ignore
- // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
- // Use of this source code is governed by a MIT license found in the LICENSE file.
- // Code generated from gen-helper.go.tmpl - DO NOT EDIT.
- package codec
- import (
- "encoding"
- "reflect"
- )
- // GenVersion is the current version of codecgen.
- const GenVersion = 12
- // This file is used to generate helper code for codecgen.
- // The values here i.e. genHelper(En|De)coder are not to be used directly by
- // library users. They WILL change continuously and without notice.
- // GenHelperEncoder is exported so that it can be used externally by codecgen.
- //
- // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
- func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) {
- ge = genHelperEncoder{e: e}
- ee = genHelperEncDriver{encDriver: e.e}
- return
- }
- // GenHelperDecoder is exported so that it can be used externally by codecgen.
- //
- // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
- func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) {
- gd = genHelperDecoder{d: d}
- dd = genHelperDecDriver{decDriver: d.d}
- return
- }
- type genHelperEncDriver struct {
- encDriver
- }
- type genHelperDecDriver struct {
- decDriver
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- type genHelperEncoder struct {
- M must
- F fastpathT
- e *Encoder
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- type genHelperDecoder struct {
- C checkOverflow
- F fastpathT
- d *Decoder
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncBasicHandle() *BasicHandle {
- return f.e.h
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncBinary() bool {
- return f.e.be // f.e.hh.isBinaryEncoding()
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) IsJSONHandle() bool {
- return f.e.js
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncFallback(iv interface{}) {
- // f.e.encodeI(iv, false, false)
- f.e.encodeValue(reflect.ValueOf(iv), nil, false)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) {
- bs, fnerr := iv.MarshalText()
- f.e.marshalUtf8(bs, fnerr)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) {
- bs, fnerr := iv.MarshalJSON()
- f.e.marshalAsis(bs, fnerr)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
- bs, fnerr := iv.MarshalBinary()
- f.e.marshalRaw(bs, fnerr)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) I2Rtid(v interface{}) uintptr {
- return i2rtid(v)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) Extension(rtid uintptr) (xfn *extTypeTagFn) {
- return f.e.h.getExt(rtid)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) WriteStr(s string) {
- f.e.w().writestr(s)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteMapEnd() { f.e.mapEnd() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteArrayStart(length int) { f.e.arrayStart(length) }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteArrayEnd() { f.e.arrayEnd() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteArrayElem() { f.e.arrayElem() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() }
- // ---------------- DECODER FOLLOWS -----------------
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecBasicHandle() *BasicHandle {
- return f.d.h
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecBinary() bool {
- return f.d.be // f.d.hh.isBinaryEncoding()
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecSwallow() { f.d.swallow() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecScratchBuffer() []byte {
- return f.d.b[:]
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte {
- return &f.d.b
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- rv := reflect.ValueOf(iv)
- if chkPtr {
- rv = f.d.ensureDecodeable(rv)
- }
- f.d.decodeValue(rv, nil, false)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
- return f.d.decSliceHelperStart()
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecStructFieldNotFound(index int, name string) {
- f.d.structFieldNotFound(index, name)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
- f.d.arrayCannotExpand(sliceLen, streamLen)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil {
- panic(fnerr)
- }
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
- // bs := f.dd.DecodeStringAsBytes()
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil {
- panic(fnerr)
- }
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil {
- panic(fnerr)
- }
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) IsJSONHandle() bool {
- return f.d.js
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) I2Rtid(v interface{}) uintptr {
- return i2rtid(v)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) Extension(rtid uintptr) (xfn *extTypeTagFn) {
- return f.d.h.getExt(rtid)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) {
- return decInferLen(clen, maxlen, unit)
- }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadMapStart() int { return f.d.mapStart() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadMapEnd() { f.d.mapEnd() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadArrayStart() int { return f.d.arrayStart() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadArrayElem() { f.d.arrayElem() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadMapElemKey() { f.d.mapElemKey() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() }
- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
- func (f genHelperDecoder) DecDecodeFloat32() float64 { return f.d.decodeFloat32() }
|