packages feed

gi-gio-0.2.46.13: GI/Gio/Structs/DBusInterfaceInfo.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 a D-Bus interface.
-}

module GI.Gio.Structs.DBusInterfaceInfo
    ( 

-- * Exported types
    DBusInterfaceInfo(..)                   ,
    newZeroDBusInterfaceInfo                ,
    noDBusInterfaceInfo                     ,


 -- * Methods
-- ** dBusInterfaceInfoCacheBuild
    DBusInterfaceInfoCacheBuildMethodInfo   ,
    dBusInterfaceInfoCacheBuild             ,


-- ** dBusInterfaceInfoCacheRelease
    DBusInterfaceInfoCacheReleaseMethodInfo ,
    dBusInterfaceInfoCacheRelease           ,


-- ** dBusInterfaceInfoGenerateXml
    DBusInterfaceInfoGenerateXmlMethodInfo  ,
    dBusInterfaceInfoGenerateXml            ,


-- ** dBusInterfaceInfoLookupMethod
    DBusInterfaceInfoLookupMethodMethodInfo ,
    dBusInterfaceInfoLookupMethod           ,


-- ** dBusInterfaceInfoLookupProperty
    DBusInterfaceInfoLookupPropertyMethodInfo,
    dBusInterfaceInfoLookupProperty         ,


-- ** dBusInterfaceInfoLookupSignal
    DBusInterfaceInfoLookupSignalMethodInfo ,
    dBusInterfaceInfoLookupSignal           ,


-- ** dBusInterfaceInfoRef
    DBusInterfaceInfoRefMethodInfo          ,
    dBusInterfaceInfoRef                    ,


-- ** dBusInterfaceInfoUnref
    DBusInterfaceInfoUnrefMethodInfo        ,
    dBusInterfaceInfoUnref                  ,




 -- * Properties
-- ** Annotations
    dBusInterfaceInfoReadAnnotations        ,


-- ** Methods
    dBusInterfaceInfoReadMethods            ,


-- ** Name
    dBusInterfaceInfoReadName               ,


-- ** Properties
    dBusInterfaceInfoReadProperties         ,


-- ** RefCount
    dBusInterfaceInfoReadRefCount           ,


-- ** Signals
    dBusInterfaceInfoReadSignals            ,




    ) 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 DBusInterfaceInfo = DBusInterfaceInfo (ForeignPtr DBusInterfaceInfo)
foreign import ccall "g_dbus_interface_info_get_type" c_g_dbus_interface_info_get_type :: 
    IO GType

instance BoxedObject DBusInterfaceInfo where
    boxedType _ = c_g_dbus_interface_info_get_type

-- | Construct a `DBusInterfaceInfo` struct initialized to zero.
newZeroDBusInterfaceInfo :: MonadIO m => m DBusInterfaceInfo
newZeroDBusInterfaceInfo = liftIO $ callocBoxedBytes 48 >>= wrapBoxed DBusInterfaceInfo

noDBusInterfaceInfo :: Maybe DBusInterfaceInfo
noDBusInterfaceInfo = Nothing

dBusInterfaceInfoReadRefCount :: DBusInterfaceInfo -> IO Int32
dBusInterfaceInfoReadRefCount s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Int32
    return val

dBusInterfaceInfoReadName :: DBusInterfaceInfo -> IO T.Text
dBusInterfaceInfoReadName s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    val' <- cstringToText val
    return val'

dBusInterfaceInfoReadMethods :: DBusInterfaceInfo -> IO [DBusMethodInfo]
dBusInterfaceInfoReadMethods s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr (Ptr DBusMethodInfo))
    val' <- unpackZeroTerminatedPtrArray val
    val'' <- mapM (newBoxed DBusMethodInfo) val'
    return val''

dBusInterfaceInfoReadSignals :: DBusInterfaceInfo -> IO [DBusSignalInfo]
dBusInterfaceInfoReadSignals s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO (Ptr (Ptr DBusSignalInfo))
    val' <- unpackZeroTerminatedPtrArray val
    val'' <- mapM (newBoxed DBusSignalInfo) val'
    return val''

dBusInterfaceInfoReadProperties :: DBusInterfaceInfo -> IO [DBusPropertyInfo]
dBusInterfaceInfoReadProperties s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO (Ptr (Ptr DBusPropertyInfo))
    val' <- unpackZeroTerminatedPtrArray val
    val'' <- mapM (newBoxed DBusPropertyInfo) val'
    return val''

dBusInterfaceInfoReadAnnotations :: DBusInterfaceInfo -> IO [DBusAnnotationInfo]
dBusInterfaceInfoReadAnnotations s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 40) :: IO (Ptr (Ptr DBusAnnotationInfo))
    val' <- unpackZeroTerminatedPtrArray val
    val'' <- mapM (newBoxed DBusAnnotationInfo) val'
    return val''

-- method DBusInterfaceInfo::cache_build
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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_interface_info_cache_build" g_dbus_interface_info_cache_build :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    IO ()


dBusInterfaceInfoCacheBuild ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> m ()                                 -- result
dBusInterfaceInfoCacheBuild _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_cache_build _obj'
    touchManagedPtr _obj
    return ()

data DBusInterfaceInfoCacheBuildMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo DBusInterfaceInfoCacheBuildMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoCacheBuild

-- method DBusInterfaceInfo::cache_release
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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_interface_info_cache_release" g_dbus_interface_info_cache_release :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    IO ()


dBusInterfaceInfoCacheRelease ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> m ()                                 -- result
dBusInterfaceInfoCacheRelease _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_cache_release _obj'
    touchManagedPtr _obj
    return ()

data DBusInterfaceInfoCacheReleaseMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo DBusInterfaceInfoCacheReleaseMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoCacheRelease

-- method DBusInterfaceInfo::generate_xml
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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_interface_info_generate_xml" g_dbus_interface_info_generate_xml :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    Word32 ->                               -- indent : TBasicType TUInt32
    Ptr GLib.String ->                      -- string_builder : TInterface "GLib" "String"
    IO ()


dBusInterfaceInfoGenerateXml ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> Word32                               -- indent
    -> m (GLib.String)                      -- result
dBusInterfaceInfoGenerateXml _obj indent = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    stringBuilder <- callocBoxedBytes 24 :: IO (Ptr GLib.String)
    g_dbus_interface_info_generate_xml _obj' indent stringBuilder
    stringBuilder' <- (wrapBoxed GLib.String) stringBuilder
    touchManagedPtr _obj
    return stringBuilder'

data DBusInterfaceInfoGenerateXmlMethodInfo
instance (signature ~ (Word32 -> m (GLib.String)), MonadIO m) => MethodInfo DBusInterfaceInfoGenerateXmlMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoGenerateXml

-- method DBusInterfaceInfo::lookup_method
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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" "DBusMethodInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_method" g_dbus_interface_info_lookup_method :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr DBusMethodInfo)


dBusInterfaceInfoLookupMethod ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> T.Text                               -- name
    -> m DBusMethodInfo                     -- result
dBusInterfaceInfoLookupMethod _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_method _obj' name'
    checkUnexpectedReturnNULL "g_dbus_interface_info_lookup_method" result
    result' <- (newBoxed DBusMethodInfo) result
    touchManagedPtr _obj
    freeMem name'
    return result'

data DBusInterfaceInfoLookupMethodMethodInfo
instance (signature ~ (T.Text -> m DBusMethodInfo), MonadIO m) => MethodInfo DBusInterfaceInfoLookupMethodMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoLookupMethod

-- method DBusInterfaceInfo::lookup_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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" "DBusPropertyInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_property" g_dbus_interface_info_lookup_property :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr DBusPropertyInfo)


dBusInterfaceInfoLookupProperty ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> T.Text                               -- name
    -> m DBusPropertyInfo                   -- result
dBusInterfaceInfoLookupProperty _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_property _obj' name'
    checkUnexpectedReturnNULL "g_dbus_interface_info_lookup_property" result
    result' <- (newBoxed DBusPropertyInfo) result
    touchManagedPtr _obj
    freeMem name'
    return result'

data DBusInterfaceInfoLookupPropertyMethodInfo
instance (signature ~ (T.Text -> m DBusPropertyInfo), MonadIO m) => MethodInfo DBusInterfaceInfoLookupPropertyMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoLookupProperty

-- method DBusInterfaceInfo::lookup_signal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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" "DBusSignalInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_signal" g_dbus_interface_info_lookup_signal :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr DBusSignalInfo)


dBusInterfaceInfoLookupSignal ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> T.Text                               -- name
    -> m DBusSignalInfo                     -- result
dBusInterfaceInfoLookupSignal _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_signal _obj' name'
    checkUnexpectedReturnNULL "g_dbus_interface_info_lookup_signal" result
    result' <- (newBoxed DBusSignalInfo) result
    touchManagedPtr _obj
    freeMem name'
    return result'

data DBusInterfaceInfoLookupSignalMethodInfo
instance (signature ~ (T.Text -> m DBusSignalInfo), MonadIO m) => MethodInfo DBusInterfaceInfoLookupSignalMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoLookupSignal

-- method DBusInterfaceInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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_interface_info_ref" g_dbus_interface_info_ref :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    IO (Ptr DBusInterfaceInfo)


dBusInterfaceInfoRef ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> m DBusInterfaceInfo                  -- result
dBusInterfaceInfoRef _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_dbus_interface_info_ref _obj'
    checkUnexpectedReturnNULL "g_dbus_interface_info_ref" result
    result' <- (wrapBoxed DBusInterfaceInfo) result
    touchManagedPtr _obj
    return result'

data DBusInterfaceInfoRefMethodInfo
instance (signature ~ (m DBusInterfaceInfo), MonadIO m) => MethodInfo DBusInterfaceInfoRefMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoRef

-- method DBusInterfaceInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", 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_interface_info_unref" g_dbus_interface_info_unref :: 
    Ptr DBusInterfaceInfo ->                -- _obj : TInterface "Gio" "DBusInterfaceInfo"
    IO ()


dBusInterfaceInfoUnref ::
    (MonadIO m) =>
    DBusInterfaceInfo                       -- _obj
    -> m ()                                 -- result
dBusInterfaceInfoUnref _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_unref _obj'
    touchManagedPtr _obj
    return ()

data DBusInterfaceInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo DBusInterfaceInfoUnrefMethodInfo DBusInterfaceInfo signature where
    overloadedMethod _ = dBusInterfaceInfoUnref

type family ResolveDBusInterfaceInfoMethod (t :: Symbol) (o :: *) :: * where
    ResolveDBusInterfaceInfoMethod "cacheBuild" o = DBusInterfaceInfoCacheBuildMethodInfo
    ResolveDBusInterfaceInfoMethod "cacheRelease" o = DBusInterfaceInfoCacheReleaseMethodInfo
    ResolveDBusInterfaceInfoMethod "generateXml" o = DBusInterfaceInfoGenerateXmlMethodInfo
    ResolveDBusInterfaceInfoMethod "lookupMethod" o = DBusInterfaceInfoLookupMethodMethodInfo
    ResolveDBusInterfaceInfoMethod "lookupProperty" o = DBusInterfaceInfoLookupPropertyMethodInfo
    ResolveDBusInterfaceInfoMethod "lookupSignal" o = DBusInterfaceInfoLookupSignalMethodInfo
    ResolveDBusInterfaceInfoMethod "ref" o = DBusInterfaceInfoRefMethodInfo
    ResolveDBusInterfaceInfoMethod "unref" o = DBusInterfaceInfoUnrefMethodInfo
    ResolveDBusInterfaceInfoMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveDBusInterfaceInfoMethod t DBusInterfaceInfo, MethodInfo info DBusInterfaceInfo p) => IsLabelProxy t (DBusInterfaceInfo -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDBusInterfaceInfoMethod t DBusInterfaceInfo, MethodInfo info DBusInterfaceInfo p) => IsLabel t (DBusInterfaceInfo -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif