gi-glib-0.2.44.12: GI/GLib/Structs/Node.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
The #GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees].
-}
module GI.GLib.Structs.Node
(
-- * Exported types
Node(..) ,
noNode ,
-- * Methods
-- ** nodeChildIndex
nodeChildIndex ,
-- ** nodeChildPosition
nodeChildPosition ,
-- ** nodeDepth
nodeDepth ,
-- ** nodeDestroy
nodeDestroy ,
-- ** nodeIsAncestor
nodeIsAncestor ,
-- ** nodeMaxHeight
nodeMaxHeight ,
-- ** nodeNChildren
nodeNChildren ,
-- ** nodeNNodes
nodeNNodes ,
-- ** nodeReverseChildren
nodeReverseChildren ,
-- ** nodeUnlink
nodeUnlink ,
-- * Properties
-- ** Children
nodeReadChildren ,
-- ** Data
nodeReadData ,
-- ** Next
nodeReadNext ,
-- ** Parent
nodeReadParent ,
-- ** Prev
nodeReadPrev ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.GLib.Types
import GI.GLib.Callbacks
newtype Node = Node (ForeignPtr Node)
noNode :: Maybe Node
noNode = Nothing
nodeReadData :: Node -> IO (Ptr ())
nodeReadData s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr ())
return val
nodeReadNext :: Node -> IO Node
nodeReadNext s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr Node)
val' <- (newPtr 40 Node) val
return val'
nodeReadPrev :: Node -> IO Node
nodeReadPrev s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr Node)
val' <- (newPtr 40 Node) val
return val'
nodeReadParent :: Node -> IO Node
nodeReadParent s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (Ptr Node)
val' <- (newPtr 40 Node) val
return val'
nodeReadChildren :: Node -> IO Node
nodeReadChildren s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO (Ptr Node)
val' <- (newPtr 40 Node) val
return val'
-- method Node::child_index
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_child_index" g_node_child_index ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
Ptr () -> -- data : TBasicType TVoid
IO Int32
nodeChildIndex ::
(MonadIO m) =>
Node -> -- _obj
Ptr () -> -- data
m Int32
nodeChildIndex _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_node_child_index _obj' data_
touchManagedPtr _obj
return result
-- method Node::child_position
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_child_position" g_node_child_position ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
Ptr Node -> -- child : TInterface "GLib" "Node"
IO Int32
nodeChildPosition ::
(MonadIO m) =>
Node -> -- _obj
Node -> -- child
m Int32
nodeChildPosition _obj child = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let child' = unsafeManagedPtrGetPtr child
result <- g_node_child_position _obj' child'
touchManagedPtr _obj
touchManagedPtr child
return result
-- method Node::depth
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_depth" g_node_depth ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO Word32
nodeDepth ::
(MonadIO m) =>
Node -> -- _obj
m Word32
nodeDepth _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_node_depth _obj'
touchManagedPtr _obj
return result
-- method Node::destroy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_node_destroy" g_node_destroy ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO ()
nodeDestroy ::
(MonadIO m) =>
Node -> -- _obj
m ()
nodeDestroy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_node_destroy _obj'
touchManagedPtr _obj
return ()
-- method Node::is_ancestor
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "descendant", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "descendant", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_node_is_ancestor" g_node_is_ancestor ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
Ptr Node -> -- descendant : TInterface "GLib" "Node"
IO CInt
nodeIsAncestor ::
(MonadIO m) =>
Node -> -- _obj
Node -> -- descendant
m Bool
nodeIsAncestor _obj descendant = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let descendant' = unsafeManagedPtrGetPtr descendant
result <- g_node_is_ancestor _obj' descendant'
let result' = (/= 0) result
touchManagedPtr _obj
touchManagedPtr descendant
return result'
-- method Node::max_height
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_max_height" g_node_max_height ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO Word32
nodeMaxHeight ::
(MonadIO m) =>
Node -> -- _obj
m Word32
nodeMaxHeight _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_node_max_height _obj'
touchManagedPtr _obj
return result
-- method Node::n_children
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_n_children" g_node_n_children ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO Word32
nodeNChildren ::
(MonadIO m) =>
Node -> -- _obj
m Word32
nodeNChildren _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_node_n_children _obj'
touchManagedPtr _obj
return result
-- method Node::n_nodes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GLib" "TraverseFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GLib" "TraverseFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_node_n_nodes" g_node_n_nodes ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
CUInt -> -- flags : TInterface "GLib" "TraverseFlags"
IO Word32
nodeNNodes ::
(MonadIO m) =>
Node -> -- _obj
[TraverseFlags] -> -- flags
m Word32
nodeNNodes _obj flags = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let flags' = gflagsToWord flags
result <- g_node_n_nodes _obj' flags'
touchManagedPtr _obj
return result
-- method Node::reverse_children
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_node_reverse_children" g_node_reverse_children ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO ()
nodeReverseChildren ::
(MonadIO m) =>
Node -> -- _obj
m ()
nodeReverseChildren _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_node_reverse_children _obj'
touchManagedPtr _obj
return ()
-- method Node::unlink
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Node", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_node_unlink" g_node_unlink ::
Ptr Node -> -- _obj : TInterface "GLib" "Node"
IO ()
nodeUnlink ::
(MonadIO m) =>
Node -> -- _obj
m ()
nodeUnlink _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_node_unlink _obj'
touchManagedPtr _obj
return ()