iface

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package iface provides an interface generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanGenerate

func CanGenerate(gen types.FileGenerator, v interface{}) bool

CanGenerate checks if the given class or interface can be generated.

Types

type Generator

type Generator struct {
	Root gir.TypeFindResult

	Name           string
	CType          string
	GLibGetType    string
	GLibTypeStruct *TypeStruct
	InfoAttrs      *gir.InfoAttrs
	InfoElements   *gir.InfoElements

	InterfaceName string
	StructName    string

	VirtualMethods Methods
	Methods        Methods // for big interface
	Constructors   Methods
	Signals        []Signal

	Tree types.Tree
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(gen types.FileGenerator) Generator

NewGenerator creates a new interface generator instance.

func (*Generator) Abstract

func (g *Generator) Abstract() bool

Abstract returns true if the generator is generating an interface or abstract class.

func (*Generator) Header

func (g *Generator) Header() *file.Header

Header returns the callback generator's current header.

func (*Generator) ImplInterfaces added in v0.0.3

func (g *Generator) ImplInterfaces() []string

func (*Generator) IsClass added in v0.0.3

func (g *Generator) IsClass() bool

IsClass returns true if the generator is generating a class.

func (*Generator) IsInSameFile added in v0.0.3

func (g *Generator) IsInSameFile(v interface{}) bool

IsInSameFile returns true if the given GIR item is in the same file. It's guessed using the InfoElements field in the given value.

func (*Generator) IsInterface added in v0.0.3

func (g *Generator) IsInterface() bool

IsInterface returns true if the generator is generating an interface.

func (*Generator) Logln

func (g *Generator) Logln(lvl logger.Level, v ...interface{})

func (*Generator) OverriderName added in v0.0.3

func (g *Generator) OverriderName() string

OverriderName returns the name of the overrider interface.

func (*Generator) Reset

func (g *Generator) Reset()

Reset resets the callback generator.

func (*Generator) Use

func (g *Generator) Use(typ interface{}) bool

Use accepts either a *gir.Class or a *gir.Interface; any other type will make it panic.

func (*Generator) Wrap

func (g *Generator) Wrap(obj string) string

Wrap creates a wrapper around the given object variable.

type Method

type Method struct {
	InfoElements  *gir.InfoElements
	InfoAttrs     *gir.InfoAttrs
	CallableAttrs *gir.CallableAttrs

	Recv       string
	Name       string
	Tail       string
	Block      string
	Header     file.Header
	Results    []typeconv.ValueConverted
	ParamDocs  []cmt.ParamDoc
	ReturnDocs []cmt.ParamDoc
}

type Methods

type Methods []Method

type ParamDoc added in v0.0.2

type ParamDoc struct {
	Name         string
	InfoElements gir.InfoElements
}

type Signal added in v0.0.2

type Signal struct {
	*gir.Signal

	GoName string
	GoTail string
	// _gotk4_gtk4_widget_connect_activate
	CGoName string
	CGoTail string
	Block   string // type conversion trampoline

	Header  *file.Header
	Results []typeconv.ValueConverted

	InfoElements gir.InfoElements
}

Signal describes a GLib signal in minimal function form.

func (Signal) FuncName added in v0.0.3

func (s Signal) FuncName() string

FuncName returns the Go function variable name. It's a constant used for codegen.

type TypeStruct added in v0.0.3

type TypeStruct struct {
	*gir.Record
	Name           string          // TODO
	VirtualMethods []VirtualMethod // TODO: move this out
	// contains filtered or unexported fields
}

func (*TypeStruct) Init added in v0.0.5

func (ts *TypeStruct) Init() bool

func (*TypeStruct) Logln added in v0.0.3

func (ts *TypeStruct) Logln(lvl logger.Level, v ...interface{})

func (*TypeStruct) WrapperFuncName added in v0.0.3

func (ts *TypeStruct) WrapperFuncName(field string) string

type VirtualMethod added in v0.0.5

type VirtualMethod struct {
	Header    file.Header
	FieldName string

	// Go func
	Go *Method

	C struct {
		// Name is the name of the wrapper function.
		Name   string
		Tail   string
		Block  string
		Header *file.Header
	}
}

Jump to

Keyboard shortcuts

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