{- | 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.UnixOutputStream ( -- * Exported types UnixOutputStream(..) , UnixOutputStreamK , toUnixOutputStream , noUnixOutputStream , -- * Methods -- ** unixOutputStreamGetCloseFd unixOutputStreamGetCloseFd , -- ** unixOutputStreamGetFd unixOutputStreamGetFd , -- ** unixOutputStreamNew unixOutputStreamNew , -- ** unixOutputStreamSetCloseFd unixOutputStreamSetCloseFd , -- * Properties -- ** CloseFd UnixOutputStreamCloseFdPropertyInfo , constructUnixOutputStreamCloseFd , getUnixOutputStreamCloseFd , setUnixOutputStreamCloseFd , -- ** Fd UnixOutputStreamFdPropertyInfo , constructUnixOutputStreamFd , getUnixOutputStreamFd , ) 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 UnixOutputStream = UnixOutputStream (ForeignPtr UnixOutputStream) foreign import ccall "g_unix_output_stream_get_type" c_g_unix_output_stream_get_type :: IO GType type instance ParentTypes UnixOutputStream = UnixOutputStreamParentTypes type UnixOutputStreamParentTypes = '[OutputStream, GObject.Object, FileDescriptorBased, PollableOutputStream] instance GObject UnixOutputStream where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_unix_output_stream_get_type class GObject o => UnixOutputStreamK o instance (GObject o, IsDescendantOf UnixOutputStream o) => UnixOutputStreamK o toUnixOutputStream :: UnixOutputStreamK o => o -> IO UnixOutputStream toUnixOutputStream = unsafeCastTo UnixOutputStream noUnixOutputStream :: Maybe UnixOutputStream noUnixOutputStream = Nothing -- VVV Prop "close-fd" -- Type: TBasicType TBoolean -- Flags: [PropertyReadable,PropertyWritable] getUnixOutputStreamCloseFd :: (MonadIO m, UnixOutputStreamK o) => o -> m Bool getUnixOutputStreamCloseFd obj = liftIO $ getObjectPropertyBool obj "close-fd" setUnixOutputStreamCloseFd :: (MonadIO m, UnixOutputStreamK o) => o -> Bool -> m () setUnixOutputStreamCloseFd obj val = liftIO $ setObjectPropertyBool obj "close-fd" val constructUnixOutputStreamCloseFd :: Bool -> IO ([Char], GValue) constructUnixOutputStreamCloseFd val = constructObjectPropertyBool "close-fd" val data UnixOutputStreamCloseFdPropertyInfo instance AttrInfo UnixOutputStreamCloseFdPropertyInfo where type AttrAllowedOps UnixOutputStreamCloseFdPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint UnixOutputStreamCloseFdPropertyInfo = (~) Bool type AttrBaseTypeConstraint UnixOutputStreamCloseFdPropertyInfo = UnixOutputStreamK type AttrGetType UnixOutputStreamCloseFdPropertyInfo = Bool type AttrLabel UnixOutputStreamCloseFdPropertyInfo = "UnixOutputStream::close-fd" attrGet _ = getUnixOutputStreamCloseFd attrSet _ = setUnixOutputStreamCloseFd attrConstruct _ = constructUnixOutputStreamCloseFd -- VVV Prop "fd" -- Type: TBasicType TInt32 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getUnixOutputStreamFd :: (MonadIO m, UnixOutputStreamK o) => o -> m Int32 getUnixOutputStreamFd obj = liftIO $ getObjectPropertyCInt obj "fd" constructUnixOutputStreamFd :: Int32 -> IO ([Char], GValue) constructUnixOutputStreamFd val = constructObjectPropertyCInt "fd" val data UnixOutputStreamFdPropertyInfo instance AttrInfo UnixOutputStreamFdPropertyInfo where type AttrAllowedOps UnixOutputStreamFdPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint UnixOutputStreamFdPropertyInfo = (~) Int32 type AttrBaseTypeConstraint UnixOutputStreamFdPropertyInfo = UnixOutputStreamK type AttrGetType UnixOutputStreamFdPropertyInfo = Int32 type AttrLabel UnixOutputStreamFdPropertyInfo = "UnixOutputStream::fd" attrGet _ = getUnixOutputStreamFd attrSet _ = undefined attrConstruct _ = constructUnixOutputStreamFd type instance AttributeList UnixOutputStream = UnixOutputStreamAttributeList type UnixOutputStreamAttributeList = ('[ '("close-fd", UnixOutputStreamCloseFdPropertyInfo), '("fd", UnixOutputStreamFdPropertyInfo)] :: [(Symbol, *)]) type instance SignalList UnixOutputStream = UnixOutputStreamSignalList type UnixOutputStreamSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method UnixOutputStream::new -- method type : Constructor -- Args : [Arg {argName = "fd", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "close_fd", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "fd", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "close_fd", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "UnixOutputStream" -- throws : False -- Skip return : False foreign import ccall "g_unix_output_stream_new" g_unix_output_stream_new :: Int32 -> -- fd : TBasicType TInt32 CInt -> -- close_fd : TBasicType TBoolean IO (Ptr UnixOutputStream) unixOutputStreamNew :: (MonadIO m) => Int32 -> -- fd Bool -> -- close_fd m UnixOutputStream unixOutputStreamNew fd close_fd = liftIO $ do let close_fd' = (fromIntegral . fromEnum) close_fd result <- g_unix_output_stream_new fd close_fd' checkUnexpectedReturnNULL "g_unix_output_stream_new" result result' <- (wrapObject UnixOutputStream) result return result' -- method UnixOutputStream::get_close_fd -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_unix_output_stream_get_close_fd" g_unix_output_stream_get_close_fd :: Ptr UnixOutputStream -> -- _obj : TInterface "Gio" "UnixOutputStream" IO CInt unixOutputStreamGetCloseFd :: (MonadIO m, UnixOutputStreamK a) => a -> -- _obj m Bool unixOutputStreamGetCloseFd _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_unix_output_stream_get_close_fd _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method UnixOutputStream::get_fd -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_unix_output_stream_get_fd" g_unix_output_stream_get_fd :: Ptr UnixOutputStream -> -- _obj : TInterface "Gio" "UnixOutputStream" IO Int32 unixOutputStreamGetFd :: (MonadIO m, UnixOutputStreamK a) => a -> -- _obj m Int32 unixOutputStreamGetFd _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_unix_output_stream_get_fd _obj' touchManagedPtr _obj return result -- method UnixOutputStream::set_close_fd -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "close_fd", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "UnixOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "close_fd", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_unix_output_stream_set_close_fd" g_unix_output_stream_set_close_fd :: Ptr UnixOutputStream -> -- _obj : TInterface "Gio" "UnixOutputStream" CInt -> -- close_fd : TBasicType TBoolean IO () unixOutputStreamSetCloseFd :: (MonadIO m, UnixOutputStreamK a) => a -> -- _obj Bool -> -- close_fd m () unixOutputStreamSetCloseFd _obj close_fd = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let close_fd' = (fromIntegral . fromEnum) close_fd g_unix_output_stream_set_close_fd _obj' close_fd' touchManagedPtr _obj return ()