{- |
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
-- ** cacheBuild #method:cacheBuild#
    DBusInterfaceInfoCacheBuildMethodInfo   ,
    dBusInterfaceInfoCacheBuild             ,


-- ** cacheRelease #method:cacheRelease#
    DBusInterfaceInfoCacheReleaseMethodInfo ,
    dBusInterfaceInfoCacheRelease           ,


-- ** generateXml #method:generateXml#
    DBusInterfaceInfoGenerateXmlMethodInfo  ,
    dBusInterfaceInfoGenerateXml            ,


-- ** lookupMethod #method:lookupMethod#
    DBusInterfaceInfoLookupMethodMethodInfo ,
    dBusInterfaceInfoLookupMethod           ,


-- ** lookupProperty #method:lookupProperty#
    DBusInterfaceInfoLookupPropertyMethodInfo,
    dBusInterfaceInfoLookupProperty         ,


-- ** lookupSignal #method:lookupSignal#
    DBusInterfaceInfoLookupSignalMethodInfo ,
    dBusInterfaceInfoLookupSignal           ,


-- ** ref #method:ref#
    DBusInterfaceInfoRefMethodInfo          ,
    dBusInterfaceInfoRef                    ,


-- ** unref #method:unref#
    DBusInterfaceInfoUnrefMethodInfo        ,
    dBusInterfaceInfoUnref                  ,




 -- * Properties
-- ** annotations #attr:annotations#
    clearDBusInterfaceInfoAnnotations       ,
    dBusInterfaceInfo_annotations           ,
    getDBusInterfaceInfoAnnotations         ,
    setDBusInterfaceInfoAnnotations         ,


-- ** methods #attr:methods#
    clearDBusInterfaceInfoMethods           ,
    dBusInterfaceInfo_methods               ,
    getDBusInterfaceInfoMethods             ,
    setDBusInterfaceInfoMethods             ,


-- ** name #attr:name#
    clearDBusInterfaceInfoName              ,
    dBusInterfaceInfo_name                  ,
    getDBusInterfaceInfoName                ,
    setDBusInterfaceInfoName                ,


-- ** properties #attr:properties#
    clearDBusInterfaceInfoProperties        ,
    dBusInterfaceInfo_properties            ,
    getDBusInterfaceInfoProperties          ,
    setDBusInterfaceInfoProperties          ,


-- ** refCount #attr:refCount#
    dBusInterfaceInfo_refCount              ,
    getDBusInterfaceInfoRefCount            ,
    setDBusInterfaceInfoRefCount            ,


-- ** signals #attr:signals#
    clearDBusInterfaceInfoSignals           ,
    dBusInterfaceInfo_signals               ,
    getDBusInterfaceInfoSignals             ,
    setDBusInterfaceInfoSignals             ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Structs.String as GLib.String
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusAnnotationInfo as Gio.DBusAnnotationInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusMethodInfo as Gio.DBusMethodInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusPropertyInfo as Gio.DBusPropertyInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusSignalInfo as Gio.DBusSignalInfo

newtype DBusInterfaceInfo = DBusInterfaceInfo (ManagedPtr 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

instance tag ~ 'AttrSet => Constructible DBusInterfaceInfo tag where
    new _ attrs = do
        o <- newZeroDBusInterfaceInfo
        GI.Attributes.set o attrs
        return o


noDBusInterfaceInfo :: Maybe DBusInterfaceInfo
noDBusInterfaceInfo = Nothing

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

setDBusInterfaceInfoRefCount :: MonadIO m => DBusInterfaceInfo -> Int32 -> m ()
setDBusInterfaceInfoRefCount s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: Int32)

data DBusInterfaceInfoRefCountFieldInfo
instance AttrInfo DBusInterfaceInfoRefCountFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoRefCountFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DBusInterfaceInfoRefCountFieldInfo = (~) Int32
    type AttrBaseTypeConstraint DBusInterfaceInfoRefCountFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoRefCountFieldInfo = Int32
    type AttrLabel DBusInterfaceInfoRefCountFieldInfo = "ref_count"
    type AttrOrigin DBusInterfaceInfoRefCountFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoRefCount
    attrSet _ = setDBusInterfaceInfoRefCount
    attrConstruct = undefined
    attrClear _ = undefined

dBusInterfaceInfo_refCount :: AttrLabelProxy "refCount"
dBusInterfaceInfo_refCount = AttrLabelProxy


getDBusInterfaceInfoName :: MonadIO m => DBusInterfaceInfo -> m (Maybe T.Text)
getDBusInterfaceInfoName s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

setDBusInterfaceInfoName :: MonadIO m => DBusInterfaceInfo -> CString -> m ()
setDBusInterfaceInfoName s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: CString)

clearDBusInterfaceInfoName :: MonadIO m => DBusInterfaceInfo -> m ()
clearDBusInterfaceInfoName s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)

data DBusInterfaceInfoNameFieldInfo
instance AttrInfo DBusInterfaceInfoNameFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceInfoNameFieldInfo = (~) CString
    type AttrBaseTypeConstraint DBusInterfaceInfoNameFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoNameFieldInfo = Maybe T.Text
    type AttrLabel DBusInterfaceInfoNameFieldInfo = "name"
    type AttrOrigin DBusInterfaceInfoNameFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoName
    attrSet _ = setDBusInterfaceInfoName
    attrConstruct = undefined
    attrClear _ = clearDBusInterfaceInfoName

dBusInterfaceInfo_name :: AttrLabelProxy "name"
dBusInterfaceInfo_name = AttrLabelProxy


getDBusInterfaceInfoMethods :: MonadIO m => DBusInterfaceInfo -> m (Maybe [Gio.DBusMethodInfo.DBusMethodInfo])
getDBusInterfaceInfoMethods s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr (Ptr Gio.DBusMethodInfo.DBusMethodInfo))
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- unpackZeroTerminatedPtrArray val'
        val''' <- mapM (newBoxed Gio.DBusMethodInfo.DBusMethodInfo) val''
        return val'''
    return result

setDBusInterfaceInfoMethods :: MonadIO m => DBusInterfaceInfo -> Ptr (Ptr Gio.DBusMethodInfo.DBusMethodInfo) -> m ()
setDBusInterfaceInfoMethods s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Ptr (Ptr Gio.DBusMethodInfo.DBusMethodInfo))

clearDBusInterfaceInfoMethods :: MonadIO m => DBusInterfaceInfo -> m ()
clearDBusInterfaceInfoMethods s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (FP.nullPtr :: Ptr (Ptr Gio.DBusMethodInfo.DBusMethodInfo))

data DBusInterfaceInfoMethodsFieldInfo
instance AttrInfo DBusInterfaceInfoMethodsFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoMethodsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceInfoMethodsFieldInfo = (~) (Ptr (Ptr Gio.DBusMethodInfo.DBusMethodInfo))
    type AttrBaseTypeConstraint DBusInterfaceInfoMethodsFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoMethodsFieldInfo = Maybe [Gio.DBusMethodInfo.DBusMethodInfo]
    type AttrLabel DBusInterfaceInfoMethodsFieldInfo = "methods"
    type AttrOrigin DBusInterfaceInfoMethodsFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoMethods
    attrSet _ = setDBusInterfaceInfoMethods
    attrConstruct = undefined
    attrClear _ = clearDBusInterfaceInfoMethods

dBusInterfaceInfo_methods :: AttrLabelProxy "methods"
dBusInterfaceInfo_methods = AttrLabelProxy


getDBusInterfaceInfoSignals :: MonadIO m => DBusInterfaceInfo -> m (Maybe [Gio.DBusSignalInfo.DBusSignalInfo])
getDBusInterfaceInfoSignals s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO (Ptr (Ptr Gio.DBusSignalInfo.DBusSignalInfo))
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- unpackZeroTerminatedPtrArray val'
        val''' <- mapM (newBoxed Gio.DBusSignalInfo.DBusSignalInfo) val''
        return val'''
    return result

setDBusInterfaceInfoSignals :: MonadIO m => DBusInterfaceInfo -> Ptr (Ptr Gio.DBusSignalInfo.DBusSignalInfo) -> m ()
setDBusInterfaceInfoSignals s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (val :: Ptr (Ptr Gio.DBusSignalInfo.DBusSignalInfo))

clearDBusInterfaceInfoSignals :: MonadIO m => DBusInterfaceInfo -> m ()
clearDBusInterfaceInfoSignals s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (FP.nullPtr :: Ptr (Ptr Gio.DBusSignalInfo.DBusSignalInfo))

data DBusInterfaceInfoSignalsFieldInfo
instance AttrInfo DBusInterfaceInfoSignalsFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoSignalsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceInfoSignalsFieldInfo = (~) (Ptr (Ptr Gio.DBusSignalInfo.DBusSignalInfo))
    type AttrBaseTypeConstraint DBusInterfaceInfoSignalsFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoSignalsFieldInfo = Maybe [Gio.DBusSignalInfo.DBusSignalInfo]
    type AttrLabel DBusInterfaceInfoSignalsFieldInfo = "signals"
    type AttrOrigin DBusInterfaceInfoSignalsFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoSignals
    attrSet _ = setDBusInterfaceInfoSignals
    attrConstruct = undefined
    attrClear _ = clearDBusInterfaceInfoSignals

dBusInterfaceInfo_signals :: AttrLabelProxy "signals"
dBusInterfaceInfo_signals = AttrLabelProxy


getDBusInterfaceInfoProperties :: MonadIO m => DBusInterfaceInfo -> m (Maybe [Gio.DBusPropertyInfo.DBusPropertyInfo])
getDBusInterfaceInfoProperties s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO (Ptr (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo))
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- unpackZeroTerminatedPtrArray val'
        val''' <- mapM (newBoxed Gio.DBusPropertyInfo.DBusPropertyInfo) val''
        return val'''
    return result

setDBusInterfaceInfoProperties :: MonadIO m => DBusInterfaceInfo -> Ptr (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo) -> m ()
setDBusInterfaceInfoProperties s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 32) (val :: Ptr (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo))

clearDBusInterfaceInfoProperties :: MonadIO m => DBusInterfaceInfo -> m ()
clearDBusInterfaceInfoProperties s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 32) (FP.nullPtr :: Ptr (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo))

data DBusInterfaceInfoPropertiesFieldInfo
instance AttrInfo DBusInterfaceInfoPropertiesFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoPropertiesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceInfoPropertiesFieldInfo = (~) (Ptr (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo))
    type AttrBaseTypeConstraint DBusInterfaceInfoPropertiesFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoPropertiesFieldInfo = Maybe [Gio.DBusPropertyInfo.DBusPropertyInfo]
    type AttrLabel DBusInterfaceInfoPropertiesFieldInfo = "properties"
    type AttrOrigin DBusInterfaceInfoPropertiesFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoProperties
    attrSet _ = setDBusInterfaceInfoProperties
    attrConstruct = undefined
    attrClear _ = clearDBusInterfaceInfoProperties

dBusInterfaceInfo_properties :: AttrLabelProxy "properties"
dBusInterfaceInfo_properties = AttrLabelProxy


getDBusInterfaceInfoAnnotations :: MonadIO m => DBusInterfaceInfo -> m (Maybe [Gio.DBusAnnotationInfo.DBusAnnotationInfo])
getDBusInterfaceInfoAnnotations s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 40) :: IO (Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- unpackZeroTerminatedPtrArray val'
        val''' <- mapM (newBoxed Gio.DBusAnnotationInfo.DBusAnnotationInfo) val''
        return val'''
    return result

setDBusInterfaceInfoAnnotations :: MonadIO m => DBusInterfaceInfo -> Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo) -> m ()
setDBusInterfaceInfoAnnotations s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 40) (val :: Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))

clearDBusInterfaceInfoAnnotations :: MonadIO m => DBusInterfaceInfo -> m ()
clearDBusInterfaceInfoAnnotations s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 40) (FP.nullPtr :: Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))

data DBusInterfaceInfoAnnotationsFieldInfo
instance AttrInfo DBusInterfaceInfoAnnotationsFieldInfo where
    type AttrAllowedOps DBusInterfaceInfoAnnotationsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceInfoAnnotationsFieldInfo = (~) (Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))
    type AttrBaseTypeConstraint DBusInterfaceInfoAnnotationsFieldInfo = (~) DBusInterfaceInfo
    type AttrGetType DBusInterfaceInfoAnnotationsFieldInfo = Maybe [Gio.DBusAnnotationInfo.DBusAnnotationInfo]
    type AttrLabel DBusInterfaceInfoAnnotationsFieldInfo = "annotations"
    type AttrOrigin DBusInterfaceInfoAnnotationsFieldInfo = DBusInterfaceInfo
    attrGet _ = getDBusInterfaceInfoAnnotations
    attrSet _ = setDBusInterfaceInfoAnnotations
    attrConstruct = undefined
    attrClear _ = clearDBusInterfaceInfoAnnotations

dBusInterfaceInfo_annotations :: AttrLabelProxy "annotations"
dBusInterfaceInfo_annotations = AttrLabelProxy



instance O.HasAttributeList DBusInterfaceInfo
type instance O.AttributeList DBusInterfaceInfo = DBusInterfaceInfoAttributeList
type DBusInterfaceInfoAttributeList = ('[ '("refCount", DBusInterfaceInfoRefCountFieldInfo), '("name", DBusInterfaceInfoNameFieldInfo), '("methods", DBusInterfaceInfoMethodsFieldInfo), '("signals", DBusInterfaceInfoSignalsFieldInfo), '("properties", DBusInterfaceInfoPropertiesFieldInfo), '("annotations", DBusInterfaceInfoAnnotationsFieldInfo)] :: [(Symbol, *)])

-- method DBusInterfaceInfo::cache_build
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_cache_build" g_dbus_interface_info_cache_build :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    IO ()

{- |
Builds a lookup-cache to speed up
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoLookupMethod',
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoLookupSignal' and
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoLookupProperty'.

If this has already been called with /@info@/, the existing cache is
used and its use count is increased.

Note that /@info@/ cannot be modified until
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoCacheRelease' is called.

@since 2.30
-}
dBusInterfaceInfoCacheBuild ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'. -}
    -> m ()
dBusInterfaceInfoCacheBuild info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    g_dbus_interface_info_cache_build info'
    touchManagedPtr info
    return ()

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

-- method DBusInterfaceInfo::cache_release
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A GDBusInterfaceInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_cache_release" g_dbus_interface_info_cache_release :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    IO ()

{- |
Decrements the usage count for the cache for /@info@/ built by
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoCacheBuild' (if any) and frees the
resources used by the cache if the usage count drops to zero.

@since 2.30
-}
dBusInterfaceInfoCacheRelease ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A GDBusInterfaceInfo -}
    -> m ()
dBusInterfaceInfoCacheRelease info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    g_dbus_interface_info_cache_release info'
    touchManagedPtr info
    return ()

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

-- method DBusInterfaceInfo::generate_xml
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusNodeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "indent", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Indentation level.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_builder", argType = TInterface (Name {namespace = "GLib", name = "String"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GString to to append XML data to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_generate_xml" g_dbus_interface_info_generate_xml :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    Word32 ->                               -- indent : TBasicType TUInt
    Ptr GLib.String.String ->               -- string_builder : TInterface (Name {namespace = "GLib", name = "String"})
    IO ()

{- |
Appends an XML representation of /@info@/ (and its children) to /@stringBuilder@/.

This function is typically used for generating introspection XML
documents at run-time for handling the
@org.freedesktop.DBus.Introspectable.Introspect@
method.

@since 2.26
-}
dBusInterfaceInfoGenerateXml ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusNodeInfo.DBusNodeInfo' -}
    -> Word32
    {- ^ /@indent@/: Indentation level. -}
    -> m (GLib.String.String)
dBusInterfaceInfoGenerateXml info indent = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    stringBuilder <- callocBoxedBytes 24 :: IO (Ptr GLib.String.String)
    g_dbus_interface_info_generate_xml info' indent stringBuilder
    stringBuilder' <- (wrapBoxed GLib.String.String) stringBuilder
    touchManagedPtr info
    return stringBuilder'

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

-- method DBusInterfaceInfo::lookup_method
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus method name (typically in CamelCase)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusMethodInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_method" g_dbus_interface_info_lookup_method :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gio.DBusMethodInfo.DBusMethodInfo)

{- |
Looks up information about a method.

The cost of this function is O(n) in number of methods unless
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoCacheBuild' has been used on /@info@/.

@since 2.26
-}
dBusInterfaceInfoLookupMethod ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'. -}
    -> T.Text
    {- ^ /@name@/: A D-Bus method name (typically in CamelCase) -}
    -> m Gio.DBusMethodInfo.DBusMethodInfo
    {- ^ __Returns:__ A 'GI.Gio.Structs.DBusMethodInfo.DBusMethodInfo' or 'Nothing' if not found. Do not free, it is owned by /@info@/. -}
dBusInterfaceInfoLookupMethod info name = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_method info' name'
    checkUnexpectedReturnNULL "dBusInterfaceInfoLookupMethod" result
    result' <- (newBoxed Gio.DBusMethodInfo.DBusMethodInfo) result
    touchManagedPtr info
    freeMem name'
    return result'

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

-- method DBusInterfaceInfo::lookup_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus property name (typically in CamelCase).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusPropertyInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_property" g_dbus_interface_info_lookup_property :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gio.DBusPropertyInfo.DBusPropertyInfo)

{- |
Looks up information about a property.

The cost of this function is O(n) in number of properties unless
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoCacheBuild' has been used on /@info@/.

@since 2.26
-}
dBusInterfaceInfoLookupProperty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'. -}
    -> T.Text
    {- ^ /@name@/: A D-Bus property name (typically in CamelCase). -}
    -> m Gio.DBusPropertyInfo.DBusPropertyInfo
    {- ^ __Returns:__ A 'GI.Gio.Structs.DBusPropertyInfo.DBusPropertyInfo' or 'Nothing' if not found. Do not free, it is owned by /@info@/. -}
dBusInterfaceInfoLookupProperty info name = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_property info' name'
    checkUnexpectedReturnNULL "dBusInterfaceInfoLookupProperty" result
    result' <- (newBoxed Gio.DBusPropertyInfo.DBusPropertyInfo) result
    touchManagedPtr info
    freeMem name'
    return result'

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

-- method DBusInterfaceInfo::lookup_signal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus signal name (typically in CamelCase)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusSignalInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_lookup_signal" g_dbus_interface_info_lookup_signal :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gio.DBusSignalInfo.DBusSignalInfo)

{- |
Looks up information about a signal.

The cost of this function is O(n) in number of signals unless
'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoCacheBuild' has been used on /@info@/.

@since 2.26
-}
dBusInterfaceInfoLookupSignal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'. -}
    -> T.Text
    {- ^ /@name@/: A D-Bus signal name (typically in CamelCase) -}
    -> m Gio.DBusSignalInfo.DBusSignalInfo
    {- ^ __Returns:__ A 'GI.Gio.Structs.DBusSignalInfo.DBusSignalInfo' or 'Nothing' if not found. Do not free, it is owned by /@info@/. -}
dBusInterfaceInfoLookupSignal info name = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    name' <- textToCString name
    result <- g_dbus_interface_info_lookup_signal info' name'
    checkUnexpectedReturnNULL "dBusInterfaceInfoLookupSignal" result
    result' <- (newBoxed Gio.DBusSignalInfo.DBusSignalInfo) result
    touchManagedPtr info
    freeMem name'
    return result'

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

-- method DBusInterfaceInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_ref" g_dbus_interface_info_ref :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    IO (Ptr DBusInterfaceInfo)

{- |
If /@info@/ is statically allocated does nothing. Otherwise increases
the reference count.

@since 2.26
-}
dBusInterfaceInfoRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' -}
    -> m DBusInterfaceInfo
    {- ^ __Returns:__ The same /@info@/. -}
dBusInterfaceInfoRef info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    result <- g_dbus_interface_info_ref info'
    checkUnexpectedReturnNULL "dBusInterfaceInfoRef" result
    result' <- (wrapBoxed DBusInterfaceInfo) result
    touchManagedPtr info
    return result'

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

-- method DBusInterfaceInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_interface_info_unref" g_dbus_interface_info_unref :: 
    Ptr DBusInterfaceInfo ->                -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    IO ()

{- |
If /@info@/ is statically allocated, does nothing. Otherwise decreases
the reference count of /@info@/. When its reference count drops to 0,
the memory used is freed.

@since 2.26
-}
dBusInterfaceInfoUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusInterfaceInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'. -}
    -> m ()
dBusInterfaceInfoUnref info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    g_dbus_interface_info_unref info'
    touchManagedPtr info
    return ()

data DBusInterfaceInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.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 = O.MethodResolutionFailed l o

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

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