gi-glib
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.Tree

Description

The GTree struct is an opaque data structure representing a balanced binary tree. It should be accessed only by using the following functions.

Synopsis

Exported types

newtype Tree Source #

Memory-managed wrapper type.

Constructors

Tree (ManagedPtr Tree) 

Instances

Instances details
Eq Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

(==) :: Tree -> Tree -> Bool #

(/=) :: Tree -> Tree -> Bool #

GBoxed Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

ManagedPtrNewtype Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

TypedObject Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

glibType :: IO GType #

HasParentTypes Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

HasAttributeList Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

(signature ~ m (), MonadIO m) => OverloadedMethod TreeDestroyMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (TraverseFunc -> m ()), MonadIO m) => OverloadedMethod TreeForeachMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (TraverseNodeFunc -> m ()), MonadIO m) => OverloadedMethod TreeForeachNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m Int32, MonadIO m) => OverloadedMethod TreeHeightMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m) => OverloadedMethod TreeInsertMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeInsertNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m (Bool, Ptr (), Ptr ())), MonadIO m) => OverloadedMethod TreeLookupExtendedMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m (Ptr ())), MonadIO m) => OverloadedMethod TreeLookupMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeLookupNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeLowerBoundMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m Int32, MonadIO m) => OverloadedMethod TreeNnodesMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m (Maybe TreeNode), MonadIO m) => OverloadedMethod TreeNodeFirstMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m (Maybe TreeNode), MonadIO m) => OverloadedMethod TreeNodeLastMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m Tree, MonadIO m) => OverloadedMethod TreeRefMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m (), MonadIO m) => OverloadedMethod TreeRemoveAllMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m Bool), MonadIO m) => OverloadedMethod TreeRemoveMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m) => OverloadedMethod TreeReplaceMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeReplaceNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (CompareFunc -> m (Ptr ())), MonadIO m) => OverloadedMethod TreeSearchMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (CompareFunc -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeSearchNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m Bool), MonadIO m) => OverloadedMethod TreeStealMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (TraverseFunc -> TraverseType -> m ()), MonadIO m) => OverloadedMethod TreeTraverseMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ m (), MonadIO m) => OverloadedMethod TreeUnrefMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeUpperBoundMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeDestroyMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeForeachMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeForeachNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeHeightMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeInsertMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeInsertNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeLookupExtendedMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeLookupMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeLookupNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeLowerBoundMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeNnodesMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeNodeFirstMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeNodeLastMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeRefMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeRemoveAllMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeRemoveMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeReplaceMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeReplaceNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeSearchMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeSearchNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeStealMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeTraverseMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeUnrefMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

OverloadedMethodInfo TreeUpperBoundMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

(info ~ ResolveTreeMethod t Tree, OverloadedMethod info Tree p, HasField t Tree p) => HasField (t :: Symbol) Tree (p :: Type) Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

getField :: Tree -> p #

(info ~ ResolveTreeMethod t Tree, OverloadedMethodInfo info Tree) => IsLabel t (MethodProxy info Tree) Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

fromLabel :: MethodProxy info Tree #

(info ~ ResolveTreeMethod t Tree, OverloadedMethod info Tree p) => IsLabel t (Tree -> p) Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

fromLabel :: Tree -> p #

IsGValue (Maybe Tree) Source #

Convert Tree to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GLib.Structs.Tree

type AttributeList Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

type ParentTypes Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

type ParentTypes Tree = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

destroy, foreach, foreachNode, height, insert, insertNode, lookup, lookupExtended, lookupNode, lowerBound, nnodes, nodeFirst, nodeLast, ref, remove, removeAll, replace, replaceNode, search, searchNode, steal, traverse, unref, upperBound.

Getters

None.

Setters

None.

destroy

data TreeDestroyMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m) => OverloadedMethod TreeDestroyMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeDestroyMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeDestroy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m () 

Removes all keys and values from the Tree and decreases its reference count by one. If keys and/or values are dynamically allocated, you should either free them first or create the Tree using treeNewFull. In the latter case the destroy functions you supplied will be called on all keys and values before destroying the Tree.

foreach

data TreeForeachMethodInfo Source #

Instances

Instances details
(signature ~ (TraverseFunc -> m ()), MonadIO m) => OverloadedMethod TreeForeachMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeForeachMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeForeach Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> TraverseFunc

func: the function to call for each node visited. If this function returns True, the traversal is stopped.

-> m () 

Calls the given function for each of the key/value pairs in the Tree. The function is passed the key and value of each pair, and the given data parameter. The tree is traversed in sorted order.

The tree may not be modified while iterating over it (you can't add/remove items). To remove all items matching a predicate, you need to add each item to a list in your TraverseFunc as you walk over the tree, then walk the list and remove each item.

foreachNode

data TreeForeachNodeMethodInfo Source #

Instances

Instances details
(signature ~ (TraverseNodeFunc -> m ()), MonadIO m) => OverloadedMethod TreeForeachNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeForeachNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeForeachNode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> TraverseNodeFunc

func: the function to call for each node visited. If this function returns True, the traversal is stopped.

-> m () 

Calls the given function for each of the nodes in the Tree. The function is passed the pointer to the particular node, and the given data parameter. The tree traversal happens in-order.

The tree may not be modified while iterating over it (you can't add/remove items). To remove all items matching a predicate, you need to add each item to a list in your TraverseFunc as you walk over the tree, then walk the list and remove each item.

Since: 2.68

height

data TreeHeightMethodInfo Source #

Instances

Instances details
(signature ~ m Int32, MonadIO m) => OverloadedMethod TreeHeightMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeHeightMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeHeight Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m Int32

Returns: the height of tree

Gets the height of a Tree.

If the Tree contains no nodes, the height is 0. If the Tree contains only one root node the height is 1. If the root node has children the height is 2, etc.

insert

data TreeInsertMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m) => OverloadedMethod TreeInsertMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeInsertMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeInsert Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to insert

-> Ptr ()

value: the value corresponding to the key

-> m () 

Inserts a key/value pair into a Tree.

Inserts a new key and value into a Tree as treeInsertNode does, only this function does not return the inserted or set node.

insertNode

data TreeInsertNodeMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeInsertNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeInsertNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeInsertNode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to insert

-> Ptr ()

value: the value corresponding to the key

-> m (Maybe TreeNode)

Returns: the inserted (or set) node or Nothing if insertion would overflow the tree node counter.

Inserts a key/value pair into a Tree.

If the given key already exists in the Tree its corresponding value is set to the new value. If you supplied a valueDestroyFunc when creating the Tree, the old value is freed using that function. If you supplied a keyDestroyFunc when creating the Tree, the passed key is freed using that function.

The tree is automatically 'balanced' as new key/value pairs are added, so that the distance from the root to every leaf is as small as possible. The cost of maintaining a balanced tree while inserting new key/value result in a O(n log(n)) operation where most of the other operations are O(log(n)).

Since: 2.68

lookup

data TreeLookupMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m (Ptr ())), MonadIO m) => OverloadedMethod TreeLookupMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeLookupMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeLookup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to look up

-> m (Ptr ())

Returns: the value corresponding to the key, or Nothing if the key was not found

Gets the value corresponding to the given key. Since a Tree is automatically balanced as key/value pairs are added, key lookup is O(log n) (where n is the number of key/value pairs in the tree).

lookupExtended

data TreeLookupExtendedMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m (Bool, Ptr (), Ptr ())), MonadIO m) => OverloadedMethod TreeLookupExtendedMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeLookupExtendedMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeLookupExtended Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

lookupKey: the key to look up

-> m (Bool, Ptr (), Ptr ())

Returns: True if the key was found in the Tree

Looks up a key in the Tree, returning the original key and the associated value. This is useful if you need to free the memory allocated for the original key, for example before calling treeRemove.

lookupNode

data TreeLookupNodeMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeLookupNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeLookupNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeLookupNode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to look up

-> m (Maybe TreeNode)

Returns: the tree node corresponding to the key, or Nothing if the key was not found

Gets the tree node corresponding to the given key. Since a Tree is automatically balanced as key/value pairs are added, key lookup is O(log n) (where n is the number of key/value pairs in the tree).

Since: 2.68

lowerBound

data TreeLowerBoundMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeLowerBoundMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeLowerBoundMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeLowerBound Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to calculate the lower bound for

-> m (Maybe TreeNode)

Returns: the tree node corresponding to the lower bound, or Nothing if the tree is empty or has only keys strictly lower than the searched key.

Gets the lower bound node corresponding to the given key, or Nothing if the tree is empty or all the nodes in the tree have keys that are strictly lower than the searched key.

The lower bound is the first node that has its key greater than or equal to the searched key.

Since: 2.68

newFull

treeNewFull Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> CompareDataFunc

keyCompareFunc: qsort()-style comparison function

-> DestroyNotify

keyDestroyFunc: a function to free the memory allocated for the key used when removing the entry from the Tree or Nothing if you don't want to supply such a function

-> m Tree

Returns: a newly allocated Tree

Creates a new Tree like g_tree_new() and allows to specify functions to free the memory allocated for the key and value that get called when removing the entry from the Tree.

nnodes

data TreeNnodesMethodInfo Source #

Instances

Instances details
(signature ~ m Int32, MonadIO m) => OverloadedMethod TreeNnodesMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeNnodesMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeNnodes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m Int32

Returns: the number of nodes in tree

The node counter value type is really a guint, but it is returned as a gint due to backward compatibility issues (can be cast back to guint to support its full range of values).

Gets the number of nodes in a Tree.

nodeFirst

data TreeNodeFirstMethodInfo Source #

Instances

Instances details
(signature ~ m (Maybe TreeNode), MonadIO m) => OverloadedMethod TreeNodeFirstMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeNodeFirstMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeNodeFirst Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m (Maybe TreeNode)

Returns: the first node in the tree

Returns the first in-order node of the tree, or Nothing for an empty tree.

Since: 2.68

nodeLast

data TreeNodeLastMethodInfo Source #

Instances

Instances details
(signature ~ m (Maybe TreeNode), MonadIO m) => OverloadedMethod TreeNodeLastMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeNodeLastMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeNodeLast Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m (Maybe TreeNode)

Returns: the last node in the tree

Returns the last in-order node of the tree, or Nothing for an empty tree.

Since: 2.68

ref

data TreeRefMethodInfo Source #

Instances

Instances details
(signature ~ m Tree, MonadIO m) => OverloadedMethod TreeRefMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeRefMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m Tree

Returns: the passed in Tree

Increments the reference count of tree by one.

It is safe to call this function from any thread.

Since: 2.22

remove

data TreeRemoveMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m Bool), MonadIO m) => OverloadedMethod TreeRemoveMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeRemoveMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeRemove Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to remove

-> m Bool

Returns: True if the key was found (prior to 2.8, this function returned nothing)

Removes a key/value pair from a Tree.

If the Tree was created using treeNewFull, the key and value are freed using the supplied destroy functions, otherwise you have to make sure that any dynamically allocated values are freed yourself. If the key does not exist in the Tree, the function does nothing.

The cost of maintaining a balanced tree while removing a key/value result in a O(n log(n)) operation where most of the other operations are O(log(n)).

removeAll

data TreeRemoveAllMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m) => OverloadedMethod TreeRemoveAllMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeRemoveAllMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeRemoveAll Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m () 

Removes all nodes from a Tree and destroys their keys and values, then resets the Tree’s root to Nothing.

Since: 2.70

replace

data TreeReplaceMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m) => OverloadedMethod TreeReplaceMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeReplaceMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeReplace Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to insert

-> Ptr ()

value: the value corresponding to the key

-> m () 

Inserts a new key and value into a Tree as treeReplaceNode does, only this function does not return the inserted or set node.

replaceNode

data TreeReplaceNodeMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeReplaceNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeReplaceNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeReplaceNode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to insert

-> Ptr ()

value: the value corresponding to the key

-> m (Maybe TreeNode)

Returns: the inserted (or set) node or Nothing if insertion would overflow the tree node counter.

Inserts a new key and value into a Tree similar to treeInsertNode. The difference is that if the key already exists in the Tree, it gets replaced by the new key. If you supplied a valueDestroyFunc when creating the Tree, the old value is freed using that function. If you supplied a keyDestroyFunc when creating the Tree, the old key is freed using that function.

The tree is automatically 'balanced' as new key/value pairs are added, so that the distance from the root to every leaf is as small as possible.

Since: 2.68

search

data TreeSearchMethodInfo Source #

Instances

Instances details
(signature ~ (CompareFunc -> m (Ptr ())), MonadIO m) => OverloadedMethod TreeSearchMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeSearchMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeSearch Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> CompareFunc

searchFunc: a function used to search the Tree

-> m (Ptr ())

Returns: the value corresponding to the found key, or Nothing if the key was not found

Searches a Tree using searchFunc.

The searchFunc is called with a pointer to the key of a key/value pair in the tree, and the passed in userData. If searchFunc returns 0 for a key/value pair, then the corresponding value is returned as the result of treeSearch. If searchFunc returns -1, searching will proceed among the key/value pairs that have a smaller key; if searchFunc returns 1, searching will proceed among the key/value pairs that have a larger key.

searchNode

data TreeSearchNodeMethodInfo Source #

Instances

Instances details
(signature ~ (CompareFunc -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeSearchNodeMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeSearchNodeMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeSearchNode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> CompareFunc

searchFunc: a function used to search the Tree

-> m (Maybe TreeNode)

Returns: the node corresponding to the found key, or Nothing if the key was not found

Searches a Tree using searchFunc.

The searchFunc is called with a pointer to the key of a key/value pair in the tree, and the passed in userData. If searchFunc returns 0 for a key/value pair, then the corresponding node is returned as the result of treeSearch. If searchFunc returns -1, searching will proceed among the key/value pairs that have a smaller key; if searchFunc returns 1, searching will proceed among the key/value pairs that have a larger key.

Since: 2.68

steal

data TreeStealMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m Bool), MonadIO m) => OverloadedMethod TreeStealMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeStealMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeSteal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to remove

-> m Bool

Returns: True if the key was found (prior to 2.8, this function returned nothing)

Removes a key and its associated value from a Tree without calling the key and value destroy functions.

If the key does not exist in the Tree, the function does nothing.

traverse

data TreeTraverseMethodInfo Source #

Instances

Instances details
(signature ~ (TraverseFunc -> TraverseType -> m ()), MonadIO m) => OverloadedMethod TreeTraverseMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeTraverseMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeTraverse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> TraverseFunc

traverseFunc: the function to call for each node visited. If this function returns True, the traversal is stopped.

-> TraverseType

traverseType: the order in which nodes are visited, one of TraverseTypeInOrder, TraverseTypePreOrder and TraverseTypePostOrder

-> m () 

Deprecated: (Since version 2.2)The order of a balanced tree is somewhat arbitrary.If you just want to visit all nodes in sorted order, usetreeForeach instead. If you really need to visit nodes ina different order, consider using an n-ary tree.

Calls the given function for each node in the Tree.

unref

data TreeUnrefMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m) => OverloadedMethod TreeUnrefMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeUnrefMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> m () 

Decrements the reference count of tree by one. If the reference count drops to 0, all keys and values will be destroyed (if destroy functions were specified) and all memory allocated by tree will be released.

It is safe to call this function from any thread.

Since: 2.22

upperBound

data TreeUpperBoundMethodInfo Source #

Instances

Instances details
(signature ~ (Ptr () -> m (Maybe TreeNode)), MonadIO m) => OverloadedMethod TreeUpperBoundMethodInfo Tree signature Source # 
Instance details

Defined in GI.GLib.Structs.Tree

Methods

overloadedMethod :: Tree -> signature #

OverloadedMethodInfo TreeUpperBoundMethodInfo Tree Source # 
Instance details

Defined in GI.GLib.Structs.Tree

treeUpperBound Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Tree

tree: a Tree

-> Ptr ()

key: the key to calculate the upper bound for

-> m (Maybe TreeNode)

Returns: the tree node corresponding to the upper bound, or Nothing if the tree is empty or has only keys lower than or equal to the searched key.

Gets the upper bound node corresponding to the given key, or Nothing if the tree is empty or all the nodes in the tree have keys that are lower than or equal to the searched key.

The upper bound is the first node that has its key strictly greater than the searched key.

Since: 2.68