TreeItem

The TreeItem mixin turns its target into a tree item.

Members

Functions

addChild
void addChild(TreeItemType child)

Adds child to the back.

addNewChild
IT addNewChild(A a)

Constructs, adds to the back then returns a new child. This method should be prefered over addChild and insertChild if deleteChildren() is used.

addNewSibling
IT addNewSibling(A a)

Constructs, adds to the back then returns a new sibling. This method should be prefered over addChild and insertChild if deleteChildren() is used.

addSibling
void addSibling(TreeItemType sibling)

Adds an item at the end of list.

children
TreeItemChildren!TreeItemType children()

Returns an input range that allows to iterate the children. The array syntax is also supported.

childrenCount
size_t childrenCount()

Returns the children count.

deleteChildren
void deleteChildren()

Removes and deletes (destroy) the children.

exchangeSibling
void exchangeSibling(TreeItemType sibling1, TreeItemType sibling2)

Exchanges the position of two siblings.

findSibling
ptrdiff_t findSibling(TreeItemType sibling)

Returns the index of sibling if it's found otherwise -1.

firstChild
TreeItemType firstChild()

Returns the first child.

firstSibling
TreeItemType firstSibling()

Returns the first item. The value returned is never null.

hasSibling
bool hasSibling()

Indicates if the item has neighboors.

insertChild
void insertChild(TreeItemType child)

Inserts the first child.

insertChild
void insertChild(size_t index, TreeItemType child)

Inserts a child.

insertSibling
void insertSibling(TreeItemType sibling)

Inserts an item at the beginning of the list.

insertSibling
void insertSibling(size_t index, TreeItemType sibling)

Inserts a sibling.

itemToTextNative
char[] itemToTextNative()

Converts the node to a string. This is used to represent the whole tree in saveToStream().

lastSibling
TreeItemType lastSibling()

Returns the last item. The value returned is never null.

level
size_t level()

Returns the distance to the root.

nextSibling
TreeItemType nextSibling()

Returns the next TreeItem.

parent
TreeItemType parent()

Returns the parent.

prevSibling
TreeItemType prevSibling()

Returns the previous TreeItem.

removeChild
bool removeChild(TreeItemType child)

Removes a child from the list.

removeChild
TreeItemType removeChild(size_t index)

Removes the nth child.

removeChildren
void removeChildren()

Removes the children, without destructing them. After the call, the links to the items siblings are also reset to null.

removeSibling
bool removeSibling(TreeItemType sibling)

Removes an item.

removeSibling
TreeItemType removeSibling(size_t index)

Removes the nth sibling.

root
TreeItemType root()

Returns the root.

saveToStream
void saveToStream(Stream stream, string function(TreeItemType) itemToText = null)

Saves the textual representation of the tree to a Stream.

self
TreeItemType self()

Returns this when mixed in a class or &this in a struct.

siblingCount
size_t siblingCount()

Returns the count of sibling in the branch. The value returned is always greater than 0.

siblingIndex
ptrdiff_t siblingIndex()

Returns the item position in the list.

siblingIndex
void siblingIndex(size_t position)

Sets the item position in the list. The new position of the previous item is undetermined.

siblings
TreeItemSiblings!TreeItemType siblings()

Returns an input range that allows to iterate the siblings. The array syntax is also supported.

Meta