wrap

package
v0.0.0-...-c211321 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = false
	// Arc flag is for debugging only, your builds will break if you turn it on
	Arc         = false
	Autorelease = false
	Gogc        = false
)

Functions

func Disambiguate

func Disambiguate(mc *MethodCollection)

Disambiguate overloaded method names

func IsRetained

func IsRetained(name string) bool

IsRetained returns true if a given instance method returns a retained object. NSWrap will not send a 'retain' message to these objects before returning them to Go.

Types

type Avail

type Avail []AvailAttr

func (*Avail) Add

func (a *Avail) Add(n ast.Node, prt bool)

func (*Avail) Available

func (a *Avail) Available() bool

type AvailAttr

type AvailAttr struct {
	OS, Version string
	Deprecated  bool
}

type ByParams

type ByParams []*Method

func (ByParams) Len

func (a ByParams) Len() int

func (ByParams) Less

func (a ByParams) Less(i, j int) bool

func (ByParams) Swap

func (a ByParams) Swap(i, j int)

type Enum

type Enum struct {
	Name      string
	Type      *types.Type
	Constants []EnumConstant
}

type EnumConstant

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

type Interface

type Interface struct {
	Name, GoName                  string
	InstanceMethods, ClassMethods *MethodCollection
	Properties                    map[string]*Property
	Protocols                     []string // Protocols impelemented by this Interface
	ProcessedInstanceMethods      map[string]bool
}

func (*Interface) IsRetainedProperty

func (i *Interface) IsRetainedProperty(name string) bool

IsRetainedProperty returns true if the name matches a retained property for the given interface.

type Method

type Method struct {
	Name, GoName, Class, GoClass string
	Type                         *types.Type
	ClassMethod                  bool
	Parameters                   []*Parameter
	Unavailable                  bool
}

func (*Method) HasUnsupportedType

func (m *Method) HasUnsupportedType() bool

func (*Method) LongName

func (m *Method) LongName() string

Fully disambiguated method name (m.GoName + all parameter names)

func (*Method) ShouldFinalize

func (m *Method) ShouldFinalize() bool

ShouldFinalize returns true on a method that returns an object that should have a GC finalizer.

type MethodCollection

type MethodCollection struct {
	Class, GoClass string
	Methods        []*Method
	Unavailable    map[string]bool
}

func NewMethodCollection

func NewMethodCollection(class string) *MethodCollection

func (*MethodCollection) AddMethod

func (mc *MethodCollection) AddMethod(m *Method)

func (*MethodCollection) AddMethods

func (mc *MethodCollection) AddMethods(smc *MethodCollection)

type Parameter

type Parameter struct {
	Pname, Vname string
	Type         *types.Type
}

type Property

type Property struct {
	Name, Attr string
	Type       *types.Type
	// contains filtered or unexported fields
}

type Protocol

type Protocol struct {
	InstanceMethods, ClassMethods *MethodCollection
}

type Subclass

type Subclass struct {
	Name, Super string
	Overrides   []string
	NewMethods  []string
}

type Wrapper

type Wrapper struct {
	Package       string
	Interfaces    map[string]*Interface
	Functions     map[string]*Method
	NamedEnums    map[string]*Enum
	AnonEnums     []*Enum
	Delegates     map[string]map[string][]string
	Subclasses    map[string]*Subclass
	Protocols     map[string]*Protocol
	Frameworks    []string
	Libraries     []string
	Frameworkdirs []string
	Pragmas       []string

	ProcessedTypes        map[string]bool
	ProcessedClassMethods map[string]bool
	Vaargs                int
	// contains filtered or unexported fields
}

func NewWrapper

func NewWrapper(debug bool) *Wrapper

func (*Wrapper) AddCategory

func (w *Wrapper) AddCategory(n *ast.ObjCCategoryDecl)

AddCategory adds an Objective-C category to a Wrapper. the first child node of an ObjCCategoryDecl is always an ObjCInterface indicating which interface is being extended by this category.

func (*Wrapper) AddEnum

func (w *Wrapper) AddEnum(n *ast.EnumDecl, rs []string)

func (*Wrapper) AddFunction

func (w *Wrapper) AddFunction(n *ast.FunctionDecl)

func (*Wrapper) AddInterface

func (w *Wrapper) AddInterface(n *ast.ObjCInterfaceDecl)

AddInterface adds an Objective-C interface to a Wrapper.

func (*Wrapper) AddMethod

func (w *Wrapper) AddMethod(p *MethodCollection, x *ast.ObjCMethodDecl)

func (*Wrapper) AddProtocol

func (w *Wrapper) AddProtocol(n *ast.ObjCProtocolDecl)

func (*Wrapper) AddProtocolMethods

func (w *Wrapper) AddProtocolMethods(i *Interface, p *Protocol)

Add methods from a Protocol

func (*Wrapper) AddSupermethods

func (w *Wrapper) AddSupermethods(i *Interface)

Add class and instance methods from super class

func (*Wrapper) AddTypedef

func (w *Wrapper) AddTypedef(n, t string)

func (*Wrapper) AutoreleaseHelpers

func (w *Wrapper) AutoreleaseHelpers()

func (*Wrapper) CharHelpers

func (w *Wrapper) CharHelpers()

func (*Wrapper) Delegate

func (w *Wrapper) Delegate(ds map[string]map[string][]string)

func (*Wrapper) EnumeratorHelpers

func (w *Wrapper) EnumeratorHelpers()

func (*Wrapper) GetParms

func (w *Wrapper) GetParms(n ast.Node, class string, prt bool) ([]*Parameter, bool, bool)

GetParms returns the parameters of a method declaration and a bool indicating whether the given method is available on MacOS and not deprecated.

func (*Wrapper) Import

func (w *Wrapper) Import(ss []string)

func (*Wrapper) MethodFromSig

func (w *Wrapper) MethodFromSig(sig, class string) *Method

func (*Wrapper) ProcessDelegate

func (w *Wrapper) ProcessDelegate(dname string, ps map[string][]string)

func (*Wrapper) ProcessEnum

func (w *Wrapper) ProcessEnum(e *Enum)

func (*Wrapper) ProcessFunction

func (w *Wrapper) ProcessFunction(m *Method)

func (*Wrapper) ProcessMethod

func (w *Wrapper) ProcessMethod(m *Method)

func (*Wrapper) ProcessMethodForClass

func (w *Wrapper) ProcessMethodForClass(m *Method, class string)

func (*Wrapper) ProcessSubclass

func (w *Wrapper) ProcessSubclass(sname string, sc *Subclass)

func (*Wrapper) SelectorHelpers

func (w *Wrapper) SelectorHelpers()

func (*Wrapper) StringHelpers

func (w *Wrapper) StringHelpers()

func (*Wrapper) Subclass

func (w *Wrapper) Subclass(ds map[string]map[string][]string)

func (*Wrapper) SysImport

func (w *Wrapper) SysImport(ss []string)

func (*Wrapper) Wrap

func (w *Wrapper) Wrap(toproc []string)

Jump to

Keyboard shortcuts

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