Documentation
¶
Overview ¶
Package callable provides a generic callable generator.
Index ¶
- Variables
- func AnyTypeName(typ gir.AnyType, or string) string
- func CoalesceTail(tail string) string
- func Find(callables []Generator, goName string) int
- func RenameGetter(name string) (string, bool)
- func RenameGetters(parentName string, callables []Generator)
- func ReturnName(attrs *gir.CallableAttrs) string
- type FileGenerator
- type Generator
- func (g *Generator) CoalesceTail()
- func (g *Generator) EachParamResult(f func(*typeconv.ValueConverted))
- func (g *Generator) FileGenerator() FileGenerator
- func (g *Generator) Header() *file.Header
- func (g *Generator) Logln(lvl logger.Level, v ...interface{})
- func (g *Generator) Recv() string
- func (g *Generator) Reset()
- func (g *Generator) Use(typ *gir.TypeFindResult, call *gir.CallableAttrs) bool
- func (g *Generator) UseConstructor(typ *gir.TypeFindResult, call *gir.CallableAttrs) bool
- type ParamDoc
Constants ¶
This section is empty.
Variables ¶
var IgnoredNames = []string{
"ref",
"unref",
"free",
}
IgnoredNames is a list of method names that would be ignored. For more information, see typeconv/c-go.go.
Functions ¶
func AnyTypeName ¶
AnyTypeName returns the name from the given AnyType, or the given string if the type does not have a name.
func CoalesceTail ¶ added in v0.0.2
CoalesceTail coalesces certain parameters with the same type to be shorter.
func Find ¶
Find finds a callable with the given Go name. The index within the slice is returned, or if nothing is found, then -1 is returned.
func RenameGetter ¶
RenameGetter renames a getter. True is returned if the name is changed.
func RenameGetters ¶
RenameGetters renames the given list of callables to have idiomatic Go getter names.
func ReturnName ¶
func ReturnName(attrs *gir.CallableAttrs) string
Types ¶
type FileGenerator ¶
type FileGenerator interface { types.FileGenerator }
FileGenerator describes the interface of a file generator.
type Generator ¶
type Generator struct { *gir.CallableAttrs Name string Tail string Block string Converts []string Conv *typeconv.Converter Results []typeconv.ValueConverted GoArgs pen.Joints GoRets pen.Joints ParamDocs []ParamDoc // contains filtered or unexported fields }
Generator is a generator instance that generates a GIR callable.
func Grow ¶
Grow grows or shrinks the callables slice to the given length. The returned slice will have a length of 0.
func NewGenerator ¶
func NewGenerator(gen FileGenerator) Generator
NewGenerator creates a new callable generator from the given generator.
func (*Generator) CoalesceTail ¶ added in v0.0.2
func (g *Generator) CoalesceTail()
CoalesceTail calls CoalesceTail on the generator's tail.
func (*Generator) EachParamResult ¶ added in v0.0.2
func (g *Generator) EachParamResult(f func(*typeconv.ValueConverted))
func (*Generator) FileGenerator ¶
func (g *Generator) FileGenerator() FileGenerator
FileGenerator returns the generator's internal file generator.
func (*Generator) Recv ¶
Recv returns the receiver variable name. This method should only be called for methods.
func (*Generator) Reset ¶
func (g *Generator) Reset()
Reset resets the state of the generator while reusing the backing pen.
func (*Generator) Use ¶
func (g *Generator) Use(typ *gir.TypeFindResult, call *gir.CallableAttrs) bool
Use uses the given CallableAttrs for the generator.
func (*Generator) UseConstructor ¶
func (g *Generator) UseConstructor(typ *gir.TypeFindResult, call *gir.CallableAttrs) bool
UseConstructor calls Use with the constructor flag.
type ParamDoc ¶ added in v0.0.2
type ParamDoc struct { Name string InfoElements gir.InfoElements }