genauth

package
v0.0.0-...-b5aa0b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldDecl

func FieldDecl(info Field) []string

FieldDecl generates the code for a field in a C++ header.

func FieldDeclType

func FieldDeclType(info Field) string

FieldDeclType returns a string that represents the C++ type for this field.

func FieldName

func FieldName(info Field) string

FieldName returns the generated name for a field in an auth class.

func PrimitiveUnmarshaller

func PrimitiveUnmarshaller(typeName string, field Field) []string

PrimitiveUnmarshaller generates code that unmarshals primitive types like int.

Types

type Constant

type Constant struct {
	Name  string
	Value int
}

Constant represents a constant value in the file.

type ConstantVisitor

type ConstantVisitor struct {
	Constants []Constant
}

ConstantVisitor stores a list of constants from the file.

func (*ConstantVisitor) Visit

func (tv *ConstantVisitor) Visit(n ast.Node) ast.Visitor

Visit handles an ast.Node and records it if this node is a constant.

type CppGenerator

type CppGenerator struct {
	Constants  []Constant
	Types      map[string][]Field
	Interfaces map[string]bool
	FormTypes  map[string]bool
	TermTypes  map[string]bool
}

CppGenerator generates C++ code from the Go auth types.

func ParseAuthAst

func ParseAuthAst(binaryFile, astFile string) *CppGenerator

func (*CppGenerator) ArrayUnmarshaller

func (cg *CppGenerator) ArrayUnmarshaller(typeName string, field Field) []string

ArrayUnmarshaller generates code that unmarshals an Array.

func (*CppGenerator) BinaryConstants

func (cg *CppGenerator) BinaryConstants() []string

Constants creates lines that define the constants for auth serialization and deserialization.

func (*CppGenerator) Class

func (cg *CppGenerator) Class(name string, fields []Field) []string

func (*CppGenerator) Decoder

func (cg *CppGenerator) Decoder(interfaceName string, types map[string]bool) []string

Decoder generates code that deserializes bytes that might be any subclass of a given interface class.

func (*CppGenerator) Header

func (cg *CppGenerator) Header() []string

Header creates the header file for the C++ code.

func (*CppGenerator) IdentUnmarshaller

func (cg *CppGenerator) IdentUnmarshaller(typeName string, field Field) []string

IdentUnmarshaller generates code that unmarshals an ast.Ident.

func (*CppGenerator) Implementation

func (cg *CppGenerator) Implementation() []string

Implementation generates the C++ implementation file for the auth classes.

func (*CppGenerator) Marshaller

func (cg *CppGenerator) Marshaller(name string, fields []Field) []string

Marshaller generates serialization code for the given auth type.

func (*CppGenerator) MoveConstructor

func (cg *CppGenerator) MoveConstructor(name string, fields []Field) []string

MoveConstructor generates a constructor that moves all of the member variables through rvalue parameters.

func (*CppGenerator) PrimitiveMarshaller

func (cg *CppGenerator) PrimitiveMarshaller(typeName string, field Field) []string

PrimitiveMarshaller generates serialization code for primitive types like int.

func (*CppGenerator) Unmarshaller

func (cg *CppGenerator) Unmarshaller(name string, fields []Field) []string

Unmarshaller generates code that unmarshals bytes to a given class.

type Field

type Field struct {
	Name     string
	Type     FieldType
	TypeName string
}

Field represents a field of a struct.

type FieldType

type FieldType int

FieldType describes the AST type of a field in a struct.

const (
	IdentType FieldType = iota
	StarType
	ArrayType
)

The constants are the AST types that this code uses.

type FieldVisitor

type FieldVisitor struct {
	ConcreteTypes  map[string][]Field
	InterfaceTypes map[string]bool
	Name           string
}

FieldVisitor visits all the fields of a struct found by TypeVisitor and records them.

func (*FieldVisitor) Visit

func (fv *FieldVisitor) Visit(n ast.Node) ast.Visitor

Visit examines an ast.Field node and records it name and type.

type FuncReceiverWalker

type FuncReceiverWalker struct {
	// contains filtered or unexported fields
}

FuncReceiverWalker holds information about the receiver types in the AST.

func (*FuncReceiverWalker) Visit

func (fw *FuncReceiverWalker) Visit(n ast.Node) ast.Visitor

Visit handles a node in the AST and records the receiver type, if any.

type TypeVisitor

type TypeVisitor struct {
	ConcreteTypes  map[string][]Field
	InterfaceTypes map[string]bool
}

TypeVisitor visits ast.Nodes and finds all the types that need code generation.

func (*TypeVisitor) Visit

func (tv *TypeVisitor) Visit(n ast.Node) ast.Visitor

Visit examines a Node and records its type if it matches a type that this code handles.

Directories

Path Synopsis
Package genauth supports tao auth-code generation from the Go version.
Package genauth supports tao auth-code generation from the Go version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL