xml

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PdscTag

type PdscTag struct {
	XMLName xml.Name `xml:"pdsc"`
	Vendor  string   `xml:"vendor,attr"`
	URL     string   `xml:"url,attr"`
	Name    string   `xml:"name,attr"`
	Version string   `xml:"version,attr"`
}

PdscTag maps a <pdsc> tag that goes in PIDX files.

func (*PdscTag) Key

func (p *PdscTag) Key() string

Key returns this pdscTag unique key.

func (*PdscTag) PackURL added in v0.3.0

func (p *PdscTag) PackURL() string

PackURL constructs a URL of a pack using the tag's attributes.

type PdscXML

type PdscXML struct {
	XMLName xml.Name `xml:"package"`
	Vendor  string   `xml:"vendor"`
	URL     string   `xml:"url"`
	Name    string   `xml:"name"`
	License string   `xml:"license"`

	ReleasesTag struct {
		XMLName  xml.Name     `xml:"releases"`
		Releases []ReleaseTag `xml:"release"`
	} `xml:"releases"`

	FileName string
}

PdscXML maps few tags of a PDSC file. Ref: https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Utilities/PACK.xsd

func NewPdscXML

func NewPdscXML(fileName string) *PdscXML

NewPdscXML receives a PDSC file name to be later read into the PdscXML struct

func (*PdscXML) FindReleaseTagByVersion added in v0.3.0

func (p *PdscXML) FindReleaseTagByVersion(version string) *ReleaseTag

FindReleaseTagByVersion iterates over the PDSC file's releases tag and returns the release that matching version.

func (*PdscXML) LatestVersion

func (p *PdscXML) LatestVersion() string

LatestVersion returns a string containing version of the first tag within the <releases> tag.

func (*PdscXML) PackURL added in v0.3.0

func (p *PdscXML) PackURL(version string) string

PackURL returns a url for the Pack described in this PDSC file

func (*PdscXML) Read

func (p *PdscXML) Read() error

Read reads the PDSC file specified in p.FileName into the PdscXML struct

func (*PdscXML) Tag

func (p *PdscXML) Tag() PdscTag

Tag returns a PdscTag representation of a PDSC file.

type PidxXML

type PidxXML struct {
	XMLName       xml.Name `xml:"index"`
	SchemaVersion string   `xml:"schemaVersion,attr"`
	Vendor        string   `xml:"vendor"`
	URL           string   `xml:"url"`

	Pindex struct {
		XMLName xml.Name  `xml:"pindex"`
		Pdscs   []PdscTag `xml:"pdsc"`
	} `xml:"pindex"`
	// contains filtered or unexported fields
}

PidxXML maps the PIDX file format. Ref: https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Utilities/PackIndex.xsd

func NewPidxXML

func NewPidxXML(fileName string) *PidxXML

NewPidxXML creates a new instance of the PidxXML struct.

func (*PidxXML) AddPdsc

func (p *PidxXML) AddPdsc(pdsc PdscTag) error

AddPdsc takes in a PdscTag and add it to the <pindex> tag.

func (*PidxXML) FindPdscTag added in v0.3.0

func (p *PidxXML) FindPdscTag(pdsc PdscTag) *PdscTag

FindPdscTag takes in a sample pdscTag and returns the actual PDSC tag inside this PidxXML.

func (*PidxXML) HasPdsc

func (p *PidxXML) HasPdsc(pdsc PdscTag) bool

HasPdsc tells whether of not pdsc is already present in this pidx file.

func (*PidxXML) ListPdscs added in v0.3.0

func (p *PidxXML) ListPdscs() map[string]PdscTag

ListPdscs returns a map of PdscTags in the pidx document

func (*PidxXML) Read

func (p *PidxXML) Read() error

Read reads FileName into this PidxXML struct and allocates memory for all PDSC tags.

func (*PidxXML) RemovePdsc

func (p *PidxXML) RemovePdsc(pdsc PdscTag) error

RemovePdsc takes in a PdscTag and remove it from the <pindex> tag.

func (*PidxXML) Write

func (p *PidxXML) Write() error

Save saves this PidxXML struct into its fileName.

type ReleaseTag

type ReleaseTag struct {
	XMLName xml.Name `xml:"release"`
	Version string   `xml:"version,attr"`
	Date    string   `xml:"Date,attr"`
	URL     string   `xml:"url,attr"`
}

ReleaseTag maps the <release> tag of a PDSC file.

Jump to

Keyboard shortcuts

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