Documentation ¶
Index ¶
- func CanGenerateAlias(gen FileGenerator, alias *gir.Alias) bool
- func CanGenerateBitfield(gen FileGenerator, bitfield *gir.Bitfield) bool
- func CanGenerateEnum(gen FileGenerator, enum *gir.Enum) bool
- func CanGenerateRecord(gen FileGenerator, rec *gir.Record) bool
- func FormatEnumMember(member gir.Member) string
- func GenerateAlias(gen FileGeneratorWriter, alias *gir.Alias) bool
- func GenerateBitfield(gen FileGeneratorWriter, bitfield *gir.Bitfield) bool
- func GenerateCPrimitiveRecord(gen types.FileGenerator, rec *gir.Record) string
- func GenerateCallback(gen FileGeneratorWriter, cb *gir.Callback) bool
- func GenerateClass(gen FileGeneratorWriter, class *gir.Class) bool
- func GenerateConstant(gen FileGeneratorWriter, constant *gir.Constant) bool
- func GenerateEnum(gen FileGeneratorWriter, enum *gir.Enum) bool
- func GenerateFunction(gen FileGeneratorWriter, fn *gir.Function) bool
- func GenerateInterface(gen FileGeneratorWriter, iface *gir.Interface) bool
- func GeneratePrefixedFunction(gen FileGeneratorWriter, fn *gir.Function, prefix string) bool
- func GenerateRecord(gen FileGeneratorWriter, record *gir.Record) bool
- func GenerateUnion(gen FileGeneratorWriter, union *gir.Union) bool
- func UniqueEnumMembers(members []gir.Member) []gir.Member
- type FileGenerator
- type FileGeneratorWriter
- type FileWriter
- type GeneratedGType
- type RecordConstructor
- type RecordGenerator
- type UnionField
- type UnionFieldMarshaler
- type UnionGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanGenerateAlias ¶
func CanGenerateAlias(gen FileGenerator, alias *gir.Alias) bool
CanGenerateAlias returns false if this alias cannot be generated.
func CanGenerateBitfield ¶
func CanGenerateBitfield(gen FileGenerator, bitfield *gir.Bitfield) bool
CanGenerateBitfield returns false if the bitfield cannot be generated.
func CanGenerateEnum ¶
func CanGenerateEnum(gen FileGenerator, enum *gir.Enum) bool
CanGenerateEnum returns false if the given enum cannot be generated.
func CanGenerateRecord ¶
func CanGenerateRecord(gen FileGenerator, rec *gir.Record) bool
CanGenerateRecord returns false if the record cannot be generated.
func FormatEnumMember ¶
FormatEnumMember returns the enum member's Go name.
func GenerateAlias ¶
func GenerateAlias(gen FileGeneratorWriter, alias *gir.Alias) bool
GenerateAlias generates an alias declaration into the given file generator. If the generation fails or is ignored, then false is returned.
func GenerateBitfield ¶
func GenerateBitfield(gen FileGeneratorWriter, bitfield *gir.Bitfield) bool
GenerateBitfield generates a bitfield type declaration as well as the constants and the type marshaler into the given file generator. If the generation fails or is ignored, then false is returned.
func GenerateCPrimitiveRecord ¶ added in v0.0.4
func GenerateCPrimitiveRecord(gen types.FileGenerator, rec *gir.Record) string
GenerateCPrimitiveRecord generates C struct code with primitive C types.
func GenerateCallback ¶
func GenerateCallback(gen FileGeneratorWriter, cb *gir.Callback) bool
GenerateCallback generates a callback type declaration and handler into the given file generator.
func GenerateClass ¶
func GenerateClass(gen FileGeneratorWriter, class *gir.Class) bool
GenerateClass generates the given class into files.
func GenerateConstant ¶
func GenerateConstant(gen FileGeneratorWriter, constant *gir.Constant) bool
func GenerateEnum ¶
func GenerateEnum(gen FileGeneratorWriter, enum *gir.Enum) bool
GenerateEnum generates an enum type declaration as well as the constants and the type marshaler.
func GenerateFunction ¶
func GenerateFunction(gen FileGeneratorWriter, fn *gir.Function) bool
GenerateFunction generates the function call for the given GIR function.
func GenerateInterface ¶
func GenerateInterface(gen FileGeneratorWriter, iface *gir.Interface) bool
GenerateInterface generates a public interface declaration, optionally another one for overriding, and the private struct that implements the interface specifically for wrapping opaque C interfaces.
func GeneratePrefixedFunction ¶
func GeneratePrefixedFunction(gen FileGeneratorWriter, fn *gir.Function, prefix string) bool
GeneratePrefixedFunction generates the given GIR function with the prefix prepended into the name.
func GenerateRecord ¶
func GenerateRecord(gen FileGeneratorWriter, record *gir.Record) bool
GenerateRecord generates the records.
func GenerateUnion ¶ added in v0.0.3
func GenerateUnion(gen FileGeneratorWriter, union *gir.Union) bool
GenerateUnion generates the union.
Types ¶
type FileGenerator ¶
type FileGenerator interface { types.FileGenerator }
FileGenerator describes the interface of a file generator. A FileGenerator is immutable: anything that takes in a FileGenerator cannot mutate the state of it.
type FileGeneratorWriter ¶
type FileGeneratorWriter interface { FileGenerator // FileWriter returns the file writer for the given source position. FileWriter(info cmt.InfoFields, export bool) FileWriter }
FileGeneratorWriter is a FileGenerator that can be mutated or written to.
func StubFileGeneratorWriter ¶
func StubFileGeneratorWriter(gen FileGenerator) FileGeneratorWriter
StubFileGeneratorWriterWriter wraps an existing FileGenerator around a stub file writer. This is useful for using existing functions that expect to write something, but only the checks are wanted.
type FileWriter ¶
type FileWriter interface { file.Headerer // Pen returns the generator's file writer. Pen() *pen.Pen }
FileWriter describes a file that generators can write into and change its file header.
func FileWriterExportedFromType ¶ added in v0.0.5
func FileWriterExportedFromType(w FileGeneratorWriter, v interface{}) FileWriter
FileWriterExportedFromType is like FileWriterFromType, but it should only contain exported Cgo functions.
func FileWriterFromType ¶
func FileWriterFromType(w FileGeneratorWriter, v interface{}) FileWriter
FileWriterFromType is a convenient function that returns the FileWriter from the given GIR type.
type GeneratedGType ¶ added in v0.0.4
func GenerateGType ¶ added in v0.0.4
func GenerateGType(gen FileGeneratorWriter, name, glibGetType string) (GeneratedGType, bool)
type RecordConstructor ¶
RecordConstructor describes a manual record constructor.
type RecordGenerator ¶
type RecordGenerator struct { *gir.Record GoName string Marshaler bool // TODO: move these out of here. Methods []callable.Generator Getters []recordGetter Setters []recordSetter // ManualConstructor is the body function of the manually-generated // constructor. Skip if empty. ManualConstructor *RecordConstructor // TODO: make a []callableGenerator for constructors Callable callable.Generator // contains filtered or unexported fields }
func NewRecordGenerator ¶
func NewRecordGenerator(gen FileGenerator) RecordGenerator
func (*RecordGenerator) CGoPtrType ¶ added in v0.0.4
func (rg *RecordGenerator) CGoPtrType() string
func (*RecordGenerator) Header ¶
func (rg *RecordGenerator) Header() *file.Header
hHeader returns the RecordGenerator's current file header.
func (*RecordGenerator) Logln ¶
func (rg *RecordGenerator) Logln(lvl logger.Level, v ...interface{})
func (*RecordGenerator) UseConstructor ¶
func (rg *RecordGenerator) UseConstructor(ctor *gir.Constructor) bool
type UnionField ¶ added in v0.0.3
type UnionFieldMarshaler ¶ added in v0.0.3
type UnionGenerator ¶ added in v0.0.3
type UnionGenerator struct { *gir.Union GoName string ImplName string Marshaler bool CastBlock string Marshalers []UnionFieldMarshaler Fields []UnionField // contains filtered or unexported fields }
func NewUnionGenerator ¶ added in v0.0.3
func NewUnionGenerator(gen FileGenerator) UnionGenerator
func (*UnionGenerator) Header ¶ added in v0.0.3
func (ug *UnionGenerator) Header() *file.Header
Header returns the union generator's headers.
func (*UnionGenerator) Logln ¶ added in v0.0.3
func (ug *UnionGenerator) Logln(lvl logger.Level, v ...interface{})
func (*UnionGenerator) Recv ¶ added in v0.0.3
func (ug *UnionGenerator) Recv() string
Recv returns the method receiver.