gir

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 13 Imported by: 7

Documentation

Overview

Package gir provides GIR types, as well as functions that parse GIR files.

For reference, see https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/HEAD/docs/gir-1.2.rnc.

Index

Constants

View Source
const (
	SignalWhenFirst   = "first"
	SignalWhenLast    = "last"
	SignalWhenCleanup = "cleanup"
)

Variables

This section is empty.

Functions

func EqVersion

func EqVersion(v1, v2 string) bool

EqVersion compares major versions.

func FindGIRFiles added in v0.3.0

func FindGIRFiles(pkgs ...string) ([]string, error)

FindGIRFiles finds gir files from the given list of pkgs.

func GoNamespace

func GoNamespace(namespace *Namespace) string

GoNamespace converts a namespace's name to a Go package name.

func GoPackageName

func GoPackageName(girPkgName string) string

GoPackageName converts a GIR package name to a Go package name. It's only tested against a known set of GIR files.

func ImportPath

func ImportPath(root, pkgPath string) string

ImportPath generates the full import path from the package root.

func MajorVersion

func MajorVersion(version string) string

MajorVersion returns the major version number only.

func ParseVersionName

func ParseVersionName(fullNamespace string) (name, majorVersion string)

ParseVersionName parses the given full namespace to return the original name and the version separately. If no versions are available, then the empty string is returned.

func SearchNamespace

func SearchNamespace(namespace *Namespace, f func(typ, ctyp string) bool) interface{}

SearchNamespace searches the namespace for the given type name. The returned interface may be any of the types in TypeFindResult.

func SplitGIRType

func SplitGIRType(typ string) (namespace, typeName string)

SplitGIRType splits the given GIR type string into 2 parts: the namespace, which preceeds the period, and the type name. If there is no period, then an empty string is returned for namespace.

func VersionedName

func VersionedName(name, version string) string

VersionedName returns the name appended with the version suffix.

func VersionedNamespace

func VersionedNamespace(namespace *Namespace) string

VersionedNamespace returns the versioned name for the given namespace.

Types

type Alias

type Alias struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 alias"`

	Name  string `xml:"name,attr"`
	CType string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`

	InfoAttrs
	InfoElements

	Type Type `xml:"https://www.gtk.org/introspection/core/1.0 type"`
}

type Annotation

type Annotation struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 attribute"`
	Name    string   `xml:"name,attr"`
	Value   string   `xml:"value,attr"`
}

type AnyType

type AnyType struct {
	// Possible variants.
	Type  *Type  `xml:"https://www.gtk.org/introspection/core/1.0 type"`
	Array *Array `xml:"https://www.gtk.org/introspection/core/1.0 array"`
}

type Array

type Array struct {
	XMLName        xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 array"`
	Name           string   `xml:"name,attr"`
	CType          string   `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	Length         *int     `xml:"length,attr"` // ix of .Parameters
	ZeroTerminated *bool    `xml:"zero-terminated,attr"`
	FixedSize      int      `xml:"fixed-size,attr"`
	Introspectable bool     `xml:"introspectable,attr"`
	// Type is the array's inner type.
	Type *Type `xml:"https://www.gtk.org/introspection/core/1.0 type"`
}

func (Array) IsZeroTerminated

func (a Array) IsZeroTerminated() bool

IsZeroTerminated returns true if the Array is zero-terminated. It accounts for edge cases of the structure.

type Bitfield

type Bitfield struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 bitfield"`

	Name         string `xml:"name,attr"` // Go case
	CType        string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	GLibTypeName string `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType  string `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`

	Members   []Member   `xml:"https://www.gtk.org/introspection/core/1.0 member"`
	Functions []Function `xml:"https://www.gtk.org/introspection/core/1.0 function"`

	InfoAttrs
	InfoElements
}

type Boxed

type Boxed struct{}

type CInclude

type CInclude struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/c/1.0 include"`
	Name    string   `xml:"name,attr"`
}

type CallableAttrs

type CallableAttrs struct {
	Name        string       `xml:"name,attr"`
	CIdentifier string       `xml:"https://www.gtk.org/introspection/c/1.0 identifier,attr"`
	ShadowedBy  string       `xml:"shadowed-by,attr"`
	Shadows     string       `xml:"shadows,attr"`
	Throws      bool         `xml:"throws,attr"`
	MovedTo     string       `xml:"moved-to,attr"`
	Parameters  *Parameters  `xml:"https://www.gtk.org/introspection/core/1.0 parameters"`
	ReturnValue *ReturnValue `xml:"https://www.gtk.org/introspection/core/1.0 return-value"`
	InfoAttrs
	InfoElements
}

type Callback

type Callback struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 callback"`
	CallableAttrs
}

type Class

type Class struct {
	XMLName  xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 class"`
	Name     string   `xml:"name,attr"`
	Parent   string   `xml:"parent,attr"`
	Abstract bool     `xml:"abstract,attr"`

	CType         string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	CSymbolPrefix string `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefix,attr"`

	GLibTypeName   string `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType    string `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`
	GLibTypeStruct string `xml:"https://www.gtk.org/introspection/glib/1.0 type-struct,attr"`

	InfoAttrs
	InfoElements

	Functions      []Function      `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	Implements     []Implements    `xml:"https://www.gtk.org/introspection/core/1.0 implements"`
	Constructors   []Constructor   `xml:"https://www.gtk.org/introspection/core/1.0 constructor"`
	Methods        []Method        `xml:"https://www.gtk.org/introspection/core/1.0 method"`
	VirtualMethods []VirtualMethod `xml:"https://www.gtk.org/introspection/core/1.0 virtual-method"`
	Fields         []Field         `xml:"https://www.gtk.org/introspection/core/1.0 field"`
	Signals        []Signal        `xml:"https://www.gtk.org/introspection/glib/1.0 signal"`
}

type Constant

type Constant struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 constant"`
	Name    string   `xml:"name,attr"`
	Value   string   `xml:"value,attr"`
	CType   string   `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`

	Type Type `xml:"https://www.gtk.org/introspection/core/1.0 type"`

	InfoAttrs
	InfoElements
}

type Constructor

type Constructor struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 constructor"`
	CallableAttrs
}

type Doc

type Doc struct {
	XMLName  xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 doc"`
	Filename string   `xml:"filename,attr"`
	String   string   `xml:",innerxml"`
	Line     int      `xml:"line,attr"`
}

type DocDeprecated

type DocDeprecated struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 doc-deprecated"`
	String  string   `xml:",innerxml"`
}

type DocElements

type DocElements struct {
	Doc            *Doc
	DocDeprecated  *DocDeprecated
	SourcePosition *SourcePosition
}

type Enum

type Enum struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 enumeration"`

	Name            string `xml:"name,attr"` // Go case
	CType           string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	GLibTypeName    string `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType     string `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`
	GLibErrorDomain string `xml:"https://www.gtk.org/introspection/glib/1.0 error-domain,attr"`

	Members   []Member   `xml:"https://www.gtk.org/introspection/core/1.0 member"`
	Functions []Function `xml:"https://www.gtk.org/introspection/core/1.0 function"`

	InfoAttrs
	InfoElements
}

type Field

type Field struct {
	XMLName  xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 field"`
	Name     string   `xml:"name,attr"`
	Bits     int      `xml:"bits,attr"`
	Private  bool     `xml:"private,attr"`
	Writable bool     `xml:"writable,attr"` // default false
	Readable *bool    `xml:"readable,attr"` // default true
	AnyType
	Callback *Callback
	Doc      *Doc
}

func (Field) IsReadable

func (f Field) IsReadable() bool

IsReadable returns true if the field is readable.

type Function

type Function struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	CallableAttrs
}

type Implements

type Implements struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 implements"`
	Name    string   `xml:"name,attr"`
}

type Include

type Include struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 include"`
	Name    string   `xml:"name,attr"`
	Version string   `xml:"version,attr"`
}

type InfoAttrs

type InfoAttrs struct {
	Introspectable    *bool  `xml:"introspectable,attr"` // default true
	Deprecated        bool   `xml:"deprecated,attr"`
	DeprecatedVersion string `xml:"deprecated-version,attr"`
	Version           string `xml:"version,attr"`
	Stability         string `xml:"stability,attr"`
}

func (InfoAttrs) IsIntrospectable

func (inf InfoAttrs) IsIntrospectable() bool

IsIntrospectable returns true if the InfoAttrs indicates that the type is introspectable.

type InfoElements

type InfoElements struct {
	DocElements
	Annotations []Annotation `xml:"https://www.gtk.org/introspection/core/1.0 attribute"`
}

type InstanceParameter

type InstanceParameter struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 instance-parameter"`
	ParameterAttrs
}

type Interface

type Interface struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 interface"`
	Name    string   `xml:"name,attr"`

	CType         string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	CSymbolPrefix string `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefix,attr"`

	GLibTypeName   string `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType    string `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`
	GLibTypeStruct string `xml:"https://www.gtk.org/introspection/glib/1.0 type-struct,attr"`

	Functions      []Function      `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	Methods        []Method        `xml:"https://www.gtk.org/introspection/core/1.0 method"`
	VirtualMethods []VirtualMethod `xml:"https://www.gtk.org/introspection/core/1.0 virtual-method"`
	Prerequisites  []Prerequisite  `xml:"https://www.gtk.org/introspection/core/1.0 prerequisite"`
	Signals        []Signal        `xml:"https://www.gtk.org/introspection/glib/1.0 signal"`

	InfoAttrs
	InfoElements
}

type Member

type Member struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 member"`

	Names       []xml.Attr `xml:"name,attr"`
	Value       string     `xml:"value,attr"`
	CIdentifier string     `xml:"https://www.gtk.org/introspection/c/1.0 identifier,attr"`
	GLibNick    string     `xml:"https://www.gtk.org/introspection/glib/1.0 nick,attr"`

	InfoAttrs
	InfoElements
}

func (Member) GLibName

func (m Member) GLibName() string

func (Member) Name

func (m Member) Name() string

type Method

type Method struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 method"`
	CallableAttrs
}

type Namespace

type Namespace struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 namespace"`

	Name                string `xml:"name,attr"`
	Version             string `xml:"version,attr"`
	CIdentifierPrefixes string `xml:"https://www.gtk.org/introspection/c/1.0 identifier-prefixes,attr"`
	CSymbolPrefixes     string `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefixes,attr"`
	Prefix              string `xml:"https://www.gtk.org/introspection/c/1.0 prefix,attr"`
	SharedLibrary       string `xml:"shared-library,attr"`

	Aliases     []Alias      `xml:"https://www.gtk.org/introspection/core/1.0 alias"`
	Classes     []Class      `xml:"https://www.gtk.org/introspection/core/1.0 class"`
	Interfaces  []Interface  `xml:"https://www.gtk.org/introspection/core/1.0 interface"`
	Records     []Record     `xml:"https://www.gtk.org/introspection/core/1.0 record"`
	Enums       []Enum       `xml:"https://www.gtk.org/introspection/core/1.0 enumeration"`
	Functions   []Function   `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	Unions      []Union      `xml:"https://www.gtk.org/introspection/core/1.0 union"`
	Bitfields   []Bitfield   `xml:"https://www.gtk.org/introspection/core/1.0 bitfield"`
	Callbacks   []Callback   `xml:"https://www.gtk.org/introspection/core/1.0 callback"`
	Constants   []Constant   `xml:"https://www.gtk.org/introspection/core/1.0 constant"`
	Annotations []Annotation `xml:"https://www.gtk.org/introspection/core/1.0 attribute"`
	Boxeds      []Boxed      `xml:"https://www.gtk.org/introspection/core/1.0 boxed"`
}

type NamespaceFindResult

type NamespaceFindResult struct {
	Repository *PkgRepository
	Namespace  *Namespace
}

NamespaceFindResult is the result returned from FindNamespace.

func (*NamespaceFindResult) Eq

Eq compares that the resulting namespace's name and version match.

func (*NamespaceFindResult) Versioned

func (res *NamespaceFindResult) Versioned() string

Versioned returns the versioned namespace name.

type Package

type Package struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 package"`
	Name    string   `xml:"name,attr"`
}

type Parameter

type Parameter struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 parameter"`
	ParameterAttrs
}

type ParameterAttrs

type ParameterAttrs struct {
	Name            string `xml:"name,attr"`
	Direction       string `xml:"direction,attr"`
	Scope           string `xml:"scope,attr"`
	Closure         *int   `xml:"closure,attr"`
	Destroy         *int   `xml:"destroy,attr"`
	CallerAllocates bool   `xml:"caller-allocates,attr"`
	Skip            bool   `xml:"skip,attr"`
	Optional        bool   `xml:"optional,attr"`
	Nullable        bool   `xml:"nullable,attr"`

	TransferOwnership
	AnyType
	Doc *Doc
}

type Parameters

type Parameters struct {
	XMLName           xml.Name           `xml:"https://www.gtk.org/introspection/core/1.0 parameters"`
	InstanceParameter *InstanceParameter `xml:"https://www.gtk.org/introspection/core/1.0 instance-parameter"`
	Parameters        []Parameter        `xml:"https://www.gtk.org/introspection/core/1.0 parameter"`
}

type PkgRepository

type PkgRepository struct {
	Repository
	Pkg  string // arg for pkg-config
	Path string // gir file path
}

PkgRepository wraps a Repository to add additional information.

type Prerequisite

type Prerequisite struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 prerequisite"`
	Name    string   `xml:"name,attr"`
}

type Property

type Property struct{}

type Record

type Record struct {
	XMLName              xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 record"`
	Name                 string   `xml:"name,attr"`
	CType                string   `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	GLibTypeName         string   `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType          string   `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`
	CSymbolPrefix        string   `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefix,attr"`
	GLibIsGTypeStructFor string   `xml:"https://www.gtk.org/introspection/glib/1.0 is-gtype-struct-for,attr"`
	Disguised            bool     `xml:"disguised,attr"`
	Foreign              bool     `xml:"foreign,attr"`

	Fields       []Field       `xml:"https://www.gtk.org/introspection/core/1.0 field"`
	Functions    []Function    `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	Unions       []Union       `xml:"https://www.gtk.org/introspection/core/1.0 union"`
	Methods      []Method      `xml:"https://www.gtk.org/introspection/core/1.0 method"`
	Constructors []Constructor `xml:"https://www.gtk.org/introspection/core/1.0 constructor"`
	Properties   []Property    `xml:"https://www.gtk.org/introspection/core/1.0 property"`

	InfoAttrs
	InfoElements
}

type Repositories

type Repositories []PkgRepository

Repositories contains a list of known repositories.

func (*Repositories) Add

func (repos *Repositories) Add(pkg string) error

Add finds the given pkg name to be searched using pkg-config and added into the list of repositories.

func (*Repositories) AddSelected

func (repos *Repositories) AddSelected(pkg string, wantedNames []string) error

AddSelected adds a single package but only searches for the given list of GIR files.

func (Repositories) FindFullType

func (repos Repositories) FindFullType(fullType string) *TypeFindResult

FindFullType finds a type from the given fullType string. The fullType string MUST have the namespace version, suck as Gdk-2.Item.

func (Repositories) FindInclude

func (repos Repositories) FindInclude(
	res *NamespaceFindResult, includes string,
) *NamespaceFindResult

FindInclude returns the namespace that the given namespace includes. It resolves imports recursively. This function is primarily used to ensure that proper versions are imported.

func (Repositories) FindNamespace

func (repos Repositories) FindNamespace(name string) *NamespaceFindResult

FindNamespace finds the repository and namespace with the given name and version. If name doesn't have the version bits, then it panics.

func (Repositories) FindType

func (repos Repositories) FindType(nsp *NamespaceFindResult, typ string) *TypeFindResult

FindType finds a type in the repositories from the given current namespace and the GIR type name. The function will cache the returned TypeFindResult.

func (Repositories) FromGIRFile

func (repos Repositories) FromGIRFile(girFile string) *PkgRepository

FromGIRFile finds the repository from the given GIR filename.

func (Repositories) FromPkg

func (repos Repositories) FromPkg(pkg string) []PkgRepository

FromPkg finds the repository from the given package name.

type Repository

type Repository struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 repository"`

	Version             string `xml:"version,attr"`
	CIdentifierPrefixes string `xml:"https://www.gtk.org/introspection/c/1.0 identifier-prefixes,attr"`
	CSymbolPrefixes     string `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefixes,attr"`

	Includes   []Include   `xml:"https://www.gtk.org/introspection/core/1.0 include"`
	CIncludes  []CInclude  `xml:"https://www.gtk.org/introspection/c/1.0 include"`
	Packages   []Package   `xml:"https://www.gtk.org/introspection/core/1.0 package"`
	Namespaces []Namespace `xml:"https://www.gtk.org/introspection/core/1.0 namespace"`
}

Repository represents a GObject Introspection Repository, which contains the includes, C includes and namespaces of a single gir file.

func ParseRepository

func ParseRepository(file string) (*Repository, error)

ParseRepository parses a repository from the given file path.

func ParseRepositoryFromReader

func ParseRepositoryFromReader(r io.Reader) (*Repository, error)

ParseRepositoryFromReader parses a repository from the given reader.

type ReturnValue

type ReturnValue struct {
	XMLName        xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 return-value"`
	Scope          string   `xml:"scope,attr"`
	Closure        *int     `xml:"closure,attr"`
	Destroy        *int     `xml:"destroy,attr"`
	Introspectable bool     `xml:"introspectable,attr"`
	Nullable       bool     `xml:"nullable,attr"`
	Skip           bool     `xml:"skip,attr"`
	AllowNone      bool     `xml:"allow-none,attr"`
	TransferOwnership
	DocElements
	AnyType
}

type Signal

type Signal struct {
	XMLName   xml.Name   `xml:"https://www.gtk.org/introspection/glib/1.0 signal"`
	Name      string     `xml:"name,attr"`
	Detailed  bool       `xml:"detailed,attr"`
	When      SignalWhen `xml:"when,attr"`
	Action    bool       `xml:"action,attr"`
	NoHooks   bool       `xml:"no-hooks,attr"`
	NoRecurse bool       `xml:"no-recurse,attr"`
	InfoElements
	Parameters  *Parameters  `xml:"https://www.gtk.org/introspection/core/1.0 parameters"`
	ReturnValue *ReturnValue `xml:"https://www.gtk.org/introspection/core/1.0 return-value"`
}

type SignalWhen

type SignalWhen string

type SourcePosition

type SourcePosition struct {
	XMLName  xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 source-position"`
	Filename string   `xml:"filename,attr"`
	Line     int      `xml:"line,attr"`
	Column   int      `xml:"column,attr"`
}

type TransferOwnership

type TransferOwnership struct {
	TransferOwnership string `xml:"transfer-ownership,attr"`
}

type Type

type Type struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 type"`

	Name           string `xml:"name,attr"`
	CType          string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	Introspectable *bool  `xml:"introspectable,attr"`

	DocElements
	// Types is the type's inner types.
	Types []Type `xml:"https://www.gtk.org/introspection/core/1.0 type"`
}

func (Type) IsIntrospectable

func (typ Type) IsIntrospectable() bool

type TypeFindResult

type TypeFindResult struct {
	*NamespaceFindResult

	// Types:
	//   *Alias
	//   *Class
	//   *Interface
	//   *Record
	//   *Enum
	//   *Function
	//   *Union
	//   *Bitfield
	//   *Callback
	Type interface{}
}

TypeFindResult is the result

func (*TypeFindResult) CType

func (res *TypeFindResult) CType() string

CType returns the resulting type's C type identifier.

func (*TypeFindResult) IsIntrospectable

func (res *TypeFindResult) IsIntrospectable() bool

IsIntrospectable returns true if the type inside the result is introspectable.

func (*TypeFindResult) MustFindGIR added in v0.0.4

func (res *TypeFindResult) MustFindGIR() string

MustFindGIR generates a girepository.MustFind call for the TypeFindResult.

func (*TypeFindResult) Name

func (res *TypeFindResult) Name() string

Name returns the copy of the type's name.

func (*TypeFindResult) NamespacedType

func (res *TypeFindResult) NamespacedType() string

NamespacedType returns the copy of the type's name with the namespace prepended to it.

func (*TypeFindResult) SetCType

func (res *TypeFindResult) SetCType(ctype string)

SetCType sets the type's name. Note that this will change the type inside the repositories as well.

func (*TypeFindResult) SetName

func (res *TypeFindResult) SetName(name string)

SetName sets the type's name. Note that this will change the type inside the repositories as well.

func (*TypeFindResult) VersionedNamespaceType

func (res *TypeFindResult) VersionedNamespaceType() string

VersionedNamespaceType is like NamespacedType, but the returned type has the namespace and its version.

type Union

type Union struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 union"`

	Name          string `xml:"name,attr"` // Go case
	CType         string `xml:"https://www.gtk.org/introspection/c/1.0 type,attr"`
	CSymbolPrefix string `xml:"https://www.gtk.org/introspection/c/1.0 symbol-prefix,attr"`
	GLibTypeName  string `xml:"https://www.gtk.org/introspection/glib/1.0 type-name,attr"`
	GLibGetType   string `xml:"https://www.gtk.org/introspection/glib/1.0 get-type,attr"`

	InfoAttrs
	InfoElements

	Fields       []Field       `xml:"https://www.gtk.org/introspection/core/1.0 field"`
	Constructors []Constructor `xml:"https://www.gtk.org/introspection/core/1.0 constructor"`
	Methods      []Method      `xml:"https://www.gtk.org/introspection/core/1.0 method"`
	Functions    []Function    `xml:"https://www.gtk.org/introspection/core/1.0 function"`
	Records      []Record      `xml:"https://www.gtk.org/introspection/core/1.0 record"`
}

type VarArgs

type VarArgs struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 varargs"`
}

type VirtualMethod

type VirtualMethod struct {
	XMLName xml.Name `xml:"https://www.gtk.org/introspection/core/1.0 virtual-method"`

	Invoker string `xml:"invoker,attr"`
	CallableAttrs
}

Directories

Path Synopsis
cmd
gir-generate/gendata
Package gendata contains data used to generate GTK4 bindings for Go.
Package gendata contains data used to generate GTK4 bindings for Go.
cmt
Package cmt provides functions that parse and render GIR comments into nice and conventional Go comments.
Package cmt provides functions that parse and render GIR comments into nice and conventional Go comments.
file
Package file provides per-file state helpers, such as for tracking imports.
Package file provides per-file state helpers, such as for tracking imports.
generators/callable
Package callable provides a generic callable generator.
Package callable provides a generic callable generator.
generators/iface
Package iface provides an interface generator.
Package iface provides an interface generator.
gotmpl
Package gotmpl provides abstractions around text/template to better generate Go files.
Package gotmpl provides abstractions around text/template to better generate Go files.
logger
Package logger provides abstractions over girgen's logging.
Package logger provides abstractions over girgen's logging.
pen
strcases
Package strcases provides helper functions to convert between string cases, such as Pascal Case, snake_case and Go's Mixed Caps, along with various special cases.
Package strcases provides helper functions to convert between string cases, such as Pascal Case, snake_case and Go's Mixed Caps, along with various special cases.
types/typeconv
Package typeconv provides conversions between C and Go types.
Package typeconv provides conversions between C and Go types.
internal
ptr
Package pkgconfig provides a wrapper around the pkg-config binary.
Package pkgconfig provides a wrapper around the pkg-config binary.

Jump to

Keyboard shortcuts

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