gen

package
Version: v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrimitiveULong  = Primitive{"unsigned long", "C.ulong(%s)"}
	PrimitiveLong   = Primitive{"long", "C.long(%s)"}
	PrimitiveUShort = Primitive{"unsigned short", "C.ushort(%s)"}
	PrimitiveDouble = Primitive{"double", "C.double(%s)"}
)

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name string
	Type string
}

type CGoMsgSend

type CGoMsgSend struct {
	Name     string
	Class    string
	Selector []SelectorPart
	Return   string
}

func (CGoMsgSend) HasReturn

func (m CGoMsgSend) HasReturn() bool

type CGoWrapperArg

type CGoWrapperArg struct {
	Name     string
	Type     string
	ToCGoFmt string
}

type CGoWrapperFunc

type CGoWrapperFunc struct {
	Name    string
	Args    []CGoWrapperArg
	Returns []CGoWrapperReturn
}

func (CGoWrapperFunc) HasReturn

func (f CGoWrapperFunc) HasReturn() bool

type CGoWrapperReturn

type CGoWrapperReturn struct {
	Type       string
	FromCGoFmt string
}

type ClassDef

type ClassDef struct {
	Name            string
	Base            string
	ClassMethods    []MethodDef
	InstanceMethods []MethodDef
}

type GoPackage

type GoPackage struct {
	PackageDescription
	Imports              []Import
	ClassMsgSendWrappers []CGoMsgSend
	MsgSendWrappers      []CGoMsgSend
	CGoWrapperFuncs      []MethodDef
	Classes              []ClassDef
}

func Convert

func Convert(desc PackageDescription, imports []PackageContents, schemas ...*schema.Schema) GoPackage

func (*GoPackage) Generate

func (p *GoPackage) Generate(w io.Writer) error

type Import

type Import struct {
	Path  string
	Alias string
}

type MethodDef

type MethodDef struct {
	Name        string
	WrappedFunc CGoWrapperFunc
}

type PackageContents

type PackageContents struct {
	// Import can be `nil` if this is representing the contents of the package
	// currently being generated, which don't need to be "imported".
	Import     *Import
	Classes    map[string]bool
	Primitives map[string]Primitive
}

PackageContents describes the Objective-C wrapper types found in a Go wrapper package. It's used to locate where to import a type name in the Go code, as well as whether it's a class, or another C type.

type PackageDescription

type PackageDescription struct {
	Name           string
	LinkFrameworks []string
	CIncludes      []string
}

type Primitive

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

type SelectorPart

type SelectorPart struct {
	Key string
	Arg *Arg
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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