{- | 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. -} module GI.Gio.Structs.DBusArgInfo ( -- * Exported types DBusArgInfo(..) , newZeroDBusArgInfo , noDBusArgInfo , -- * Methods -- ** dBusArgInfoRef DBusArgInfoRefMethodInfo , dBusArgInfoRef , -- ** dBusArgInfoUnref DBusArgInfoUnrefMethodInfo , dBusArgInfoUnref , -- * Properties -- ** Annotations dBusArgInfoReadAnnotations , -- ** Name dBusArgInfoReadName , -- ** RefCount dBusArgInfoReadRefCount , -- ** Signature dBusArgInfoReadSignature , ) 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 newtype DBusArgInfo = DBusArgInfo (ForeignPtr DBusArgInfo) foreign import ccall "g_dbus_arg_info_get_type" c_g_dbus_arg_info_get_type :: IO GType instance BoxedObject DBusArgInfo where boxedType _ = c_g_dbus_arg_info_get_type -- | Construct a `DBusArgInfo` struct initialized to zero. newZeroDBusArgInfo :: MonadIO m => m DBusArgInfo newZeroDBusArgInfo = liftIO $ callocBoxedBytes 32 >>= wrapBoxed DBusArgInfo noDBusArgInfo :: Maybe DBusArgInfo noDBusArgInfo = Nothing dBusArgInfoReadRefCount :: DBusArgInfo -> IO Int32 dBusArgInfoReadRefCount s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Int32 return val dBusArgInfoReadName :: DBusArgInfo -> IO T.Text dBusArgInfoReadName s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO CString val' <- cstringToText val return val' dBusArgInfoReadSignature :: DBusArgInfo -> IO T.Text dBusArgInfoReadSignature s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 16) :: IO CString val' <- cstringToText val return val' dBusArgInfoReadAnnotations :: DBusArgInfo -> IO [DBusAnnotationInfo] dBusArgInfoReadAnnotations s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 24) :: IO (Ptr (Ptr DBusAnnotationInfo)) val' <- unpackZeroTerminatedPtrArray val val'' <- mapM (newBoxed DBusAnnotationInfo) val' return val'' -- method DBusArgInfo::ref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusArgInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : TInterface "Gio" "DBusArgInfo" -- throws : False -- Skip return : False foreign import ccall "g_dbus_arg_info_ref" g_dbus_arg_info_ref :: Ptr DBusArgInfo -> -- _obj : TInterface "Gio" "DBusArgInfo" IO (Ptr DBusArgInfo) dBusArgInfoRef :: (MonadIO m) => DBusArgInfo -- _obj -> m DBusArgInfo -- result dBusArgInfoRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_dbus_arg_info_ref _obj' checkUnexpectedReturnNULL "g_dbus_arg_info_ref" result result' <- (wrapBoxed DBusArgInfo) result touchManagedPtr _obj return result' data DBusArgInfoRefMethodInfo instance (signature ~ (m DBusArgInfo), MonadIO m) => MethodInfo DBusArgInfoRefMethodInfo DBusArgInfo signature where overloadedMethod _ = dBusArgInfoRef -- method DBusArgInfo::unref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "Gio" "DBusArgInfo", 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_arg_info_unref" g_dbus_arg_info_unref :: Ptr DBusArgInfo -> -- _obj : TInterface "Gio" "DBusArgInfo" IO () dBusArgInfoUnref :: (MonadIO m) => DBusArgInfo -- _obj -> m () -- result dBusArgInfoUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_dbus_arg_info_unref _obj' touchManagedPtr _obj return () data DBusArgInfoUnrefMethodInfo instance (signature ~ (m ()), MonadIO m) => MethodInfo DBusArgInfoUnrefMethodInfo DBusArgInfo signature where overloadedMethod _ = dBusArgInfoUnref type family ResolveDBusArgInfoMethod (t :: Symbol) (o :: *) :: * where ResolveDBusArgInfoMethod "ref" o = DBusArgInfoRefMethodInfo ResolveDBusArgInfoMethod "unref" o = DBusArgInfoUnrefMethodInfo ResolveDBusArgInfoMethod l o = MethodResolutionFailed l o instance (info ~ ResolveDBusArgInfoMethod t DBusArgInfo, MethodInfo info DBusArgInfo p) => IsLabelProxy t (DBusArgInfo -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveDBusArgInfoMethod t DBusArgInfo, MethodInfo info DBusArgInfo p) => IsLabel t (DBusArgInfo -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif