bind

package
v0.0.0-...-66a08ab Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package bind implements a code generator for gobind.

See the documentation on the gobind command for usage details and the list of currently supported types. (http://godoc.org/github.com/thommil/tge-mobile/cmd/gobind)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenGo

func GenGo(conf *GeneratorConfig) error

GenGo generates a Go stub to support foreign language APIs.

func JavaClassName

func JavaClassName(pkg *types.Package) string

JavaClassName returns the name of the Java class that contains Go package level identifiers.

func JavaPkgName

func JavaPkgName(pkgPrefix string, pkg *types.Package) string

JavaPkgName returns the Java package name for a Go package given a pkg prefix. If the prefix is empty, "go" is used instead.

Types

type ClassGen

type ClassGen struct {
	*Printer
	// JavaPkg is the Java package prefix for the generated classes. The prefix is prepended to the Go
	// package name to create the full Java package name.
	JavaPkg string
	// contains filtered or unexported fields
}

ClassGen generates Go and C stubs for Java classes so import statements on the form

import "Java/classpath/to/Class"

will work.

func (*ClassGen) GenC

func (g *ClassGen) GenC()

func (*ClassGen) GenGo

func (g *ClassGen) GenGo()

func (*ClassGen) GenH

func (g *ClassGen) GenH()

func (*ClassGen) GenInterfaces

func (g *ClassGen) GenInterfaces()

func (*ClassGen) GenPackage

func (g *ClassGen) GenPackage(idx int)

func (*ClassGen) Init

func (g *ClassGen) Init(classes []*java.Class, goClasses []importers.Struct)

Init initializes the class wrapper generator. Classes is the list of classes to wrap, goClasses is the list of Java classes implemented in Go.

func (*ClassGen) Packages

func (g *ClassGen) Packages() []string

Packages return the list of Go packages to be generated.

type ErrorList

type ErrorList []error

func (ErrorList) Error

func (list ErrorList) Error() string

type Generator

type Generator struct {
	*Printer
	Fset   *token.FileSet
	AllPkg []*types.Package
	Files  []*ast.File
	Pkg    *types.Package
	// contains filtered or unexported fields
}

Generator contains the common Go package information needed for the specific Go, Java, ObjC generators.

After setting Printer, Fset, AllPkg, Pkg, the Init method is used to initialize the auxiliary information about the package to be generated, Pkg.

func (*Generator) Init

func (g *Generator) Init()

type GeneratorConfig

type GeneratorConfig struct {
	Writer io.Writer
	Fset   *token.FileSet
	Pkg    *types.Package
	AllPkg []*types.Package
}

type JavaGen

type JavaGen struct {
	// JavaPkg is the Java package prefix for the generated classes. The prefix is prepended to the Go
	// package name to create the full Java package name.
	JavaPkg string

	*Generator
	// contains filtered or unexported fields
}

func (*JavaGen) ClassNames

func (g *JavaGen) ClassNames() []string

ClassNames returns the list of names of the generated Java classes and interfaces.

func (*JavaGen) GenC

func (g *JavaGen) GenC() error

func (*JavaGen) GenClass

func (g *JavaGen) GenClass(idx int) error

func (*JavaGen) GenH

func (g *JavaGen) GenH() error

func (*JavaGen) GenJava

func (g *JavaGen) GenJava() error

func (*JavaGen) Init

func (g *JavaGen) Init(classes []*java.Class)

Init intializes the embedded Generator and initializes the Java class information needed to generate structs that extend Java classes and interfaces.

type ObjcGen

type ObjcGen struct {
	Prefix string // prefix arg passed by flag.

	*Generator
	// contains filtered or unexported fields
}

func (*ObjcGen) GenGoH

func (g *ObjcGen) GenGoH() error

func (*ObjcGen) GenH

func (g *ObjcGen) GenH() error

func (*ObjcGen) GenM

func (g *ObjcGen) GenM() error

func (*ObjcGen) Init

func (g *ObjcGen) Init(wrappers []*objc.Named)

type ObjcWrapper

type ObjcWrapper struct {
	*Printer
	// contains filtered or unexported fields
}

ObjCWrapper generates Go and C stubs for ObjC interfaces and protocols.

func (*ObjcWrapper) GenGo

func (g *ObjcWrapper) GenGo()

func (*ObjcWrapper) GenH

func (g *ObjcWrapper) GenH()

func (*ObjcWrapper) GenInterfaces

func (g *ObjcWrapper) GenInterfaces()

func (*ObjcWrapper) GenM

func (g *ObjcWrapper) GenM()

func (*ObjcWrapper) GenPackage

func (g *ObjcWrapper) GenPackage(idx int)

func (*ObjcWrapper) Init

func (g *ObjcWrapper) Init(types []*objc.Named, genNames []string)

Init initializes the ObjC types wrapper generator. Types is the list of types to wrap, genNames the list of generated type names.

func (*ObjcWrapper) Packages

func (g *ObjcWrapper) Packages() []string

Packages return the list of Go packages to be generated.

type Printer

type Printer struct {
	Buf        *bytes.Buffer
	IndentEach []byte
	// contains filtered or unexported fields
}

func (*Printer) Indent

func (p *Printer) Indent()

func (*Printer) Outdent

func (p *Printer) Outdent()

func (*Printer) Printf

func (p *Printer) Printf(format string, args ...interface{})

func (*Printer) Write

func (p *Printer) Write(b []byte) (n int, err error)

Directories

Path Synopsis
Package java implements the Java language bindings.
Package java implements the Java language bindings.
Package objc implements the Objective-C language bindings.
Package objc implements the Objective-C language bindings.
Package seq implements the machine-dependent seq serialization format.
Package seq implements the machine-dependent seq serialization format.

Jump to

Keyboard shortcuts

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