Documentation ¶
Index ¶
- func WriteEncodeDecode(w io.Writer, p *Ptr, buf *bytes.Buffer) error
- func WriteEncodeDecodeTests(w io.Writer, s *Struct, buf *bytes.Buffer) error
- func WriteMarshalUnmarshal(w io.Writer, p *Ptr, buf *bytes.Buffer) error
- func WriteMarshalUnmarshalTests(w io.Writer, s *Struct, buf *bytes.Buffer) error
- type Array
- func (a *Array) Array() *Array
- func (a *Array) Base() *BaseElem
- func (a *Array) Map() *Map
- func (a *Array) Ptr() *Ptr
- func (a *Array) SetVarname(s string)
- func (a *Array) Slice() *Slice
- func (a *Array) String() string
- func (a *Array) Struct() *Struct
- func (a *Array) Type() ElemType
- func (a *Array) TypeName() string
- func (a *Array) Varname() string
- type Base
- type BaseElem
- func (s *BaseElem) Array() *Array
- func (s *BaseElem) Base() *BaseElem
- func (s *BaseElem) BaseName() string
- func (s *BaseElem) BaseType() string
- func (s *BaseElem) FromBase() string
- func (s *BaseElem) IsExt() bool
- func (s *BaseElem) IsIdent() bool
- func (s *BaseElem) IsIntf() bool
- func (s *BaseElem) Map() *Map
- func (s *BaseElem) Ptr() *Ptr
- func (s *BaseElem) SetVarname(a string)
- func (s *BaseElem) Slice() *Slice
- func (s *BaseElem) String() string
- func (s *BaseElem) Struct() *Struct
- func (s *BaseElem) ToBase() string
- func (s *BaseElem) Type() ElemType
- func (s *BaseElem) TypeName() string
- func (s *BaseElem) Varname() string
- type Elem
- type ElemType
- type Map
- func (m *Map) Array() *Array
- func (m *Map) Base() *BaseElem
- func (m *Map) Map() *Map
- func (m *Map) Ptr() *Ptr
- func (m *Map) SetVarname(s string)
- func (m *Map) Slice() *Slice
- func (m *Map) String() string
- func (m *Map) Struct() *Struct
- func (m *Map) Type() ElemType
- func (m *Map) TypeName() string
- func (m *Map) Varname() string
- type Ptr
- func (s *Ptr) Array() *Array
- func (s *Ptr) Base() *BaseElem
- func (s *Ptr) Map() *Map
- func (s *Ptr) Ptr() *Ptr
- func (s *Ptr) SetVarname(a string)
- func (s *Ptr) Slice() *Slice
- func (s *Ptr) String() string
- func (s *Ptr) Struct() *Struct
- func (s *Ptr) Type() ElemType
- func (s *Ptr) TypeName() string
- func (s *Ptr) Varname() string
- type Slice
- func (s *Slice) Array() *Array
- func (s *Slice) Base() *BaseElem
- func (s *Slice) Map() *Map
- func (s *Slice) Ptr() *Ptr
- func (s *Slice) SetVarname(a string)
- func (s *Slice) Slice() *Slice
- func (s *Slice) String() string
- func (s *Slice) Struct() *Struct
- func (s *Slice) Type() ElemType
- func (s *Slice) TypeName() string
- func (s *Slice) Varname() string
- type Struct
- func (s *Struct) Array() *Array
- func (s *Struct) Base() *BaseElem
- func (s *Struct) Map() *Map
- func (s *Struct) Ptr() *Ptr
- func (s *Struct) SetVarname(a string)
- func (s *Struct) Slice() *Slice
- func (s *Struct) String() string
- func (s *Struct) Struct() *Struct
- func (s *Struct) Type() ElemType
- func (s *Struct) TypeName() string
- func (s *Struct) Varname() string
- type StructField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteEncodeDecode ¶
WriteEncodeDecode writes the EncodeMsg, EncodeTo, DecodeMsg, and DecodeFrom methods, using buf as scratch space.
func WriteEncodeDecodeTests ¶
WriteEncodeDecodeTests writes tests for s.EncodeMsg and s.DecodeMsg, using buf as scratch space
func WriteMarshalUnmarshal ¶
WriteMarhsalUnmarshal writes the MarshalMsg, UnmarshalMsg, AppendMsg, and Maxsize methods using buf as scratch space.
Types ¶
type Array ¶
type Array struct { Index string // index variable name Size string // array size Els Elem // child // contains filtered or unexported fields }
func (*Array) SetVarname ¶
type Base ¶
type Base int
Base is one of the base types
const ( Invalid Base = iota Bytes String Float32 Float64 Complex64 Complex128 Uint Uint8 Uint16 Uint32 Uint64 Byte Int Int8 Int16 Int32 Int64 Bool Intf // interface{} Time // time.Time Ext // extension IDENT // IDENT means an unrecognized identifier )
this is effectively the list of currently available ReadXxxx / WriteXxxx methods.
type BaseElem ¶
type BaseElem struct { Value Base Ident string // IDENT name if unresolved Convert bool // should we do an explicit conversion? ShimToBase string // shim to base type ShimFromBase string // shim from base type // contains filtered or unexported fields }
func (*BaseElem) BaseName ¶
BaseName returns the string form of the base type (e.g. Float64, Ident, etc)
func (*BaseElem) FromBase ¶
FromBase, used if Convert==true, is used as {{Varname}} = {{FromBase}}(tmp)
func (*BaseElem) SetVarname ¶
type Elem ¶
type Elem interface { Type() ElemType // Returns element type // We need the following // because objects cannot // be type-asserted in templates. // Yes, this is gross. Ptr() *Ptr Slice() *Slice Struct() *Struct Base() *BaseElem Map() *Map Array() *Array // SetVarname sets this nodes // variable name and recursively // sets the names of all its children SetVarname(s string) // Varname is the variable // name of the node Varname() string // TypeName is the canonical // go type name of the node // e.g. "string", "int", "map[string]float64" TypeName() string // fmt.Stringer for debugging String() string }
Elem is Base, Slice, Stuct, Map, or Ptr
type Map ¶
type Map struct { Keyidx string // key variable name Validx string // value variable name Value Elem // contains filtered or unexported fields }
Map is a map[string]Elem
func (*Map) SetVarname ¶
type Ptr ¶
type Ptr struct { Value Elem // contains filtered or unexported fields }
func (*Ptr) SetVarname ¶
type Slice ¶
type Slice struct { Index string Els Elem // The type of each element // contains filtered or unexported fields }
func (*Slice) SetVarname ¶
type Struct ¶
type Struct struct { Name string // struct type name Fields []StructField // field list AsTuple bool // write as an array instead of a map }
func (*Struct) SetVarname ¶
type StructField ¶
func (StructField) String ¶
func (s StructField) String() string