gi-gio-0.2.46.13: GI/Gio/Structs/DBusNodeInfo.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)
Information about nodes in a remote object hierarchy.
-}
module GI.Gio.Structs.DBusNodeInfo
(
-- * Exported types
DBusNodeInfo(..) ,
newZeroDBusNodeInfo ,
noDBusNodeInfo ,
-- * Methods
-- ** dBusNodeInfoGenerateXml
DBusNodeInfoGenerateXmlMethodInfo ,
dBusNodeInfoGenerateXml ,
-- ** dBusNodeInfoLookupInterface
DBusNodeInfoLookupInterfaceMethodInfo ,
dBusNodeInfoLookupInterface ,
-- ** dBusNodeInfoNewForXml
dBusNodeInfoNewForXml ,
-- ** dBusNodeInfoRef
DBusNodeInfoRefMethodInfo ,
dBusNodeInfoRef ,
-- ** dBusNodeInfoUnref
DBusNodeInfoUnrefMethodInfo ,
dBusNodeInfoUnref ,
-- * Properties
-- ** Annotations
dBusNodeInfoReadAnnotations ,
-- ** Interfaces
dBusNodeInfoReadInterfaces ,
-- ** Nodes
dBusNodeInfoReadNodes ,
-- ** Path
dBusNodeInfoReadPath ,
-- ** RefCount
dBusNodeInfoReadRefCount ,
) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GLib as GLib
newtype DBusNodeInfo = DBusNodeInfo (ForeignPtr DBusNodeInfo)
foreign import ccall "g_dbus_node_info_get_type" c_g_dbus_node_info_get_type ::
IO GType
instance BoxedObject DBusNodeInfo where
boxedType _ = c_g_dbus_node_info_get_type
-- | Construct a `DBusNodeInfo` struct initialized to zero.
newZeroDBusNodeInfo :: MonadIO m => m DBusNodeInfo
newZeroDBusNodeInfo = liftIO $ callocBoxedBytes 40 >>= wrapBoxed DBusNodeInfo
noDBusNodeInfo :: Maybe DBusNodeInfo
noDBusNodeInfo = Nothing
dBusNodeInfoReadRefCount :: DBusNodeInfo -> IO Int32
dBusNodeInfoReadRefCount s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Int32
return val
dBusNodeInfoReadPath :: DBusNodeInfo -> IO T.Text
dBusNodeInfoReadPath s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
dBusNodeInfoReadInterfaces :: DBusNodeInfo -> IO [DBusInterfaceInfo]
dBusNodeInfoReadInterfaces s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr (Ptr DBusInterfaceInfo))
val' <- unpackZeroTerminatedPtrArray val
val'' <- mapM (newBoxed DBusInterfaceInfo) val'
return val''
dBusNodeInfoReadNodes :: DBusNodeInfo -> IO [DBusNodeInfo]
dBusNodeInfoReadNodes s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (Ptr (Ptr DBusNodeInfo))
val' <- unpackZeroTerminatedPtrArray val
val'' <- mapM (newBoxed DBusNodeInfo) val'
return val''
dBusNodeInfoReadAnnotations :: DBusNodeInfo -> IO [DBusAnnotationInfo]
dBusNodeInfoReadAnnotations s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO (Ptr (Ptr DBusAnnotationInfo))
val' <- unpackZeroTerminatedPtrArray val
val'' <- mapM (newBoxed DBusAnnotationInfo) val'
return val''
-- method DBusNodeInfo::new_for_xml
-- method type : Constructor
-- Args : [Arg {argCName = "xml_data", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gio" "DBusNodeInfo"
-- throws : True
-- Skip return : False
foreign import ccall "g_dbus_node_info_new_for_xml" g_dbus_node_info_new_for_xml ::
CString -> -- xml_data : TBasicType TUTF8
Ptr (Ptr GError) -> -- error
IO (Ptr DBusNodeInfo)
dBusNodeInfoNewForXml ::
(MonadIO m) =>
T.Text -- xmlData
-> m DBusNodeInfo -- result
dBusNodeInfoNewForXml xmlData = liftIO $ do
xmlData' <- textToCString xmlData
onException (do
result <- propagateGError $ g_dbus_node_info_new_for_xml xmlData'
checkUnexpectedReturnNULL "g_dbus_node_info_new_for_xml" result
result' <- (wrapBoxed DBusNodeInfo) result
freeMem xmlData'
return result'
) (do
freeMem xmlData'
)
-- method DBusNodeInfo::generate_xml
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusNodeInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "indent", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_builder", argType = TInterface "GLib" "String", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_dbus_node_info_generate_xml" g_dbus_node_info_generate_xml ::
Ptr DBusNodeInfo -> -- _obj : TInterface "Gio" "DBusNodeInfo"
Word32 -> -- indent : TBasicType TUInt32
Ptr GLib.String -> -- string_builder : TInterface "GLib" "String"
IO ()
dBusNodeInfoGenerateXml ::
(MonadIO m) =>
DBusNodeInfo -- _obj
-> Word32 -- indent
-> m (GLib.String) -- result
dBusNodeInfoGenerateXml _obj indent = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
stringBuilder <- callocBoxedBytes 24 :: IO (Ptr GLib.String)
g_dbus_node_info_generate_xml _obj' indent stringBuilder
stringBuilder' <- (wrapBoxed GLib.String) stringBuilder
touchManagedPtr _obj
return stringBuilder'
data DBusNodeInfoGenerateXmlMethodInfo
instance (signature ~ (Word32 -> m (GLib.String)), MonadIO m) => MethodInfo DBusNodeInfoGenerateXmlMethodInfo DBusNodeInfo signature where
overloadedMethod _ = dBusNodeInfoGenerateXml
-- method DBusNodeInfo::lookup_interface
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusNodeInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gio" "DBusInterfaceInfo"
-- throws : False
-- Skip return : False
foreign import ccall "g_dbus_node_info_lookup_interface" g_dbus_node_info_lookup_interface ::
Ptr DBusNodeInfo -> -- _obj : TInterface "Gio" "DBusNodeInfo"
CString -> -- name : TBasicType TUTF8
IO (Ptr DBusInterfaceInfo)
dBusNodeInfoLookupInterface ::
(MonadIO m) =>
DBusNodeInfo -- _obj
-> T.Text -- name
-> m DBusInterfaceInfo -- result
dBusNodeInfoLookupInterface _obj name = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
name' <- textToCString name
result <- g_dbus_node_info_lookup_interface _obj' name'
checkUnexpectedReturnNULL "g_dbus_node_info_lookup_interface" result
result' <- (newBoxed DBusInterfaceInfo) result
touchManagedPtr _obj
freeMem name'
return result'
data DBusNodeInfoLookupInterfaceMethodInfo
instance (signature ~ (T.Text -> m DBusInterfaceInfo), MonadIO m) => MethodInfo DBusNodeInfoLookupInterfaceMethodInfo DBusNodeInfo signature where
overloadedMethod _ = dBusNodeInfoLookupInterface
-- method DBusNodeInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusNodeInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gio" "DBusNodeInfo"
-- throws : False
-- Skip return : False
foreign import ccall "g_dbus_node_info_ref" g_dbus_node_info_ref ::
Ptr DBusNodeInfo -> -- _obj : TInterface "Gio" "DBusNodeInfo"
IO (Ptr DBusNodeInfo)
dBusNodeInfoRef ::
(MonadIO m) =>
DBusNodeInfo -- _obj
-> m DBusNodeInfo -- result
dBusNodeInfoRef _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_dbus_node_info_ref _obj'
checkUnexpectedReturnNULL "g_dbus_node_info_ref" result
result' <- (wrapBoxed DBusNodeInfo) result
touchManagedPtr _obj
return result'
data DBusNodeInfoRefMethodInfo
instance (signature ~ (m DBusNodeInfo), MonadIO m) => MethodInfo DBusNodeInfoRefMethodInfo DBusNodeInfo signature where
overloadedMethod _ = dBusNodeInfoRef
-- method DBusNodeInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusNodeInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_dbus_node_info_unref" g_dbus_node_info_unref ::
Ptr DBusNodeInfo -> -- _obj : TInterface "Gio" "DBusNodeInfo"
IO ()
dBusNodeInfoUnref ::
(MonadIO m) =>
DBusNodeInfo -- _obj
-> m () -- result
dBusNodeInfoUnref _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_dbus_node_info_unref _obj'
touchManagedPtr _obj
return ()
data DBusNodeInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo DBusNodeInfoUnrefMethodInfo DBusNodeInfo signature where
overloadedMethod _ = dBusNodeInfoUnref
type family ResolveDBusNodeInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveDBusNodeInfoMethod "generateXml" o = DBusNodeInfoGenerateXmlMethodInfo
ResolveDBusNodeInfoMethod "lookupInterface" o = DBusNodeInfoLookupInterfaceMethodInfo
ResolveDBusNodeInfoMethod "ref" o = DBusNodeInfoRefMethodInfo
ResolveDBusNodeInfoMethod "unref" o = DBusNodeInfoUnrefMethodInfo
ResolveDBusNodeInfoMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveDBusNodeInfoMethod t DBusNodeInfo, MethodInfo info DBusNodeInfo p) => IsLabelProxy t (DBusNodeInfo -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDBusNodeInfoMethod t DBusNodeInfo, MethodInfo info DBusNodeInfo p) => IsLabel t (DBusNodeInfo -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif