{- |
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 an argument for a method or a signal.

/Since: 2.26/
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Structs.DBusArgInfo
    ( 

-- * Exported types
    DBusArgInfo(..)                         ,
    newZeroDBusArgInfo                      ,
    noDBusArgInfo                           ,


 -- * Methods
-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    DBusArgInfoRefMethodInfo                ,
#endif
    dBusArgInfoRef                          ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    DBusArgInfoUnrefMethodInfo              ,
#endif
    dBusArgInfoUnref                        ,




 -- * Properties
-- ** annotations #attr:annotations#
{- | A pointer to a 'Nothing'-terminated array of pointers to 'GI.Gio.Structs.DBusAnnotationInfo.DBusAnnotationInfo' structures or 'Nothing' if there are no annotations.
-}
    clearDBusArgInfoAnnotations             ,
#if ENABLE_OVERLOADING
    dBusArgInfo_annotations                 ,
#endif
    getDBusArgInfoAnnotations               ,
    setDBusArgInfoAnnotations               ,


-- ** name #attr:name#
{- | Name of the argument, e.g. /@unixUserId@/.
-}
    clearDBusArgInfoName                    ,
#if ENABLE_OVERLOADING
    dBusArgInfo_name                        ,
#endif
    getDBusArgInfoName                      ,
    setDBusArgInfoName                      ,


-- ** refCount #attr:refCount#
{- | The reference count or -1 if statically allocated.
-}
#if ENABLE_OVERLOADING
    dBusArgInfo_refCount                    ,
#endif
    getDBusArgInfoRefCount                  ,
    setDBusArgInfoRefCount                  ,


-- ** signature #attr:signature#
{- | D-Bus signature of the argument (a single complete type).
-}
    clearDBusArgInfoSignature               ,
#if ENABLE_OVERLOADING
    dBusArgInfo_signature                   ,
#endif
    getDBusArgInfoSignature                 ,
    setDBusArgInfoSignature                 ,




    ) 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.GValue as B.GValue
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 {-# SOURCE #-} qualified GI.Gio.Structs.DBusAnnotationInfo as Gio.DBusAnnotationInfo

-- | Memory-managed wrapper type.
newtype DBusArgInfo = DBusArgInfo (ManagedPtr DBusArgInfo)
foreign import ccall "g_dbus_arg_info_get_type" c_g_dbus_arg_info_get_type :: 
    IO GType

instance BoxedObject DBusArgInfo where
    boxedType :: DBusArgInfo -> IO GType
boxedType _ = IO GType
c_g_dbus_arg_info_get_type

-- | Construct a `DBusArgInfo` struct initialized to zero.
newZeroDBusArgInfo :: MonadIO m => m DBusArgInfo
newZeroDBusArgInfo :: m DBusArgInfo
newZeroDBusArgInfo = IO DBusArgInfo -> m DBusArgInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusArgInfo -> m DBusArgInfo)
-> IO DBusArgInfo -> m DBusArgInfo
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr DBusArgInfo)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 IO (Ptr DBusArgInfo)
-> (Ptr DBusArgInfo -> IO DBusArgInfo) -> IO DBusArgInfo
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr DBusArgInfo -> DBusArgInfo)
-> Ptr DBusArgInfo -> IO DBusArgInfo
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr DBusArgInfo -> DBusArgInfo
DBusArgInfo

instance tag ~ 'AttrSet => Constructible DBusArgInfo tag where
    new :: (ManagedPtr DBusArgInfo -> DBusArgInfo)
-> [AttrOp DBusArgInfo tag] -> m DBusArgInfo
new _ attrs :: [AttrOp DBusArgInfo tag]
attrs = do
        DBusArgInfo
o <- m DBusArgInfo
forall (m :: * -> *). MonadIO m => m DBusArgInfo
newZeroDBusArgInfo
        DBusArgInfo -> [AttrOp DBusArgInfo 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set DBusArgInfo
o [AttrOp DBusArgInfo tag]
[AttrOp DBusArgInfo 'AttrSet]
attrs
        DBusArgInfo -> m DBusArgInfo
forall (m :: * -> *) a. Monad m => a -> m a
return DBusArgInfo
o


-- | A convenience alias for `Nothing` :: `Maybe` `DBusArgInfo`.
noDBusArgInfo :: Maybe DBusArgInfo
noDBusArgInfo :: Maybe DBusArgInfo
noDBusArgInfo = Maybe DBusArgInfo
forall a. Maybe a
Nothing

{- |
Get the value of the “@ref_count@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusArgInfo #refCount
@
-}
getDBusArgInfoRefCount :: MonadIO m => DBusArgInfo -> m Int32
getDBusArgInfoRefCount :: DBusArgInfo -> m Int32
getDBusArgInfoRefCount s :: DBusArgInfo
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO Int32) -> IO Int32)
-> (Ptr DBusArgInfo -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Int32
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val

{- |
Set the value of the “@ref_count@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusArgInfo [ #refCount 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusArgInfoRefCount :: MonadIO m => DBusArgInfo -> Int32 -> m ()
setDBusArgInfoRefCount :: DBusArgInfo -> Int32 -> m ()
setDBusArgInfoRefCount s :: DBusArgInfo
s val :: Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Int32
val :: Int32)

#if ENABLE_OVERLOADING
data DBusArgInfoRefCountFieldInfo
instance AttrInfo DBusArgInfoRefCountFieldInfo where
    type AttrAllowedOps DBusArgInfoRefCountFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DBusArgInfoRefCountFieldInfo = (~) Int32
    type AttrBaseTypeConstraint DBusArgInfoRefCountFieldInfo = (~) DBusArgInfo
    type AttrGetType DBusArgInfoRefCountFieldInfo = Int32
    type AttrLabel DBusArgInfoRefCountFieldInfo = "ref_count"
    type AttrOrigin DBusArgInfoRefCountFieldInfo = DBusArgInfo
    attrGet _ = getDBusArgInfoRefCount
    attrSet _ = setDBusArgInfoRefCount
    attrConstruct = undefined
    attrClear _ = undefined

dBusArgInfo_refCount :: AttrLabelProxy "refCount"
dBusArgInfo_refCount = AttrLabelProxy

#endif


{- |
Get the value of the “@name@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusArgInfo #name
@
-}
getDBusArgInfoName :: MonadIO m => DBusArgInfo -> m (Maybe T.Text)
getDBusArgInfoName :: DBusArgInfo -> m (Maybe Text)
getDBusArgInfoName s :: DBusArgInfo
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ DBusArgInfo
-> (Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \val' :: CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

{- |
Set the value of the “@name@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusArgInfo [ #name 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusArgInfoName :: MonadIO m => DBusArgInfo -> CString -> m ()
setDBusArgInfoName :: DBusArgInfo -> CString -> m ()
setDBusArgInfoName s :: DBusArgInfo
s val :: CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
val :: CString)

{- |
Set the value of the “@name@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #name
@
-}
clearDBusArgInfoName :: MonadIO m => DBusArgInfo -> m ()
clearDBusArgInfoName :: DBusArgInfo -> m ()
clearDBusArgInfoName s :: DBusArgInfo
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if ENABLE_OVERLOADING
data DBusArgInfoNameFieldInfo
instance AttrInfo DBusArgInfoNameFieldInfo where
    type AttrAllowedOps DBusArgInfoNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusArgInfoNameFieldInfo = (~) CString
    type AttrBaseTypeConstraint DBusArgInfoNameFieldInfo = (~) DBusArgInfo
    type AttrGetType DBusArgInfoNameFieldInfo = Maybe T.Text
    type AttrLabel DBusArgInfoNameFieldInfo = "name"
    type AttrOrigin DBusArgInfoNameFieldInfo = DBusArgInfo
    attrGet _ = getDBusArgInfoName
    attrSet _ = setDBusArgInfoName
    attrConstruct = undefined
    attrClear _ = clearDBusArgInfoName

dBusArgInfo_name :: AttrLabelProxy "name"
dBusArgInfo_name = AttrLabelProxy

#endif


{- |
Get the value of the “@signature@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusArgInfo #signature
@
-}
getDBusArgInfoSignature :: MonadIO m => DBusArgInfo -> m (Maybe T.Text)
getDBusArgInfoSignature :: DBusArgInfo -> m (Maybe Text)
getDBusArgInfoSignature s :: DBusArgInfo
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ DBusArgInfo
-> (Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr DBusArgInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \val' :: CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

{- |
Set the value of the “@signature@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusArgInfo [ #signature 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusArgInfoSignature :: MonadIO m => DBusArgInfo -> CString -> m ()
setDBusArgInfoSignature :: DBusArgInfo -> CString -> m ()
setDBusArgInfoSignature s :: DBusArgInfo
s val :: CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (CString
val :: CString)

{- |
Set the value of the “@signature@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #signature
@
-}
clearDBusArgInfoSignature :: MonadIO m => DBusArgInfo -> m ()
clearDBusArgInfoSignature :: DBusArgInfo -> m ()
clearDBusArgInfoSignature s :: DBusArgInfo
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if ENABLE_OVERLOADING
data DBusArgInfoSignatureFieldInfo
instance AttrInfo DBusArgInfoSignatureFieldInfo where
    type AttrAllowedOps DBusArgInfoSignatureFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusArgInfoSignatureFieldInfo = (~) CString
    type AttrBaseTypeConstraint DBusArgInfoSignatureFieldInfo = (~) DBusArgInfo
    type AttrGetType DBusArgInfoSignatureFieldInfo = Maybe T.Text
    type AttrLabel DBusArgInfoSignatureFieldInfo = "signature"
    type AttrOrigin DBusArgInfoSignatureFieldInfo = DBusArgInfo
    attrGet _ = getDBusArgInfoSignature
    attrSet _ = setDBusArgInfoSignature
    attrConstruct = undefined
    attrClear _ = clearDBusArgInfoSignature

dBusArgInfo_signature :: AttrLabelProxy "signature"
dBusArgInfo_signature = AttrLabelProxy

#endif


{- |
Get the value of the “@annotations@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusArgInfo #annotations
@
-}
getDBusArgInfoAnnotations :: MonadIO m => DBusArgInfo -> m (Maybe [Gio.DBusAnnotationInfo.DBusAnnotationInfo])
getDBusArgInfoAnnotations :: DBusArgInfo -> m (Maybe [DBusAnnotationInfo])
getDBusArgInfoAnnotations s :: DBusArgInfo
s = IO (Maybe [DBusAnnotationInfo]) -> m (Maybe [DBusAnnotationInfo])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [DBusAnnotationInfo]) -> m (Maybe [DBusAnnotationInfo]))
-> IO (Maybe [DBusAnnotationInfo])
-> m (Maybe [DBusAnnotationInfo])
forall a b. (a -> b) -> a -> b
$ DBusArgInfo
-> (Ptr DBusArgInfo -> IO (Maybe [DBusAnnotationInfo]))
-> IO (Maybe [DBusAnnotationInfo])
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO (Maybe [DBusAnnotationInfo]))
 -> IO (Maybe [DBusAnnotationInfo]))
-> (Ptr DBusArgInfo -> IO (Maybe [DBusAnnotationInfo]))
-> IO (Maybe [DBusAnnotationInfo])
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr (Ptr DBusAnnotationInfo)
val <- Ptr (Ptr (Ptr DBusAnnotationInfo))
-> IO (Ptr (Ptr DBusAnnotationInfo))
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr (Ptr (Ptr DBusAnnotationInfo))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) :: IO (Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))
    Maybe [DBusAnnotationInfo]
result <- Ptr (Ptr DBusAnnotationInfo)
-> (Ptr (Ptr DBusAnnotationInfo) -> IO [DBusAnnotationInfo])
-> IO (Maybe [DBusAnnotationInfo])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr (Ptr DBusAnnotationInfo)
val ((Ptr (Ptr DBusAnnotationInfo) -> IO [DBusAnnotationInfo])
 -> IO (Maybe [DBusAnnotationInfo]))
-> (Ptr (Ptr DBusAnnotationInfo) -> IO [DBusAnnotationInfo])
-> IO (Maybe [DBusAnnotationInfo])
forall a b. (a -> b) -> a -> b
$ \val' :: Ptr (Ptr DBusAnnotationInfo)
val' -> do
        [Ptr DBusAnnotationInfo]
val'' <- Ptr (Ptr DBusAnnotationInfo) -> IO [Ptr DBusAnnotationInfo]
forall a. Ptr (Ptr a) -> IO [Ptr a]
unpackZeroTerminatedPtrArray Ptr (Ptr DBusAnnotationInfo)
val'
        [DBusAnnotationInfo]
val''' <- (Ptr DBusAnnotationInfo -> IO DBusAnnotationInfo)
-> [Ptr DBusAnnotationInfo] -> IO [DBusAnnotationInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr DBusAnnotationInfo -> DBusAnnotationInfo)
-> Ptr DBusAnnotationInfo -> IO DBusAnnotationInfo
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr DBusAnnotationInfo -> DBusAnnotationInfo
Gio.DBusAnnotationInfo.DBusAnnotationInfo) [Ptr DBusAnnotationInfo]
val''
        [DBusAnnotationInfo] -> IO [DBusAnnotationInfo]
forall (m :: * -> *) a. Monad m => a -> m a
return [DBusAnnotationInfo]
val'''
    Maybe [DBusAnnotationInfo] -> IO (Maybe [DBusAnnotationInfo])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [DBusAnnotationInfo]
result

{- |
Set the value of the “@annotations@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusArgInfo [ #annotations 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusArgInfoAnnotations :: MonadIO m => DBusArgInfo -> Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo) -> m ()
setDBusArgInfoAnnotations :: DBusArgInfo -> Ptr (Ptr DBusAnnotationInfo) -> m ()
setDBusArgInfoAnnotations s :: DBusArgInfo
s val :: Ptr (Ptr DBusAnnotationInfo)
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr (Ptr (Ptr DBusAnnotationInfo))
-> Ptr (Ptr DBusAnnotationInfo) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr (Ptr (Ptr DBusAnnotationInfo))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) (Ptr (Ptr DBusAnnotationInfo)
val :: Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))

{- |
Set the value of the “@annotations@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #annotations
@
-}
clearDBusArgInfoAnnotations :: MonadIO m => DBusArgInfo -> m ()
clearDBusArgInfoAnnotations :: DBusArgInfo -> m ()
clearDBusArgInfoAnnotations s :: DBusArgInfo
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusArgInfo -> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusArgInfo
s ((Ptr DBusArgInfo -> IO ()) -> IO ())
-> (Ptr DBusArgInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DBusArgInfo
ptr -> do
    Ptr (Ptr (Ptr DBusAnnotationInfo))
-> Ptr (Ptr DBusAnnotationInfo) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusArgInfo
ptr Ptr DBusArgInfo -> Int -> Ptr (Ptr (Ptr DBusAnnotationInfo))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) (Ptr (Ptr DBusAnnotationInfo)
forall a. Ptr a
FP.nullPtr :: Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))

#if ENABLE_OVERLOADING
data DBusArgInfoAnnotationsFieldInfo
instance AttrInfo DBusArgInfoAnnotationsFieldInfo where
    type AttrAllowedOps DBusArgInfoAnnotationsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusArgInfoAnnotationsFieldInfo = (~) (Ptr (Ptr Gio.DBusAnnotationInfo.DBusAnnotationInfo))
    type AttrBaseTypeConstraint DBusArgInfoAnnotationsFieldInfo = (~) DBusArgInfo
    type AttrGetType DBusArgInfoAnnotationsFieldInfo = Maybe [Gio.DBusAnnotationInfo.DBusAnnotationInfo]
    type AttrLabel DBusArgInfoAnnotationsFieldInfo = "annotations"
    type AttrOrigin DBusArgInfoAnnotationsFieldInfo = DBusArgInfo
    attrGet _ = getDBusArgInfoAnnotations
    attrSet _ = setDBusArgInfoAnnotations
    attrConstruct = undefined
    attrClear _ = clearDBusArgInfoAnnotations

dBusArgInfo_annotations :: AttrLabelProxy "annotations"
dBusArgInfo_annotations = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList DBusArgInfo
type instance O.AttributeList DBusArgInfo = DBusArgInfoAttributeList
type DBusArgInfoAttributeList = ('[ '("refCount", DBusArgInfoRefCountFieldInfo), '("name", DBusArgInfoNameFieldInfo), '("signature", DBusArgInfoSignatureFieldInfo), '("annotations", DBusArgInfoAnnotationsFieldInfo)] :: [(Symbol, *)])
#endif

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

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

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

/Since: 2.26/
-}
dBusArgInfoRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusArgInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusArgInfo.DBusArgInfo' -}
    -> m DBusArgInfo
    {- ^ __Returns:__ The same /@info@/. -}
dBusArgInfoRef :: DBusArgInfo -> m DBusArgInfo
dBusArgInfoRef info :: DBusArgInfo
info = IO DBusArgInfo -> m DBusArgInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusArgInfo -> m DBusArgInfo)
-> IO DBusArgInfo -> m DBusArgInfo
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusArgInfo
info' <- DBusArgInfo -> IO (Ptr DBusArgInfo)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DBusArgInfo
info
    Ptr DBusArgInfo
result <- Ptr DBusArgInfo -> IO (Ptr DBusArgInfo)
g_dbus_arg_info_ref Ptr DBusArgInfo
info'
    Text -> Ptr DBusArgInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dBusArgInfoRef" Ptr DBusArgInfo
result
    DBusArgInfo
result' <- ((ManagedPtr DBusArgInfo -> DBusArgInfo)
-> Ptr DBusArgInfo -> IO DBusArgInfo
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr DBusArgInfo -> DBusArgInfo
DBusArgInfo) Ptr DBusArgInfo
result
    DBusArgInfo -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DBusArgInfo
info
    DBusArgInfo -> IO DBusArgInfo
forall (m :: * -> *) a. Monad m => a -> m a
return DBusArgInfo
result'

#if ENABLE_OVERLOADING
data DBusArgInfoRefMethodInfo
instance (signature ~ (m DBusArgInfo), MonadIO m) => O.MethodInfo DBusArgInfoRefMethodInfo DBusArgInfo signature where
    overloadedMethod _ = dBusArgInfoRef

#endif

-- method DBusArgInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusArgInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusArgInfo.", 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_arg_info_unref" g_dbus_arg_info_unref :: 
    Ptr DBusArgInfo ->                      -- info : TInterface (Name {namespace = "Gio", name = "DBusArgInfo"})
    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/
-}
dBusArgInfoUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    DBusArgInfo
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusArgInfo.DBusArgInfo'. -}
    -> m ()
dBusArgInfoUnref :: DBusArgInfo -> m ()
dBusArgInfoUnref info :: DBusArgInfo
info = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusArgInfo
info' <- DBusArgInfo -> IO (Ptr DBusArgInfo)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DBusArgInfo
info
    Ptr DBusArgInfo -> IO ()
g_dbus_arg_info_unref Ptr DBusArgInfo
info'
    DBusArgInfo -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DBusArgInfo
info
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DBusArgInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DBusArgInfoUnrefMethodInfo DBusArgInfo signature where
    overloadedMethod _ = dBusArgInfoUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveDBusArgInfoMethod (t :: Symbol) (o :: *) :: * where
    ResolveDBusArgInfoMethod "ref" o = DBusArgInfoRefMethodInfo
    ResolveDBusArgInfoMethod "unref" o = DBusArgInfoUnrefMethodInfo
    ResolveDBusArgInfoMethod l o = O.MethodResolutionFailed l o

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

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

#endif