Public Member Functions |
| | NodeTree () |
| | NodeTree (const T& the_data) |
| | NodeTree (const NodeTree< T >& node) |
| | ~NodeTree () |
| | Removes the instance and its children from the tree, freeing any memory allocated.
|
| NodeTree< T >& | operator= (const NodeTree< T >& node) |
| GNode* | gobj () |
| | Provides access to the underlying C GObject.
|
| const GNode* | gobj () const |
| | Provides access to the underlying C GObject.
|
| NodeTree< T >& | insert (int position, NodeTree< T >& node) |
| | Inserts a NodeTree beneath the parent at the given position.
|
| NodeTree< T >& | insert_before (NodeTree< T >& sibling, NodeTree< T >& node) |
| | Inserts a NodeTree beneath the parent before the given sibling.
|
| NodeTree< T >& | insert_after (NodeTree< T >& sibling, NodeTree< T >& node) |
| | Inserts a NodeTree beneath the parent after the given sibling.
|
| NodeTree< T >& | append (NodeTree< T >& node) |
| | Inserts a NodeTree as the last child.
|
| NodeTree< T >& | prepend (NodeTree< T >& node) |
| | Inserts a NodeTree as the first child.
|
| NodeTree< T >* | insert_data (int position, const T& the_data) |
| | Inserts a new NodeTree at the given position.
|
| NodeTree< T >* | insert_data_before (NodeTree< T >& sibling, const T& the_data) |
| | Inserts a new NodeTree before the given sibling.
|
| NodeTree< T >* | append_data (const T& the_data) |
| | Inserts a new NodeTree as the last child.
|
| NodeTree< T >* | prepend_data (const T& the_data) |
| | Inserts a new NodeTree as the first child.
|
| void | reverse_children () |
| | Reverses the order of the children.
|
| NodeTree< T >* | get_root () |
| | Returns a pointer to the root of the tree.
|
| const NodeTree< T >* | get_root () const |
| void | traverse (const TraverseFunc& func, TraverseType order=TRAVERSE_IN_ORDER, TraverseFlags flags=TRAVERSE_ALL, int max_depth=-1) |
| | Traverses a tree starting at the current node.
|
| void | foreach (const ForeachFunc& func, TraverseFlags flags=TRAVERSE_ALL) |
| | Calls a function for each of the children of a NodeTree.
|
| NodeTree< T >* | find_child (const T& the_data, TraverseFlags flags=TRAVERSE_ALL) |
| | Finds the first child of a NodeTree with the given data.
|
| const NodeTree< T >* | find_child (const T& the_data, TraverseFlags flags=TRAVERSE_ALL) const |
| | Finds the first child of a NodeTree with the given data.
|
| NodeTree< T >* | find (const T& the_data, TraverseType order=TRAVERSE_IN_ORDER, TraverseFlags flags=TRAVERSE_ALL) |
| | Finds a node in a tree.
|
| const NodeTree< T >* | find (const T& the_data, TraverseType order=TRAVERSE_IN_ORDER, TraverseFlags flags=TRAVERSE_ALL) const |
| | Finds a node in a tree.
|
| int | child_index (const T& the_data) const |
| | Gets the position of the first child which contains the given data.
|
| int | child_position (const NodeTree< T >& child) const |
| | Gets the position with respect to its siblings.
|
| NodeTree< T >* | first_child () |
| | Gets the first child.
|
| const NodeTree< T >* | first_child () const |
| | Gets the first child.
|
| NodeTree< T >* | last_child () |
| | Gets the last child.
|
| const NodeTree< T >* | last_child () const |
| | Gets the last child.
|
| NodeTree< T >* | nth_child (int n) |
| | Gets the nth child.
|
| const NodeTree< T >* | nth_child (int n) const |
| | Gets the nth child.
|
| NodeTree< T >* | first_sibling () |
| | Gets the first sibling.
|
| const NodeTree< T >* | first_sibling () const |
| | Gets the first sibling.
|
| NodeTree< T >* | prev_sibling () |
| | Gets the previous sibling.
|
| const NodeTree< T >* | prev_sibling () const |
| | Gets the previous sibling.
|
| NodeTree< T >* | next_sibling () |
| | Gets the next sibling.
|
| const NodeTree< T >* | next_sibling () const |
| | Gets the next sibling.
|
| NodeTree< T >* | last_sibling () |
| | Gets the last sibling.
|
| const NodeTree< T >* | last_sibling () const |
| | Gets the last sibling.
|
| bool | is_leaf () const |
| | Returns true if this is a leaf node.
|
| bool | is_root () const |
| | Returns true if this is the root node.
|
| guint | depth () const |
| | Gets the depth of this node.
|
| guint | node_count (TraverseFlags flags=TRAVERSE_ALL) const |
| | Gets the number of nodes in a tree.
|
| guint | child_count () const |
| | Gets the number children.
|
| bool | is_ancestor (const NodeTree< T >& descendant) const |
| | Returns true if this is an ancestor of descendant.
|
| guint | get_max_height () const |
| | Gets the maximum height of all branches beneath this node.
|
| void | unlink () |
| | Unlinks a node from a tree, resulting in two separate trees.
|
| T& | data () |
| | Accessor for this node's data.
|
| const T& | data () const |
| | Accessor for this node's data.
|
| const NodeTree< T >* | parent () const |
| | Accessor for this node's parent.
|
template<typename T>
class Glib::NodeTree< T >
N-ary Trees - trees of data with any number of branches The NodeTree class and its associated functions provide an N-ary tree data structure, in which nodes in the tree can contain arbitrary data.
To insert a node into a tree use insert(), insert_before(), append() or prepend().
To create a new node and insert it into a tree use insert_data(), insert_data_before(), append_data() and prepend_data().
To reverse the children of a node use reverse_children().
To find a node use root(), find(), find_child(), index_of(), child_index(), first_child(), last_child(), nth_child(), first_sibling(), prev_sibling(), next_sibling() or last_sibling().
To get information about a node or tree use is_leaf(), is_root(), depth(), node_count(), child_count(), is_ancestor() or max_height().
To traverse a tree, calling a function for each node visited in the traversal, use traverse() or foreach().
To remove a node or subtree from a tree use unlink().
- Since glibmm 2.18: