Documentation ¶
Index ¶
- Constants
- Variables
- func CleanMethodName(name string) string
- func CleanName(name string) string
- func CleanVarName(i int, name string) string
- func GenerateType(v Type, packageName string, w io.Writer) error
- func Print(v Type) string
- func TypeIsObjectReference(t Type) bool
- func ValidName(name string) string
- type EnumMember
- type EnumType
- func (e *EnumType) Marshal(id string, writer string) *Statement
- func (e *EnumType) Reader() TypeReader
- func (e *EnumType) RegisterTo(set *TypeSet)
- func (e *EnumType) Signature() string
- func (e *EnumType) SignatureIDL() string
- func (e *EnumType) Type() reflect.Type
- func (e *EnumType) TypeDeclaration(file *jen.File)
- func (e *EnumType) TypeName() *Statement
- func (e *EnumType) Unmarshal(reader string) *Statement
- type ListType
- func (l *ListType) Marshal(listID string, writer string) *Statement
- func (l *ListType) Reader() TypeReader
- func (l *ListType) RegisterTo(s *TypeSet)
- func (l *ListType) Signature() string
- func (l *ListType) SignatureIDL() string
- func (l *ListType) Type() reflect.Type
- func (l *ListType) TypeDeclaration(file *jen.File)
- func (l *ListType) TypeName() *Statement
- func (l *ListType) Unmarshal(reader string) *Statement
- type MapType
- func (m *MapType) Marshal(mapID string, writer string) *Statement
- func (m *MapType) Reader() TypeReader
- func (m *MapType) RegisterTo(s *TypeSet)
- func (m *MapType) Signature() string
- func (m *MapType) SignatureIDL() string
- func (m *MapType) Type() reflect.Type
- func (m *MapType) TypeDeclaration(file *jen.File)
- func (m *MapType) TypeName() *Statement
- func (m *MapType) Unmarshal(reader string) *Statement
- type MemberType
- type Node
- type Statement
- type StructType
- func (s *StructType) Marshal(structID string, writer string) *Statement
- func (s *StructType) Reader() TypeReader
- func (s *StructType) RegisterTo(set *TypeSet)
- func (s *StructType) Signature() string
- func (s *StructType) SignatureIDL() string
- func (s *StructType) Type() reflect.Type
- func (s *StructType) TypeDeclaration(file *jen.File)
- func (s *StructType) TypeName() *Statement
- func (s *StructType) Unmarshal(reader string) *Statement
- type TupleType
- func (t *TupleType) ConvertMetaObjects()
- func (t *TupleType) Marshal(tupleID string, writer string) *Statement
- func (t *TupleType) ParamIDL() string
- func (t *TupleType) Params() *Statement
- func (t *TupleType) Reader() TypeReader
- func (t *TupleType) RegisterTo(s *TypeSet)
- func (t *TupleType) Signature() string
- func (t *TupleType) SignatureIDL() string
- func (t *TupleType) Type() reflect.Type
- func (t *TupleType) TypeDeclaration(*jen.File)
- func (t *TupleType) TypeName() *Statement
- func (t *TupleType) Unmarshal(reader string) *Statement
- type Type
- func NewBoolType() Type
- func NewDoubleType() Type
- func NewEnumType(name string, values map[string]int) Type
- func NewFloatType() Type
- func NewInt16Type() Type
- func NewInt8Type() Type
- func NewIntType() Type
- func NewLongType() Type
- func NewMetaObjectType() Type
- func NewObjectType() Type
- func NewStringType() Type
- func NewULongType() Type
- func NewUint16Type() Type
- func NewUint8Type() Type
- func NewUintType() Type
- func NewUnknownType() Type
- func NewValueType() Type
- func NewVoidType() Type
- func Parse(input string) (Type, error)
- type TypeReader
- type TypeSet
- type UnknownReader
Constants ¶
const MetaObjectSignature = "" /* 287-byte string literal not displayed */
MetaObjectSignature is the signature of MetaObject. It is used to generate the MetaObject struct which is used to generate the services. This step is referred as stage 1.
Variables ¶
var ObjectSignature = fmt.Sprintf("(%sII)<ObjectReference,metaObject,serviceID,objectID>", MetaObjectSignature)
ObjectSignature is the signature of ObjectReference.
Functions ¶
func CleanMethodName ¶
func CleanVarName ¶
func GenerateType ¶
GenerateType generate the code required to serialize the given type.
func TypeIsObjectReference ¶
Types ¶
type EnumMember ¶
EnumMember is used during Enum parsing
type EnumType ¶
EnumType represents a const.
func (*EnumType) Marshal ¶
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
func (*EnumType) RegisterTo ¶
RegisterTo adds the enum to the type set.
func (*EnumType) SignatureIDL ¶
SignatureIDL returns the name of the enum.
func (*EnumType) TypeDeclaration ¶
TypeDeclaration writes the type declaration into file.
type ListType ¶
type ListType struct {
// contains filtered or unexported fields
}
ListType represents a slice.
func NewListType ¶
NewListType is a contructor for the representation of a slice.
func (*ListType) Marshal ¶
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
func (*ListType) RegisterTo ¶
RegisterTo adds the type to the TypeSet.
func (*ListType) Signature ¶
Signature returns "[<signature>]" where <signature> is the signature of the type of the list.
func (*ListType) SignatureIDL ¶
SignatureIDL returns "Vec<signature>" where "signature" is the IDL signature of the type of the list.
func (*ListType) TypeDeclaration ¶
TypeDeclaration writes the type declaration into file.
type MapType ¶
type MapType struct {
// contains filtered or unexported fields
}
MapType represents a map.
func NewMapType ¶
NewMapType is a contructor for the representation of a map.
func (*MapType) Marshal ¶
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
func (*MapType) RegisterTo ¶
RegisterTo adds the type to the TypeSet.
func (*MapType) Signature ¶
Signature returns "{<signature key><signature value>}" where <signature key> is the signature of the key and <signature value> the signature of the value.
func (*MapType) SignatureIDL ¶
SignatureIDL returns "map<key><value>" where "key" is the IDL signature of the key and "value" the IDL signature of the value.
func (*MapType) TypeDeclaration ¶
TypeDeclaration writes the type declaration into file.
type MemberType ¶
MemberType a field in a struct.
func NewMemberType ¶
func NewMemberType(name string, value Type) MemberType
NewMemberType is a contructor for the representation of a field in a struct.
type StructType ¶
type StructType struct { Name string Members []MemberType }
StructType represents a struct.
func NewStructType ¶
func NewStructType(name string, members []MemberType) *StructType
NewStructType is a contructor for the representation of a struct.
func (*StructType) Marshal ¶
func (s *StructType) Marshal(structID string, writer string) *Statement
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
func (*StructType) Reader ¶
func (s *StructType) Reader() TypeReader
Reader returns a struct TypeReader.
func (*StructType) RegisterTo ¶
func (s *StructType) RegisterTo(set *TypeSet)
RegisterTo adds the type to the TypeSet. Structure name is updated if needed after collision resolution. Register search if a type is in the TypeSet under a given name. If the same name and signature is already present it does nothing. otherwise it adds the type and search for a new which does not conflict with the names already present.
func (*StructType) Signature ¶
func (s *StructType) Signature() string
Signature returns the signature of the struct.
func (*StructType) SignatureIDL ¶
func (s *StructType) SignatureIDL() string
SignatureIDL returns the idl signature of the struct.
func (*StructType) Type ¶
func (s *StructType) Type() reflect.Type
Type returns the Go representation of the type.
func (*StructType) TypeDeclaration ¶
func (s *StructType) TypeDeclaration(file *jen.File)
TypeDeclaration writes the type declaration into file.
func (*StructType) TypeName ¶
func (s *StructType) TypeName() *Statement
TypeName returns a statement to be inserted when the type is to be declared.
func (*StructType) Unmarshal ¶
func (s *StructType) Unmarshal(reader string) *Statement
Unmarshal returns a statement which represent the code needed to read from a reader "reader" of type io.Reader and returns both the value read and an error.
type TupleType ¶
type TupleType struct {
Members []MemberType
}
TupleType a list of a parameter of a method.
func NewTupleType ¶
NewTupleType is a contructor for the representation of a series of types. Used to describe a method parameters list.
func (*TupleType) ConvertMetaObjects ¶
func (t *TupleType) ConvertMetaObjects()
ConvertMetaObjects replace any element type which has the same signature as MetaObject with an element of the type object.MetaObject. This is required to generate proxy services which implements the object.Object interface and avoid a circular dependency.
func (*TupleType) Marshal ¶
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
func (*TupleType) ParamIDL ¶
ParamIDL returns "name1 signature1, name2 signature2" where signatureX is the signature of the elements.
func (*TupleType) Params ¶
Params returns a statement representing the list of parameter of a method.
func (*TupleType) RegisterTo ¶
RegisterTo adds the type to the TypeSet.
func (*TupleType) Signature ¶
Signature returns "(<signature 1><signature 2>...)" where <signature X> is the signature of the elements.
func (*TupleType) SignatureIDL ¶
SignatureIDL returns "Tuple<signature1,signature2>" where signatureX is the signature of the elements.
func (*TupleType) TypeDeclaration ¶
TypeDeclaration writes the type declaration into file.
type Type ¶
type Type interface { Signature() string SignatureIDL() string TypeName() *Statement TypeDeclaration(*jen.File) RegisterTo(s *TypeSet) Marshal(id string, writer string) *Statement // returns an error Unmarshal(reader string) *Statement // returns (type, err) Reader() TypeReader Type() reflect.Type }
Type represents a type of a signature or a type embedded inside a signature. Type represents types for primitive types (int, long, float, string), vectors of a type, associative maps and structures.
func NewBoolType ¶
func NewBoolType() Type
NewBoolType is a contructor for the representation of a bool.
func NewDoubleType ¶
func NewDoubleType() Type
NewDoubleType is a contructor for the representation of a float32.
func NewEnumType ¶
NewEnumType returns an enum type
func NewFloatType ¶
func NewFloatType() Type
NewFloatType is a contructor for the representation of a float32.
func NewInt16Type ¶
func NewInt16Type() Type
NewInt16Type is a contructor for the representation of a uint64.
func NewInt8Type ¶
func NewInt8Type() Type
NewInt8Type is a contructor for the representation of a uint64.
func NewIntType ¶
func NewIntType() Type
NewIntType is a contructor for the representation of an int32.
func NewLongType ¶
func NewLongType() Type
NewLongType is a contructor for the representation of a uint64.
func NewMetaObjectType ¶
func NewMetaObjectType() Type
NewMetaObjectType is a contructor for the representation of an object.
func NewObjectType ¶
func NewObjectType() Type
NewObjectType is a contructor for the representation of a Value.
func NewStringType ¶
func NewStringType() Type
NewStringType is a contructor for the representation of a string.
func NewULongType ¶
func NewULongType() Type
NewULongType is a contructor for the representation of a uint64.
func NewUint16Type ¶
func NewUint16Type() Type
NewUint16Type is a contructor for the representation of a uint64.
func NewUint8Type ¶
func NewUint8Type() Type
NewUint8Type is a contructor for the representation of a uint64.
func NewUintType ¶
func NewUintType() Type
NewUIntType is a contructor for the representation of an uint32.
func NewUnknownType ¶
func NewUnknownType() Type
NewUnknownType is a contructor for an unknown type.
func NewValueType ¶
func NewValueType() Type
NewValueType is a contructor for the representation of a Value.
func NewVoidType ¶
func NewVoidType() Type
NewVoidType is a contructor for the representation of the absence of a return type. Only used in the context of a returned type.
type TypeReader ¶
TypeReader reads from r the bytes representing the type
func MakeReader ¶
func MakeReader(sig string) (TypeReader, error)
MakeReader parse the signature and returns its associated Reader.
type TypeSet ¶
TypeSet is a container which contains exactly one instance of each Type currently generated. It is used to generate the type declaration only once.
func (*TypeSet) ResolveCollision ¶
ResolveCollision returns a type name not already present in the set. If name if not present, returns name, else it returns a new string derived from name.
type UnknownReader ¶
type UnknownReader string
UnknownReader is a TypeReader which returns an error.