meta

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package meta provides facilities for working with Wayland protocol definitions written in XML.

The Wayland protocol DTD (Document Type Definition) can be found in the upstream Wayland repository.

Index

Constants

View Source
const (
	TypeInt    Type = "int"
	TypeUint   Type = "uint"
	TypeFixed  Type = "fixed"
	TypeString Type = "string"
	TypeObject Type = "object"
	TypeNewId  Type = "new_id"
	TypeArray  Type = "array"
	TypeFd     Type = "fd"

	ReqDestructor string = "destructor"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name        string      `xml:"name,attr"`
	Summary     string      `xml:"summary,attr"`
	Description Description `xml:"description"`

	Type      Type   `xml:"type,attr"`
	Interface string `xml:"interface,attr"`
	Enum      string `xml:"enum,attr"`
	Nullable  bool   `xml:"allow-null,attr"`
}

type Description

type Description struct {
	Content string `xml:",chardata"`
	Summary string `xml:"summary,attr"`
}

func (Description) Empty

func (d Description) Empty() bool

Empty returns whether or not this description is empty (i.e. it has neither a summary nor content.)

func (Description) HasContent

func (d Description) HasContent() bool

HasContent returns whether or not this description has any main content.

func (Description) HasSummary

func (d Description) HasSummary() bool

HasSummary returns whether or not this description has a summary.

type Entry

type Entry struct {
	Name            string      `xml:"name,attr"`
	Description     Description `xml:"description"`
	Summary         string      `xml:"summary,attr"`
	Since           int         `xml:"since,attr"`
	DeprecatedSince int         `xml:"deprecated-since,attr"`

	Value string `xml:"value,attr"`
}

type Enum

type Enum struct {
	Name        string      `xml:"name,attr"`
	Description Description `xml:"description"`
	Since       int         `xml:"since,attr"`
	Bitfield    bool        `xml:"bitfield,attr"`

	Entries []Entry `xml:"entry"`
}

func (Enum) Type

func (e Enum) Type() string

Type returns the Go type that represents the enum. If the enum is a bitfield its type should be `uint32`, otherwise, it should be `int32`.

type Event

type Event Request

func (Event) NumFds

func (e Event) NumFds() int

NumFds returns the number of file descriptor arguments contained by the event.

type Interface

type Interface struct {
	Name        string      `xml:"name,attr"`
	Version     int         `xml:"version,attr"`
	Description Description `xml:"description"`

	Requests []Request `xml:"request"`
	Events   []Event   `xml:"event"`
	Enums    []Enum    `xml:"enum"`
}

type Protocol

type Protocol struct {
	Name        string      `xml:"name,attr"`
	Copyright   string      `xml:"copyright"`
	Description Description `xml:"description"`

	Interfaces []Interface `xml:"interface"`
}

func Parse

func Parse(data []byte) (Protocol, error)

Parse attempts to parse a Wayland protocol definition XML.

type Request

type Request struct {
	Name            string      `xml:"name,attr"`
	Description     Description `xml:"description"`
	Since           int         `xml:"since,attr"`
	DeprecatedSince int         `xml:"deprecated-since,attr"`

	Type string `xml:"type,attr"`
	Args []Arg  `xml:"arg"`
}

func (Request) NumFds

func (r Request) NumFds() int

NumFds returns the number of file descriptor arguments contained by the request.

type Type

type Type string

Jump to

Keyboard shortcuts

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