gi-gio-0.2.44.12: GI/Gio/Objects/UnixFDMessage.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)
-}
module GI.Gio.Objects.UnixFDMessage
(
-- * Exported types
UnixFDMessage(..) ,
UnixFDMessageK ,
toUnixFDMessage ,
noUnixFDMessage ,
-- * Methods
-- ** unixFDMessageAppendFd
unixFDMessageAppendFd ,
-- ** unixFDMessageGetFdList
unixFDMessageGetFdList ,
-- ** unixFDMessageNew
unixFDMessageNew ,
-- ** unixFDMessageNewWithFdList
unixFDMessageNewWithFdList ,
-- ** unixFDMessageStealFds
unixFDMessageStealFds ,
-- * Properties
-- ** FdList
UnixFDMessageFdListPropertyInfo ,
constructUnixFDMessageFdList ,
getUnixFDMessageFdList ,
) 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.GObject as GObject
newtype UnixFDMessage = UnixFDMessage (ForeignPtr UnixFDMessage)
foreign import ccall "g_unix_fd_message_get_type"
c_g_unix_fd_message_get_type :: IO GType
type instance ParentTypes UnixFDMessage = UnixFDMessageParentTypes
type UnixFDMessageParentTypes = '[SocketControlMessage, GObject.Object]
instance GObject UnixFDMessage where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_unix_fd_message_get_type
class GObject o => UnixFDMessageK o
instance (GObject o, IsDescendantOf UnixFDMessage o) => UnixFDMessageK o
toUnixFDMessage :: UnixFDMessageK o => o -> IO UnixFDMessage
toUnixFDMessage = unsafeCastTo UnixFDMessage
noUnixFDMessage :: Maybe UnixFDMessage
noUnixFDMessage = Nothing
-- VVV Prop "fd-list"
-- Type: TInterface "Gio" "UnixFDList"
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
getUnixFDMessageFdList :: (MonadIO m, UnixFDMessageK o) => o -> m UnixFDList
getUnixFDMessageFdList obj = liftIO $ getObjectPropertyObject obj "fd-list" UnixFDList
constructUnixFDMessageFdList :: (UnixFDListK a) => a -> IO ([Char], GValue)
constructUnixFDMessageFdList val = constructObjectPropertyObject "fd-list" val
data UnixFDMessageFdListPropertyInfo
instance AttrInfo UnixFDMessageFdListPropertyInfo where
type AttrAllowedOps UnixFDMessageFdListPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint UnixFDMessageFdListPropertyInfo = UnixFDListK
type AttrBaseTypeConstraint UnixFDMessageFdListPropertyInfo = UnixFDMessageK
type AttrGetType UnixFDMessageFdListPropertyInfo = UnixFDList
type AttrLabel UnixFDMessageFdListPropertyInfo = "UnixFDMessage::fd-list"
attrGet _ = getUnixFDMessageFdList
attrSet _ = undefined
attrConstruct _ = constructUnixFDMessageFdList
type instance AttributeList UnixFDMessage = UnixFDMessageAttributeList
type UnixFDMessageAttributeList = ('[ '("fd-list", UnixFDMessageFdListPropertyInfo)] :: [(Symbol, *)])
type instance SignalList UnixFDMessage = UnixFDMessageSignalList
type UnixFDMessageSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method UnixFDMessage::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gio" "UnixFDMessage"
-- throws : False
-- Skip return : False
foreign import ccall "g_unix_fd_message_new" g_unix_fd_message_new ::
IO (Ptr UnixFDMessage)
unixFDMessageNew ::
(MonadIO m) =>
m UnixFDMessage
unixFDMessageNew = liftIO $ do
result <- g_unix_fd_message_new
checkUnexpectedReturnNULL "g_unix_fd_message_new" result
result' <- (wrapObject UnixFDMessage) result
return result'
-- method UnixFDMessage::new_with_fd_list
-- method type : Constructor
-- Args : [Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "UnixFDMessage"
-- throws : False
-- Skip return : False
foreign import ccall "g_unix_fd_message_new_with_fd_list" g_unix_fd_message_new_with_fd_list ::
Ptr UnixFDList -> -- fd_list : TInterface "Gio" "UnixFDList"
IO (Ptr UnixFDMessage)
unixFDMessageNewWithFdList ::
(MonadIO m, UnixFDListK a) =>
a -> -- fd_list
m UnixFDMessage
unixFDMessageNewWithFdList fd_list = liftIO $ do
let fd_list' = unsafeManagedPtrCastPtr fd_list
result <- g_unix_fd_message_new_with_fd_list fd_list'
checkUnexpectedReturnNULL "g_unix_fd_message_new_with_fd_list" result
result' <- (wrapObject UnixFDMessage) result
touchManagedPtr fd_list
return result'
-- method UnixFDMessage::append_fd
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_unix_fd_message_append_fd" g_unix_fd_message_append_fd ::
Ptr UnixFDMessage -> -- _obj : TInterface "Gio" "UnixFDMessage"
Int32 -> -- fd : TBasicType TInt32
Ptr (Ptr GError) -> -- error
IO CInt
unixFDMessageAppendFd ::
(MonadIO m, UnixFDMessageK a) =>
a -> -- _obj
Int32 -> -- fd
m ()
unixFDMessageAppendFd _obj fd = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
onException (do
_ <- propagateGError $ g_unix_fd_message_append_fd _obj' fd
touchManagedPtr _obj
return ()
) (do
return ()
)
-- method UnixFDMessage::get_fd_list
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "UnixFDList"
-- throws : False
-- Skip return : False
foreign import ccall "g_unix_fd_message_get_fd_list" g_unix_fd_message_get_fd_list ::
Ptr UnixFDMessage -> -- _obj : TInterface "Gio" "UnixFDMessage"
IO (Ptr UnixFDList)
unixFDMessageGetFdList ::
(MonadIO m, UnixFDMessageK a) =>
a -> -- _obj
m UnixFDList
unixFDMessageGetFdList _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_unix_fd_message_get_fd_list _obj'
checkUnexpectedReturnNULL "g_unix_fd_message_get_fd_list" result
result' <- (newObject UnixFDList) result
touchManagedPtr _obj
return result'
-- method UnixFDMessage::steal_fds
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixFDMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray False (-1) 1 (TBasicType TInt32)
-- throws : False
-- Skip return : False
foreign import ccall "g_unix_fd_message_steal_fds" g_unix_fd_message_steal_fds ::
Ptr UnixFDMessage -> -- _obj : TInterface "Gio" "UnixFDMessage"
Ptr Int32 -> -- length : TBasicType TInt32
IO (Ptr Int32)
unixFDMessageStealFds ::
(MonadIO m, UnixFDMessageK a) =>
a -> -- _obj
m [Int32]
unixFDMessageStealFds _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
length_ <- allocMem :: IO (Ptr Int32)
result <- g_unix_fd_message_steal_fds _obj' length_
length_' <- peek length_
checkUnexpectedReturnNULL "g_unix_fd_message_steal_fds" result
result' <- (unpackStorableArrayWithLength length_') result
freeMem result
touchManagedPtr _obj
freeMem length_
return result'