Documentation ¶
Overview ¶
Package file provides per-file state helpers, such as for tracking imports.
Index ¶
- Constants
- Variables
- func ApplyHeader(dst Headerer, srcs ...Headerer)
- func CallableExportedName(source *gir.NamespaceFindResult, callable *gir.CallableAttrs) string
- func ExportedName(source *gir.NamespaceFindResult, suffixes ...string) string
- func ImportCore(core string) string
- type Header
- func (h *Header) AddCBlock(block string)
- func (h *Header) AddCallbackHeader(header string)
- func (h *Header) AddMarshaler(glibGetType, goName string)
- func (h *Header) AddPackage(pkg string)
- func (h *Header) ApplyFrom(src *Header)
- func (h *Header) ApplyTo(dst *Header)
- func (h *Header) Copy() *Header
- func (h *Header) DashImport(path string)
- func (h *Header) HasImport(path string) bool
- func (h *Header) Import(path string)
- func (h *Header) ImportAlias(path, alias string)
- func (h *Header) ImportCore(core string)
- func (h *Header) ImportResolvedType(imports Import)
- func (h *Header) IncludeC(include string)
- func (h *Header) NeedsExternGLib()
- func (h *Header) NeedsGLibObject()
- func (h *Header) Reset()
- func (h *Header) SortedCIncludes() []string
- func (h *Header) SortedCallbackHeaders() []string
- type Headerer
- type Import
- type Marshaler
Constants ¶
const CoreImportPath = "github.com/diamondburned/gotk4/pkg/core"
CoreImportPath is the path to the core import path.
Variables ¶
var NoopHeader = &Header{stop: true}
NoopHeader is a header instance where its methods do nothing. This instance is useful for functions that both validate and generate, but generation is not wanted.
Functions ¶
func ApplyHeader ¶
ApplyHeader applies the given src headers to dst.
func CallableExportedName ¶ added in v0.0.3
func CallableExportedName(source *gir.NamespaceFindResult, callable *gir.CallableAttrs) string
CallableExportedName creates the exported C name of the given callback from the given namespace.
func ExportedName ¶ added in v0.0.3
func ExportedName(source *gir.NamespaceFindResult, suffixes ...string) string
ExportedName generates the full name for any exported function or variable generated by gotk4. It prepends the right strings to make the exported identifier unique in the C namespace.
func ImportCore ¶
ImportCore returns the path to import a core package.
Types ¶
type Header ¶
type Header struct { Marshalers []Marshaler Imports map[string]string CIncludes map[string]struct{} Packages map[string]struct{} // for pkg-config Callbacks map[string]struct{} // used for C blocks in general CallbackDelete bool // contains filtered or unexported fields }
Header describes the side effects of the conversion, such as importing new things or modifying the CGo preamble. A zero-value instance is a valid instance.
func CopyHeader ¶ added in v0.0.3
CopyHeader copies the given header.
func (*Header) AddCallbackHeader ¶
AddCallbackHeader adds a callback header raw.
func (*Header) AddMarshaler ¶
AddMarshaler adds the type marshaler into the init header. It also adds imports.
func (*Header) AddPackage ¶
AddPackage adds a pkg-config package.
func (*Header) ApplyTo ¶
ApplyTo applies the headers into the given one. The caller is responsible for calling this.
func (*Header) DashImport ¶
DashImport imports the given path if it's not already imported.
func (*Header) ImportAlias ¶
func (*Header) ImportResolvedType ¶
func (*Header) NeedsExternGLib ¶
func (h *Header) NeedsExternGLib()
needsExternGLib adds the external gotk3/glib import.
func (*Header) NeedsGLibObject ¶
func (h *Header) NeedsGLibObject()
NeedsGLibObject adds the glib-object.h include and the glib-2.0 package.
func (*Header) SortedCIncludes ¶
SortedCIncludes returns the list of C includes sorted.
func (*Header) SortedCallbackHeaders ¶
SortedCallbackHeaders returns the sorted C callback headers.
type Headerer ¶
type Headerer interface {
Header() *Header
}
Headerer is an interface of something that returns its internal header.