gen

package
v0.0.0-...-ac156b6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

Generator

This software parse doc bluez folder and output a set of struct to interact with the bluez DBus API.

Notes

  • Generated files have a gen_ prefix, followed by the API name
  • If a <API name>.go file exists, it will be skipped from the generation. This to allow custom code to live with generated one.
  • Generation process does not overwrite existing files, ensure to remove previously generated files.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func ListFiles

func ListFiles(dir string) ([]string, error)

ListFiles return a list of bluez api txt

func Mkdir

func Mkdir(dirpath string) error

Mkdir Create a dir if not exists

func ReadFile

func ReadFile(srcFile string) ([]byte, error)

ReadFile read a file content

Types

type Api

type Api struct {
	Title       string
	Description string
	Service     string
	Interface   string
	ObjectPath  string
	Methods     []Method
	// those are currently avail only in health-api
	Signals    []Method
	Properties []Property
}

type ApiDoc

type ApiDoc struct {
	Api              Api
	InterfaceName    string
	Package          string
	Properties       []PropertyDoc
	Methods          []MethodDoc
	Imports          string
	Constructors     []Constructor
	ExposeProperties bool
}

type ApiGroup

type ApiGroup struct {
	FileName    string
	Name        string
	Description string
	Api         []Api
	// contains filtered or unexported fields
}

func NewApiGroup

func NewApiGroup(srcFile string) (ApiGroup, error)

NewApiGroup initialize a new ApiGroup

func (*ApiGroup) Parse

func (g *ApiGroup) Parse(srcFile string) error

Parse load a documentation file and parse the content

type ApiGroupDoc

type ApiGroupDoc struct {
	ApiGroup
	Package string
}

type Arg

type Arg struct {
	Type string
	Name string
}

type BluezAPI

type BluezAPI struct {
	Version string
	Api     []ApiGroup
}

func LoadJSON

func LoadJSON(srcFile string) (*BluezAPI, error)

LoadJSON parse an ApiGroup from JSON definition

func Parse

func Parse(docsDir string, filters []string) (BluezAPI, error)

Parse bluez DBus API docs

func (*BluezAPI) Serialize

func (g *BluezAPI) Serialize(destFile string) error

Serialize store the structure as JSON

type BluezError

type BluezError struct {
	Name  string
	Error string
}

type BluezErrors

type BluezErrors struct {
	List []BluezError
}

type Constructor

type Constructor struct {
	Service    string
	Role       string
	ObjectPath string
	Args       string
	ArgsDocs   string
	Docs       []string
}

type Flag

type Flag int
const (
	FlagReadOnly     Flag = 1
	FlagWriteOnly    Flag = 2
	FlagReadWrite    Flag = 3
	FlagExperimental Flag = 4
)

type InterfaceDoc

type InterfaceDoc struct {
	Title     string
	Name      string
	Interface string
}

type InterfacesDoc

type InterfacesDoc struct {
	Interfaces []InterfaceDoc
}

type Method

type Method struct {
	Name       string
	ReturnType string
	Args       []Arg
	Errors     []string
	Docs       string
}

type MethodDoc

type MethodDoc struct {
	Method
	ArgsList             string
	ParamsList           string
	SingleReturn         bool
	ReturnVarsDefinition string
	ReturnVarsRefs       string
	ReturnVarsList       string
}

type Property

type Property struct {
	Name  string
	Type  string
	Docs  string
	Flags []Flag
}

type PropertyDoc

type PropertyDoc struct {
	Property
	RawType            string
	RawTypeInitializer string
	ReadOnly           bool
	WriteOnly          bool
	ReadWrite          bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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