objc

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

The objc package takes the result of an AST traversal by the importers package and uses the clang command to dump the type information for the referenced ObjC classes and protocols.

It is the of go/types for ObjC types and is used by the bind package to generate Go wrappers for ObjC API on iOS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func struct {
	Sig    string
	GoName string
	Params []*Param
	Ret    *Type
	Static bool
	// Method whose name start with "init"
	Constructor bool
}

Func is a ObjC method, static functions as well as instance methods.

type Named

type Named struct {
	Name       string
	GoName     string
	Module     string
	Funcs      []*Func
	Methods    []*Func
	AllMethods []*Func
	Supers     []Super

	Protocol bool
	// Generated is true if the type is wrapper of a
	// generated Go struct.
	Generated bool
	// contains filtered or unexported fields
}

Named represents ObjC classes and protocols.

func Import

func Import(refs *importers.References) ([]*Named, error)

Import returns descriptors for a list of references to ObjC protocols and classes.

The type information is parsed from the output of clang -cc1 -ast-dump.

func (*Named) ObjcType

func (t *Named) ObjcType() string

type Param

type Param struct {
	Name string
	Type *Type
}

type Super

type Super struct {
	Name     string
	Protocol bool
}

Super denotes a super class or protocol.

type Type

type Type struct {
	Kind TypeKind
	// For Interface and Protocol types.
	Name string

	// The declared type raw from the AST.
	Decl string
	// Set if the type is a pointer to its kind. For classes
	// Indirect is true if the type is a double pointer, e.g.
	// NSObject **.
	Indirect bool
	// contains filtered or unexported fields
}

type TypeKind

type TypeKind int
const (
	Unknown TypeKind = iota
	Protocol
	Class
	String
	Data
	Int
	Uint
	Short
	Ushort
	Bool
	Char
	Uchar
	Float
	Double
)

Jump to

Keyboard shortcuts

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