Documentation
¶
Overview ¶
Package tree is an nary tree that stores operational mode templates using maps of strings to nodes as the linkage mechanism.
Index ¶
- func PathErrorf(etype PErr, p Path, eelem string, matches []*OpTree) error
- type ChildIterator
- type OpTree
- func (t *OpTree) AddChild(child *OpTree) error
- func (t *OpTree) Child(name string) (*OpTree, error)
- func (t *OpTree) ChildOrTag(name string) (*OpTree, error)
- func (t *OpTree) DelChild(name string) error
- func (t *OpTree) Descendant(p Path) (*OpTree, error)
- func (t *OpTree) Include() *OpTree
- func (t *OpTree) Name() string
- func (t *OpTree) Parent() (*OpTree, error)
- func (t *OpTree) Print(depth int)
- func (t *OpTree) SetInclude(i *OpTree) error
- func (t *OpTree) SetName(name string)
- func (t *OpTree) SetParent(p *OpTree) error
- func (t *OpTree) SetValue(template *tmpl.OpTmpl) error
- func (t *OpTree) Value() *tmpl.OpTmpl
- type PErr
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChildIterator ¶
type ChildIterator struct {
// contains filtered or unexported fields
}
ChildIterator allows interating over a map of child nodes.
func NewChildIterator ¶
func NewChildIterator(t *OpTree) *ChildIterator
NewChildIterator creates a child iterator for the provided tree.
func (*ChildIterator) HasNext ¶
func (i *ChildIterator) HasNext() bool
HasNext checks if there is another available element for the iterator.
func (*ChildIterator) Value ¶
func (i *ChildIterator) Value() *OpTree
Value allows accessing the child at the current iterator position.
type OpTree ¶
type OpTree struct {
// contains filtered or unexported fields
}
OpTree is a representation of the operational mode template tree.
func BuildOpTree ¶
func (*OpTree) ChildOrTag ¶
ChildOrTag returns a nodes child for a given name or the tag node
func (*OpTree) Descendant ¶
Descendant walks a given path returning the node if it is found.
func (*OpTree) Print ¶
Print prints out the template tree, this is useful for debugging but not much else.
func (*OpTree) SetInclude ¶
SetInclude overwrites the include value for the node.
type PErr ¶
type PErr uint
PErr allows for an appropriate error message to be generated when accessing an invalid path