Node

class Node(pointer: <Error class: unknown class><<Error class: unknown class>>) : Record

The #GNode struct represents one node in a glib-N-ary-Trees.

Skipped during bindings generation

  • parameter data: gpointer

  • parameter allocator: Allocator

  • field data: gpointer

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion : RecordCompanion<Node, <Error class: unknown class>>

Properties

Link copied to clipboard

points to the first child of the #GNode. The other children are accessed by using the @next pointer of each child.

Link copied to clipboard
val glibNodePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val next: Node?

points to the node's next sibling (a sibling is another #GNode with the same parent).

Link copied to clipboard
val parent: Node?

points to the parent of the #GNode, or is null if the #GNode is the root of the tree.

Link copied to clipboard
val prev: Node?

points to the node's previous sibling.

Functions

Link copied to clipboard
fun childPosition(child: Node): Int

Gets the position of a #GNode with respect to its siblings.

Link copied to clipboard

Calls a function for each of the children of a #GNode. Note that it doesn't descend beneath the child nodes. @func must not do anything that would modify the structure of the tree.

Link copied to clipboard
fun depth(): <Error class: unknown class>

Gets the depth of a #GNode.

Link copied to clipboard
fun destroy()

Removes @root and its children from the tree, freeing any memory allocated.

Link copied to clipboard
fun isAncestor(descendant: Node): Boolean

Returns true if @node is an ancestor of @descendant. This is true if node is the parent of @descendant, or if node is the grandparent of @descendant etc.

Link copied to clipboard
fun maxHeight(): <Error class: unknown class>

Gets the maximum height of all branches beneath a #GNode. This is the maximum distance from the #GNode to all leaf nodes.

Link copied to clipboard
fun nChildren(): <Error class: unknown class>

Gets the number of children of a #GNode.

Link copied to clipboard
fun nNodes(flags: TraverseFlags): <Error class: unknown class>

Gets the number of nodes in a tree.

Link copied to clipboard

Reverses the order of the children of a #GNode. (It doesn't change the order of the grandchildren.)

Link copied to clipboard
fun traverse(order: TraverseType, flags: TraverseFlags, maxDepth: Int, func: NodeTraverseFunc)

Traverses a tree starting at the given root #GNode. It calls the given function for each node visited. The traversal can be halted at any point by returning true from @func.

Link copied to clipboard
fun unlink()

Unlinks a #GNode from a tree, resulting in two separate trees.