typing

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppKit = &Module{"AppKit", "AppKit", "appkit", "Appkit/Appkit.h"}
View Source
var Bool = &PrimitiveType{GoName_: "bool", ObjcName_: "BOOL"}
View Source
var Byte = &PrimitiveType{GoName_: "byte", ObjcName_: "char"}
View Source
var Class = &ClassType{
	Name:   "Class",
	GName:  "Class",
	Module: ObjCRuntime,
}
View Source
var CoreFoundation = &Module{"CoreFoundation", "Core Foundation", "corefoundation", "CoreFoundation/CoreFoundation.h"}
View Source
var CoreGraphics = &Module{"CoreGraphics", "Core Graphics", "coregraphics", "CoreGraphics/CoreGraphics.h"}
View Source
var Double = &PrimitiveType{GoName_: "float64", ObjcName_: "double"}
View Source
var FileProvider = &Module{"FileProvider", "File Provider", "fileprovider", "FileProvider/FileProvider.h"}
View Source
var Float = &PrimitiveType{GoName_: "float32", ObjcName_: "float"}
View Source
var Foundation = &Module{"Foundation", "Foundation", "foundation", "Foundation/Foundation.h"}
View Source
var IOBluetooth = &Module{"IOBluetooth", "IOBluetooth", "iobluetooth", "IOBluetooth/IOBluetooth.h"}
View Source
var Int = &PrimitiveType{GoName_: "int", ObjcName_: "NSInteger"}
View Source
var Int16 = &PrimitiveType{GoName_: "int16", ObjcName_: "int16_t"}
View Source
var Int32 = &PrimitiveType{GoName_: "int32", ObjcName_: "int32_t"}
View Source
var Int64 = &PrimitiveType{GoName_: "int64", ObjcName_: "int64_t"}
View Source
var Int8 = &PrimitiveType{GoName_: "int8", ObjcName_: "int8_t"}
View Source
var ObjCRuntime = &Module{"objectivec", "Objective-C Runtime", "objc", "objc/runtime.h"}
View Source
var Object = &ClassType{
	Name:   "NSObject",
	GName:  "Object",
	Module: ObjCRuntime,
}

Object is the objc object root class type

View Source
var Quartz = &Module{"Quartz", "Quartz", "quartz", "Quartz/Quartz.h"}
View Source
var QuartzCore = &Module{"QuartzCore", "QuartzCore", "quartzcore", "QuartzCore/QuartzCore.h"}
View Source
var SecurityInterface = &Module{"SecurityInterface", "Security Interface", "securityinterface", "SecurityInterface/SecurityInterface.h"}
View Source
var UInt = &PrimitiveType{GoName_: "uint", ObjcName_: "NSUInteger"}
View Source
var UInt16 = &PrimitiveType{GoName_: "uint16", ObjcName_: "uint16_t"}
View Source
var UInt32 = &PrimitiveType{GoName_: "uint32", ObjcName_: "uint32_t"}
View Source
var UInt64 = &PrimitiveType{GoName_: "uint64", ObjcName_: "uint64_t"}
View Source
var UInt8 = &PrimitiveType{GoName_: "uint8", ObjcName_: "uint8_t"}
View Source
var UniformTypeIdentifiers = &Module{"UniformTypeIdentifiers", "Uniform Type Identifiers", "uniformtypeidentifiers", "UniformTypeIdentifiers/UniformTypeIdentifiers.h"}
View Source
var WebKit = &Module{"WebKit", "WebKit", "webkit", "WebKit/WebKit.h"}

Functions

func FullGoName

func FullGoName(module Module, name string, currentModule Module) string

func PrependPackage

func PrependPackage(module Module, s string, currentModule Module) string

Types

type AliasType

type AliasType struct {
	Type   Type    // the real type
	GName  string  // alias name for new go type
	Name   string  // the objc name
	Module *Module // used when Alias is not empty
}

AliasType type def types

func (*AliasType) DeclareModule

func (a *AliasType) DeclareModule() *Module

func (*AliasType) GoImports

func (a *AliasType) GoImports() set.Set[string]

func (*AliasType) GoName

func (a *AliasType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*AliasType) ObjcName

func (a *AliasType) ObjcName() string

type ArrayType

type ArrayType struct {
	Type Type
}

ArrayType the element should be StringType or ClassType

func (*ArrayType) DeclareModule

func (a *ArrayType) DeclareModule() *Module

func (*ArrayType) GoImports

func (a *ArrayType) GoImports() set.Set[string]

func (*ArrayType) GoName

func (a *ArrayType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*ArrayType) ObjcName

func (a *ArrayType) ObjcName() string

type BlockParam

type BlockParam struct {
	Type Type
	Name string // the param name
}

type BlockType

type BlockType struct {
	ReturnType Type
	Params     []BlockParam
}

BlockType

func (*BlockType) DeclareModule

func (a *BlockType) DeclareModule() *Module

func (*BlockType) GoImports

func (a *BlockType) GoImports() set.Set[string]

func (*BlockType) GoName

func (a *BlockType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*BlockType) ObjcName

func (a *BlockType) ObjcName() string

type ClassType

type ClassType struct {
	Name   string  // objc type name
	GName  string  // Go name, usually is objc type name without prefix 'NS'
	Module *Module // object-c module
}

ClassType Objective-c interface type

func (*ClassType) DeclareModule

func (c *ClassType) DeclareModule() *Module

func (*ClassType) GoImports

func (c *ClassType) GoImports() set.Set[string]

func (*ClassType) GoInterfaceName

func (c *ClassType) GoInterfaceName() string

GoInterfaceName return the go wrapper interface name

func (*ClassType) GoName

func (c *ClassType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*ClassType) GoStructName

func (c *ClassType) GoStructName() string

GoStructName return the go wrapper struct name

func (*ClassType) ObjcName

func (c *ClassType) ObjcName() string

type DataType

type DataType struct {
}

DataType objc binary data type

func (*DataType) DeclareModule

func (d *DataType) DeclareModule() *Module

func (*DataType) GoImports

func (d *DataType) GoImports() set.Set[string]

func (*DataType) GoName

func (d *DataType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*DataType) ObjcName

func (d *DataType) ObjcName() string

type DictType

type DictType struct {
	KeyType   Type
	ValueType Type
}

DictType for objc Dictionary types, the element should be StringType or ClassType

func (*DictType) DeclareModule

func (d *DictType) DeclareModule() *Module

func (*DictType) GoImports

func (d *DictType) GoImports() set.Set[string]

func (*DictType) GoName

func (d *DictType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*DictType) ObjcName

func (d *DictType) ObjcName() string

type IDType

type IDType struct {
}

InstanceType the objc instancetype. class method start with alloc or new, instance method start with autorelease,init,retain or self, return instancetype.

func (*IDType) DeclareModule

func (i *IDType) DeclareModule() *Module

func (*IDType) GoImports

func (i *IDType) GoImports() set.Set[string]

func (*IDType) GoName

func (i *IDType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*IDType) ObjcName

func (i *IDType) ObjcName() string

type InstanceType

type InstanceType struct {
}

InstanceType the objc instancetype. class method start with alloc or new, instance method start with autorelease,init,retain or self, return instancetype.

func (*InstanceType) DeclareModule

func (i *InstanceType) DeclareModule() *Module

func (*InstanceType) GoImports

func (i *InstanceType) GoImports() set.Set[string]

func (*InstanceType) GoName

func (i *InstanceType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*InstanceType) ObjcName

func (i *InstanceType) ObjcName() string

type Module

type Module struct {
	Name    string // module name
	DesName string // readable name
	Package string // go package for this module
	Header  string // objc header file
}

Module Objective-c module

func FindModule

func FindModule(moduleName string) *Module

func (*Module) String

func (m *Module) String() string

type PointerRefType

type PointerRefType struct {
	Name   string  // objc type name
	GName  string  // Go name, usually is objc type name without prefix 'NS'
	Module *Module // object-c module
}

PointerRefType c pointer type def

func (*PointerRefType) DeclareModule

func (c *PointerRefType) DeclareModule() *Module

func (*PointerRefType) GoImports

func (c *PointerRefType) GoImports() set.Set[string]

func (*PointerRefType) GoName

func (c *PointerRefType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*PointerRefType) ObjcName

func (c *PointerRefType) ObjcName() string

type PointerType

type PointerType struct {
	Type Type
}

PointerType is c pointer type

func (*PointerType) DeclareModule

func (c *PointerType) DeclareModule() *Module

func (*PointerType) GoImports

func (c *PointerType) GoImports() set.Set[string]

func (*PointerType) GoName

func (c *PointerType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*PointerType) ObjcName

func (c *PointerType) ObjcName() string

type PrimitiveType

type PrimitiveType struct {
	GoName_   string // go type name
	ObjcName_ string // objc type name
}

PrimitiveType primitive types

func GetPrimitiveType

func GetPrimitiveType(typeName string) (*PrimitiveType, bool)

func (*PrimitiveType) DeclareModule

func (p *PrimitiveType) DeclareModule() *Module

func (*PrimitiveType) GoImports

func (p *PrimitiveType) GoImports() set.Set[string]

func (*PrimitiveType) GoName

func (p *PrimitiveType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*PrimitiveType) ObjcName

func (p *PrimitiveType) ObjcName() string

func (*PrimitiveType) ToUnsigned

func (p *PrimitiveType) ToUnsigned() *PrimitiveType

type ProtocolType

type ProtocolType struct {
	Name    string  // the objc type name
	GName   string  // Go name, usually is objc type name without prefix 'NS'
	OnlyUse bool    // if this protocol is just for use, no need to implement it
	Module  *Module // object-c module name
}

ProtocolType objective-c protocol type

func (*ProtocolType) DeclareModule

func (p *ProtocolType) DeclareModule() *Module

func (*ProtocolType) GoImports

func (p *ProtocolType) GoImports() set.Set[string]

func (*ProtocolType) GoName

func (p *ProtocolType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*ProtocolType) ObjcName

func (p *ProtocolType) ObjcName() string

type SelectorType

type SelectorType struct {
}

SelectorType objc selector type

func (*SelectorType) DeclareModule

func (s *SelectorType) DeclareModule() *Module

func (*SelectorType) GoImports

func (s *SelectorType) GoImports() set.Set[string]

func (*SelectorType) GoName

func (s *SelectorType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*SelectorType) ObjcName

func (s *SelectorType) ObjcName() string

type StringType

type StringType struct {
	NeedNil bool // string type need nil value.If set to true, will use foundation.String instread string for generated go code.
}

StringType string

func (*StringType) DeclareModule

func (s *StringType) DeclareModule() *Module

func (*StringType) GoImports

func (s *StringType) GoImports() set.Set[string]

func (*StringType) GoName

func (s *StringType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*StringType) ObjcName

func (s *StringType) ObjcName() string

type StructType

type StructType struct {
	Name   string  // c and objc type name
	GName  string  // the go struct name
	Module *Module // the module
}

StructType struct type

func (*StructType) DeclareModule

func (s *StructType) DeclareModule() *Module

func (*StructType) GoImports

func (s *StructType) GoImports() set.Set[string]

func (*StructType) GoName

func (s *StructType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*StructType) ObjcName

func (s *StructType) ObjcName() string

type Type

type Type interface {
	// GoName Go type name
	GoName(currentModule *Module, receiveFromObjc bool) string
	// ObjcName Objective-c type name
	ObjcName() string

	// GoImports go imports for this type
	GoImports() set.Set[string]

	// DeclareModule the module of this type. return nil if is a built in type
	DeclareModule() *Module
}

Type interface for all type

func UnwrapAlias

func UnwrapAlias(t Type) Type

UnwrapAlias unwrap alias type to it's real underlying type

type VoidPointerType

type VoidPointerType struct {
	Name  string // objc type name
	GName string // Go name, usually is objc type name without prefix 'NS'
}

VoidPointerType void*/unsafe.Pointer

func (*VoidPointerType) DeclareModule

func (c *VoidPointerType) DeclareModule() *Module

func (*VoidPointerType) GoImports

func (c *VoidPointerType) GoImports() set.Set[string]

func (*VoidPointerType) GoName

func (c *VoidPointerType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*VoidPointerType) ObjcName

func (c *VoidPointerType) ObjcName() string

type VoidType

type VoidType struct {
}

VoidType for void return

func (*VoidType) DeclareModule

func (d *VoidType) DeclareModule() *Module

func (*VoidType) GoImports

func (d *VoidType) GoImports() set.Set[string]

func (*VoidType) GoName

func (d *VoidType) GoName(currentModule *Module, receiveFromObjc bool) string

func (*VoidType) ObjcName

func (d *VoidType) ObjcName() string

Jump to

Keyboard shortcuts

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