mobile: golang.org/x/mobile/bind Index | Files | Directories

package bind

import "golang.org/x/mobile/bind"

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/golang.org/x/mobile/cmd/gobind)

Index

Package Files

bind.go gen.go genclasses.go gengo.go genjava.go genobjc.go genobjcw.go printer.go types.go

func GenGo Uses

func GenGo(conf *GeneratorConfig) error

GenGo generates a Go stub to support foreign language APIs.

func JavaClassName Uses

func JavaClassName(pkg *types.Package) string

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

func JavaPkgName Uses

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.

type ClassGen Uses

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 Uses

func (g *ClassGen) GenC()

func (*ClassGen) GenGo Uses

func (g *ClassGen) GenGo()

func (*ClassGen) GenH Uses

func (g *ClassGen) GenH()

func (*ClassGen) GenInterfaces Uses

func (g *ClassGen) GenInterfaces()

func (*ClassGen) GenPackage Uses

func (g *ClassGen) GenPackage(idx int)

func (*ClassGen) Init Uses

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 Uses

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

Packages return the list of Go packages to be generated.

type ErrorList Uses

type ErrorList []error

func (ErrorList) Error Uses

func (list ErrorList) Error() string

type Generator Uses

type Generator struct {
    *Printer
    Fset   *token.FileSet
    AllPkg []*types.Package
    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 Uses

func (g *Generator) Init()

type GeneratorConfig Uses

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

type JavaGen Uses

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 Uses

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

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

func (*JavaGen) GenC Uses

func (g *JavaGen) GenC() error

func (*JavaGen) GenClass Uses

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

func (*JavaGen) GenH Uses

func (g *JavaGen) GenH() error

func (*JavaGen) GenJava Uses

func (g *JavaGen) GenJava() error

func (*JavaGen) Init Uses

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 Uses

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

    *Generator
    // contains filtered or unexported fields
}

func (*ObjcGen) GenGoH Uses

func (g *ObjcGen) GenGoH() error

func (*ObjcGen) GenH Uses

func (g *ObjcGen) GenH() error

func (*ObjcGen) GenM Uses

func (g *ObjcGen) GenM() error

func (*ObjcGen) Init Uses

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

type ObjcWrapper Uses

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

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

func (*ObjcWrapper) GenGo Uses

func (g *ObjcWrapper) GenGo()

func (*ObjcWrapper) GenH Uses

func (g *ObjcWrapper) GenH()

func (*ObjcWrapper) GenInterfaces Uses

func (g *ObjcWrapper) GenInterfaces()

func (*ObjcWrapper) GenM Uses

func (g *ObjcWrapper) GenM()

func (*ObjcWrapper) GenPackage Uses

func (g *ObjcWrapper) GenPackage(idx int)

func (*ObjcWrapper) Init Uses

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 Uses

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

Packages return the list of Go packages to be generated.

type Printer Uses

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

func (*Printer) Indent Uses

func (p *Printer) Indent()

func (*Printer) Outdent Uses

func (p *Printer) Outdent()

func (*Printer) Printf Uses

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

func (*Printer) Write Uses

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

Directories

PathSynopsis
benchmarkPackage benchmark contains benchmarking bound functions for internal use.
javaPackage java implements the Java language bindings.
objcPackage objc implements the Objective-C language bindings.
seqPackage seq implements the machine-dependent seq serialization format.
testpkgPackage testpkg contains bound functions for testing the cgo-JNI interface.
testpkg/secondpkgPackage secondpkg is imported by bind tests that verify that a bound package can reference another bound package.
testpkg/simplepkgPackage simplepkg is imported from testpkg and tests two corner cases.
testpkg/unboundpkgPackage simplepkg is imported from testpkg and tests that references to other, unbound packages, are ignored.

Package bind imports 18 packages (graph) and is imported by 2 packages. Updated 2017-08-12. Refresh now. Tools for package owners.