gi-glib-2.0.11: GLib bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.Node

Contents

Description

The Node struct represents one node in a [n-ary tree][glib-N-ary-Trees].

Synopsis

Exported types

newtype Node Source #

Constructors

Node (ManagedPtr Node) 

Instances

WrappedPtr Node Source # 
(~) AttrOpTag tag AttrSet => Constructible Node tag Source # 

Methods

new :: MonadIO m => (ManagedPtr Node -> Node) -> [AttrOp Node tag] -> m Node #

((~) * info (ResolveNodeMethod t Node), MethodInfo * info Node p) => IsLabel t (Node -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Node -> p #

((~) * info (ResolveNodeMethod t Node), MethodInfo * info Node p) => IsLabelProxy t (Node -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Node -> p #

HasAttributeList * Node Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * NodeUnlinkMethodInfo Node signature Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * NodeReverseChildrenMethodInfo Node signature Source # 
((~) * signature ([TraverseFlags] -> m Word32), MonadIO m) => MethodInfo * NodeNNodesMethodInfo Node signature Source # 
((~) * signature (m Word32), MonadIO m) => MethodInfo * NodeNChildrenMethodInfo Node signature Source # 
((~) * signature (m Word32), MonadIO m) => MethodInfo * NodeMaxHeightMethodInfo Node signature Source # 
((~) * signature (Node -> m Bool), MonadIO m) => MethodInfo * NodeIsAncestorMethodInfo Node signature Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * NodeDestroyMethodInfo Node signature Source # 
((~) * signature (m Word32), MonadIO m) => MethodInfo * NodeDepthMethodInfo Node signature Source # 
((~) * signature (Node -> m Int32), MonadIO m) => MethodInfo * NodeChildPositionMethodInfo Node signature Source # 
((~) * signature (Ptr () -> m Int32), MonadIO m) => MethodInfo * NodeChildIndexMethodInfo Node signature Source # 
type AttributeList Node Source # 

newZeroNode :: MonadIO m => m Node Source #

Construct a Node struct initialized to zero.

Methods

childIndex

data NodeChildIndexMethodInfo Source #

Instances

((~) * signature (Ptr () -> m Int32), MonadIO m) => MethodInfo * NodeChildIndexMethodInfo Node signature Source # 

nodeChildIndex Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node

-> Ptr ()

data: the data to find

-> m Int32

Returns: the index of the child of node which contains data, or -1 if the data is not found

Gets the position of the first child of a Node which contains the given data.

childPosition

nodeChildPosition Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node

-> Node

child: a child of node

-> m Int32

Returns: the position of child with respect to its siblings

Gets the position of a Node with respect to its siblings. child must be a child of node. The first child is numbered 0, the second 1, and so on.

depth

data NodeDepthMethodInfo Source #

Instances

((~) * signature (m Word32), MonadIO m) => MethodInfo * NodeDepthMethodInfo Node signature Source # 

nodeDepth Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node

-> m Word32

Returns: the depth of the Node

Gets the depth of a Node.

If node is Nothing the depth is 0. The root node has a depth of 1. For the children of the root node the depth is 2. And so on.

destroy

data NodeDestroyMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * NodeDestroyMethodInfo Node signature Source # 

nodeDestroy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

root: the root of the tree/subtree to destroy

-> m () 

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

isAncestor

nodeIsAncestor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node

-> Node

descendant: a Node

-> m Bool

Returns: True if node is an ancestor of descendant

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.

maxHeight

nodeMaxHeight Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

root: a Node

-> m Word32

Returns: the maximum height of the tree beneath root

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

If root is Nothing, 0 is returned. If root has no children, 1 is returned. If root has children, 2 is returned. And so on.

nChildren

nodeNChildren Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node

-> m Word32

Returns: the number of children of node

Gets the number of children of a Node.

nNodes

data NodeNNodesMethodInfo Source #

Instances

((~) * signature ([TraverseFlags] -> m Word32), MonadIO m) => MethodInfo * NodeNNodesMethodInfo Node signature Source # 

nodeNNodes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

root: a Node

-> [TraverseFlags]

flags: which types of children are to be counted, one of TraverseFlagsAll, TraverseFlagsLeaves and TraverseFlagsNonLeaves

-> m Word32

Returns: the number of nodes in the tree

Gets the number of nodes in a tree.

reverseChildren

nodeReverseChildren Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: a Node.

-> m () 

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

unlink

data NodeUnlinkMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * NodeUnlinkMethodInfo Node signature Source # 

nodeUnlink Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Node

node: the Node to unlink, which becomes the root of a new tree

-> m () 

Unlinks a Node from a tree, resulting in two separate trees.

Properties

children

data

getNodeData :: MonadIO m => Node -> m (Ptr ()) Source #

setNodeData :: MonadIO m => Node -> Ptr () -> m () Source #

next

setNodeNext :: MonadIO m => Node -> Ptr Node -> m () Source #

parent

prev

setNodePrev :: MonadIO m => Node -> Ptr Node -> m () Source #