{- |
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(..)                   ,
    noDBusInterfaceInfo                     ,


 -- * Methods
-- ** dBusInterfaceInfoCacheBuild
    dBusInterfaceInfoCacheBuild             ,


-- ** dBusInterfaceInfoCacheRelease
    dBusInterfaceInfoCacheRelease           ,


-- ** dBusInterfaceInfoGenerateXml
    dBusInterfaceInfoGenerateXml            ,


-- ** dBusInterfaceInfoLookupMethod
    dBusInterfaceInfoLookupMethod           ,


-- ** dBusInterfaceInfoLookupProperty
    dBusInterfaceInfoLookupProperty         ,


-- ** dBusInterfaceInfoLookupSignal
    dBusInterfaceInfoLookupSignal           ,


-- ** dBusInterfaceInfoRef
    dBusInterfaceInfoRef                    ,


-- ** dBusInterfaceInfoUnref
    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

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 {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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 ()
dBusInterfaceInfoCacheBuild _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_cache_build _obj'
    touchManagedPtr _obj
    return ()

-- method DBusInterfaceInfo::cache_release
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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 ()
dBusInterfaceInfoCacheRelease _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_cache_release _obj'
    touchManagedPtr _obj
    return ()

-- method DBusInterfaceInfo::generate_xml
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "indent", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string_builder", argType = TInterface "GLib" "String", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "indent", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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)
dBusInterfaceInfoGenerateXml _obj indent = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    string_builder <- callocBoxedBytes 24 :: IO (Ptr GLib.String)
    g_dbus_interface_info_generate_xml _obj' indent string_builder
    string_builder' <- (wrapBoxed GLib.String) string_builder
    touchManagedPtr _obj
    return string_builder'

-- method DBusInterfaceInfo::lookup_method
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method DBusInterfaceInfo::lookup_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method DBusInterfaceInfo::lookup_signal
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method DBusInterfaceInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method DBusInterfaceInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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 ()
dBusInterfaceInfoUnref _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_dbus_interface_info_unref _obj'
    touchManagedPtr _obj
    return ()