|
|
@@ -18,15 +18,15 @@ const GenVersion = {{ .Version }}
|
|
|
// 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.
|
|
|
-//
|
|
|
+//
|
|
|
// To help enforce this, we create an unexported type with exported members.
|
|
|
// The only way to get the type is via the one exported type that we control (somewhat).
|
|
|
-//
|
|
|
+//
|
|
|
// When static codecs are created for types, they will use this value
|
|
|
// to perform encoding or decoding of primitives or known slice or map types.
|
|
|
|
|
|
// 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 encDriver) {
|
|
|
ge = genHelperEncoder{e:e}
|
|
|
@@ -35,7 +35,7 @@ func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee encDriver) {
|
|
|
}
|
|
|
|
|
|
// 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 decDriver) {
|
|
|
gd = genHelperDecoder{d:d}
|
|
|
@@ -114,13 +114,18 @@ 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*
|
|
|
+//
|
|
|
+// Deprecated: No longer used,
|
|
|
+// but leave in-place so that old generated files continue to work without regeneration.
|
|
|
func (f genHelperEncoder) HasExtensions() bool {
|
|
|
return len(f.e.h.extHandle) != 0
|
|
|
}
|
|
|
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
|
|
|
+//
|
|
|
+// Deprecated: No longer used,
|
|
|
+// but leave in-place so that old generated files continue to work without regeneration.
|
|
|
func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
|
|
|
- xfFn := f.e.h.getExt(i2rtid(v))
|
|
|
- if xfFn != nil {
|
|
|
+ if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil {
|
|
|
f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
|
|
|
return true
|
|
|
}
|
|
|
@@ -220,13 +225,18 @@ 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*
|
|
|
+//
|
|
|
+// Deprecated: No longer used,
|
|
|
+// but leave in-place so that old generated files continue to work without regeneration.
|
|
|
func (f genHelperDecoder) HasExtensions() bool {
|
|
|
return len(f.d.h.extHandle) != 0
|
|
|
}
|
|
|
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
|
|
|
+//
|
|
|
+// Deprecated: No longer used,
|
|
|
+// but leave in-place so that old generated files continue to work without regeneration.
|
|
|
func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
|
|
|
- xfFn := f.d.h.getExt(i2rtid(v))
|
|
|
- if xfFn != nil {
|
|
|
+ if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil {
|
|
|
f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
|
|
|
return true
|
|
|
}
|