Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
The Node
struct represents one node in a [n-ary tree][glib-N-ary-Trees].
Synopsis
- newtype Node = Node (ManagedPtr Node)
- newZeroNode :: MonadIO m => m Node
- noNode :: Maybe Node
- nodeChildIndex :: (HasCallStack, MonadIO m) => Node -> Ptr () -> m Int32
- nodeChildPosition :: (HasCallStack, MonadIO m) => Node -> Node -> m Int32
- nodeDepth :: (HasCallStack, MonadIO m) => Node -> m Word32
- nodeDestroy :: (HasCallStack, MonadIO m) => Node -> m ()
- nodeIsAncestor :: (HasCallStack, MonadIO m) => Node -> Node -> m Bool
- nodeMaxHeight :: (HasCallStack, MonadIO m) => Node -> m Word32
- nodeNChildren :: (HasCallStack, MonadIO m) => Node -> m Word32
- nodeNNodes :: (HasCallStack, MonadIO m) => Node -> [TraverseFlags] -> m Word32
- nodeReverseChildren :: (HasCallStack, MonadIO m) => Node -> m ()
- nodeUnlink :: (HasCallStack, MonadIO m) => Node -> m ()
- clearNodeChildren :: MonadIO m => Node -> m ()
- getNodeChildren :: MonadIO m => Node -> m (Maybe Node)
- setNodeChildren :: MonadIO m => Node -> Ptr Node -> m ()
- clearNodeData :: MonadIO m => Node -> m ()
- getNodeData :: MonadIO m => Node -> m (Ptr ())
- setNodeData :: MonadIO m => Node -> Ptr () -> m ()
- clearNodeNext :: MonadIO m => Node -> m ()
- getNodeNext :: MonadIO m => Node -> m (Maybe Node)
- setNodeNext :: MonadIO m => Node -> Ptr Node -> m ()
- clearNodeParent :: MonadIO m => Node -> m ()
- getNodeParent :: MonadIO m => Node -> m (Maybe Node)
- setNodeParent :: MonadIO m => Node -> Ptr Node -> m ()
- clearNodePrev :: MonadIO m => Node -> m ()
- getNodePrev :: MonadIO m => Node -> m (Maybe Node)
- setNodePrev :: MonadIO m => Node -> Ptr Node -> m ()
Exported types
Memory-managed wrapper type.
Instances
WrappedPtr Node Source # | |
Defined in GI.GLib.Structs.Node wrappedPtrCalloc :: IO (Ptr Node) # wrappedPtrCopy :: Node -> IO Node # | |
tag ~ AttrSet => Constructible Node tag Source # | |
Defined in GI.GLib.Structs.Node |
Methods
childIndex
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> Ptr () |
|
-> m Int32 | Returns: the index of the child of |
Gets the position of the first child of a Node
which contains the given data.
childPosition
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> Node |
|
-> m Int32 | Returns: the position of |
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
destroy
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> m () |
Removes root
and its children from the tree, freeing any memory
allocated.
isAncestor
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> Node |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> m Word32 | Returns: the maximum height of the tree beneath |
nChildren
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> m Word32 | Returns: the number of children of |
Gets the number of children of a Node
.
nNodes
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> [TraverseFlags] |
|
-> m Word32 | Returns: the number of nodes in the tree |
Gets the number of nodes in a tree.
reverseChildren
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> m () |
Reverses the order of the children of a Node
.
(It doesn't change the order of the grandchildren.)
unlink
:: (HasCallStack, MonadIO m) | |
=> Node |
|
-> m () |
Unlinks a Node
from a tree, resulting in two separate trees.
Properties
children
points to the first child of the Node
. The other
children are accessed by using the next
pointer of each
child.
clearNodeChildren :: MonadIO m => Node -> m () Source #
Set the value of the “children
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#children
getNodeChildren :: MonadIO m => Node -> m (Maybe Node) Source #
Get the value of the “children
” field.
When overloading is enabled, this is equivalent to
get
node #children
setNodeChildren :: MonadIO m => Node -> Ptr Node -> m () Source #
Set the value of the “children
” field.
When overloading is enabled, this is equivalent to
set
node [ #children:=
value ]
data
contains the actual data of the node.
clearNodeData :: MonadIO m => Node -> m () Source #
Set the value of the “data
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#data
getNodeData :: MonadIO m => Node -> m (Ptr ()) Source #
Get the value of the “data
” field.
When overloading is enabled, this is equivalent to
get
node #data
setNodeData :: MonadIO m => Node -> Ptr () -> m () Source #
Set the value of the “data
” field.
When overloading is enabled, this is equivalent to
set
node [ #data:=
value ]
next
points to the node's next sibling (a sibling is another
Node
with the same parent).
clearNodeNext :: MonadIO m => Node -> m () Source #
Set the value of the “next
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#next
getNodeNext :: MonadIO m => Node -> m (Maybe Node) Source #
Get the value of the “next
” field.
When overloading is enabled, this is equivalent to
get
node #next
setNodeNext :: MonadIO m => Node -> Ptr Node -> m () Source #
Set the value of the “next
” field.
When overloading is enabled, this is equivalent to
set
node [ #next:=
value ]
parent
clearNodeParent :: MonadIO m => Node -> m () Source #
Set the value of the “parent
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#parent
getNodeParent :: MonadIO m => Node -> m (Maybe Node) Source #
Get the value of the “parent
” field.
When overloading is enabled, this is equivalent to
get
node #parent
setNodeParent :: MonadIO m => Node -> Ptr Node -> m () Source #
Set the value of the “parent
” field.
When overloading is enabled, this is equivalent to
set
node [ #parent:=
value ]
prev
points to the node's previous sibling.
clearNodePrev :: MonadIO m => Node -> m () Source #
Set the value of the “prev
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#prev
getNodePrev :: MonadIO m => Node -> m (Maybe Node) Source #
Get the value of the “prev
” field.
When overloading is enabled, this is equivalent to
get
node #prev
setNodePrev :: MonadIO m => Node -> Ptr Node -> m () Source #
Set the value of the “prev
” field.
When overloading is enabled, this is equivalent to
set
node [ #prev:=
value ]