 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func IsPrintable(e Elem) bool
- type Array
- type BaseElem
- func (s *BaseElem) Alias(typ string)
- func (s *BaseElem) BaseName() string
- func (s *BaseElem) BaseType() string
- func (s *BaseElem) Complexity() int
- func (s *BaseElem) Copy() Elem
- func (s *BaseElem) FromBase() string
- func (s *BaseElem) Needsref(b bool)
- func (s *BaseElem) Printable() bool
- func (s *BaseElem) Resolved() bool
- func (s *BaseElem) SetVarname(a string)
- func (s *BaseElem) ToBase() string
- func (s *BaseElem) TypeName() string
- func (c *BaseElem) Varname() string
 
- type Elem
- type Map
- type Method
- type Primitive
- type Printer
- type Ptr
- type ShimMode
- type Slice
- type Struct
- type StructField
- type TransformPass
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPrintable ¶
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) Complexity ¶
func (*Array) SetVarname ¶
type BaseElem ¶
type BaseElem struct {
	ShimMode     ShimMode  // Method used to shim
	ShimToBase   string    // shim to base type, or empty
	ShimFromBase string    // shim from base type, or empty
	Value        Primitive // Type of element
	Convert      bool      // should we do an explicit conversion?
	// contains filtered or unexported fields
}
    BaseElem is an element that can be represented by a primitive MessagePack type.
func (*BaseElem) BaseName ¶
BaseName returns the string form of the base type (e.g. Float64, Ident, etc)
func (*BaseElem) Complexity ¶
func (*BaseElem) FromBase ¶
FromBase, used if Convert==true, is used as {{Varname}} = {{FromBase}}(tmp)
func (*BaseElem) Resolved ¶
Resolved returns whether or not the type of the element is a primitive or a builtin provided by the package.
func (*BaseElem) SetVarname ¶
type Elem ¶
type Elem interface {
	// SetVarname sets this nodes
	// variable name and recursively
	// sets the names of all its children.
	// In general, this should only be
	// called on the parent of the tree.
	SetVarname(s string)
	// Varname returns the variable
	// name of the element.
	Varname() string
	// TypeName is the canonical
	// go type name of the node
	// e.g. "string", "int", "map[string]float64"
	// OR the alias name, if it has been set.
	TypeName() string
	// Alias sets a type (alias) name
	Alias(typ string)
	// Copy should perform a deep copy of the object
	Copy() Elem
	// Complexity returns a measure of the
	// complexity of element (greater than
	// or equal to 1.)
	Complexity() int
	// contains filtered or unexported methods
}
    Elem is a go type capable of being serialized into MessagePack. It is implemented by *Ptr, *Struct, *Array, *Slice, *Map, and *BaseElem.
type Map ¶
type Map struct {
	Keyidx string // key variable name
	Keytmp string // tmp key variable name
	Validx string // value variable name
	Type   string // primitive key type
	Value  Elem   // value element
	// contains filtered or unexported fields
}
    Map is a map[string]Elem
func (*Map) Complexity ¶
func (*Map) SetVarname ¶
type Method ¶
type Method uint8
Method is a bitfield representing something that the generator knows how to print.
type Primitive ¶
type Primitive uint8
Base is one of the base types
const ( Invalid Primitive = 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 Printer ¶
type Printer struct {
	// contains filtered or unexported fields
}
    func (*Printer) ApplyDirective ¶
func (p *Printer) ApplyDirective(pass Method, t TransformPass)
ApplyDirective applies a directive to a named pass and all of its dependents.
type Ptr ¶
type Ptr struct {
	Value Elem
	// contains filtered or unexported fields
}
    func (*Ptr) Complexity ¶
func (*Ptr) SetVarname ¶
type Slice ¶
type Slice struct {
	Index string
	Els   Elem // The type of each element
	// contains filtered or unexported fields
}
    func (*Slice) Complexity ¶
func (*Slice) SetVarname ¶
type Struct ¶
type Struct struct {
	Fields  []StructField // field list
	AsTuple bool          // write as an array instead of a map
	// contains filtered or unexported fields
}
    func (*Struct) Complexity ¶
func (*Struct) SetVarname ¶
type StructField ¶
type TransformPass ¶
TransformPass is a pass that transforms individual elements. (Note that if the returned is different from the argument, it should not point to the same objects.)
func IgnoreTypename ¶
func IgnoreTypename(name string) TransformPass
IgnoreTypename is a pass that just ignores types of a given name.