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 ¶
- func GenGo(conf *GeneratorConfig) error
- func JavaClassName(pkg *types.Package) string
- func JavaPkgName(pkgPrefix string, pkg *types.Package) string
- type ClassGen
- func (g *ClassGen) GenC()
- func (g *ClassGen) GenGo()
- func (g *ClassGen) GenH()
- func (g *ClassGen) GenInterfaces()
- func (g *ClassGen) GenPackage(idx int)
- func (g *ClassGen) Init(classes []*java.Class, goClasses []importers.Struct)
- func (g *ClassGen) Packages() []string
- type ErrorList
- type Generator
- type GeneratorConfig
- type JavaGen
- func (g *JavaGen) ClassNames() []string
- func (g *JavaGen) GenC() error
- func (g *JavaGen) GenClass(idx int) error
- func (g *JavaGen) GenH() error
- func (g *JavaGen) GenJava() error
- func (g *JavaGen) Init(classes []*java.Class)
- type ObjcGen
- func (g *ObjcGen) GenGoH() error
- func (g *ObjcGen) GenH() error
- func (g *ObjcGen) GenM() error
- func (g *ObjcGen) Init(wrappers []*objc.Named)
- type ObjcWrapper
- func (g *ObjcWrapper) GenGo()
- func (g *ObjcWrapper) GenH()
- func (g *ObjcWrapper) GenInterfaces()
- func (g *ObjcWrapper) GenM()
- func (g *ObjcWrapper) GenPackage(idx int)
- func (g *ObjcWrapper) Init(types []*objc.Named, genNames []string)
- func (g *ObjcWrapper) Packages() []string
- type Printer
Functions ¶
func GenGo ¶
func GenGo(conf *GeneratorConfig) error
GenGo generates a Go stub to support foreign language APIs.
func JavaClassName ¶
JavaClassName returns the name of the Java class that contains Go package level identifiers.
func JavaPkgName ¶
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 (*ClassGen) Init ¶
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 ¶
Packages return the list of Go packages to be generated.
type ErrorList ¶
type ErrorList []error
func (ErrorList) Error ¶
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 ¶
ClassNames returns the list of names of the generated Java classes and interfaces.
func (*JavaGen) GenC ¶
func (*JavaGen) GenClass ¶
func (*JavaGen) GenH ¶
func (*JavaGen) GenJava ¶
func (*JavaGen) Init ¶
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 (*ObjcGen) GenH ¶
func (*ObjcGen) GenM ¶
func (*ObjcGen) Init ¶
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 (*Printer) Write ¶
Source Files ¶
bind.go gen.go genclasses.go gengo.go genjava.go genobjc.go genobjcw.go printer.go types.go
Directories ¶
Path | Synopsis |
---|---|
bind/java | Package java implements the Java language bindings. |
bind/objc | Package objc implements the Objective-C language bindings. |
bind/seq | Package seq implements the machine-dependent seq serialization format. |
- Version
- v0.0.0-20250210185054-b38b8813d607 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 20 packages
- Last checked
- 1 month ago –
Tools for package owners.