{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.UnixFDList
(
UnixFDList(..) ,
IsUnixFDList ,
toUnixFDList ,
noUnixFDList ,
#if defined(ENABLE_OVERLOADING)
ResolveUnixFDListMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
UnixFDListAppendMethodInfo ,
#endif
unixFDListAppend ,
#if defined(ENABLE_OVERLOADING)
UnixFDListGetMethodInfo ,
#endif
unixFDListGet ,
#if defined(ENABLE_OVERLOADING)
UnixFDListGetLengthMethodInfo ,
#endif
unixFDListGetLength ,
unixFDListNew ,
unixFDListNewFromArray ,
#if defined(ENABLE_OVERLOADING)
UnixFDListPeekFdsMethodInfo ,
#endif
unixFDListPeekFds ,
#if defined(ENABLE_OVERLOADING)
UnixFDListStealFdsMethodInfo ,
#endif
unixFDListStealFds ,
) 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.GClosure as B.GClosure
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.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
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 GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
newtype UnixFDList = UnixFDList (ManagedPtr UnixFDList)
deriving (UnixFDList -> UnixFDList -> Bool
(UnixFDList -> UnixFDList -> Bool)
-> (UnixFDList -> UnixFDList -> Bool) -> Eq UnixFDList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnixFDList -> UnixFDList -> Bool
$c/= :: UnixFDList -> UnixFDList -> Bool
== :: UnixFDList -> UnixFDList -> Bool
$c== :: UnixFDList -> UnixFDList -> Bool
Eq)
foreign import ccall "g_unix_fd_list_get_type"
c_g_unix_fd_list_get_type :: IO GType
instance GObject UnixFDList where
gobjectType :: IO GType
gobjectType = IO GType
c_g_unix_fd_list_get_type
instance B.GValue.IsGValue UnixFDList where
toGValue :: UnixFDList -> IO GValue
toGValue o :: UnixFDList
o = do
GType
gtype <- IO GType
c_g_unix_fd_list_get_type
UnixFDList -> (Ptr UnixFDList -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr UnixFDList
o (GType
-> (GValue -> Ptr UnixFDList -> IO ())
-> Ptr UnixFDList
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr UnixFDList -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO UnixFDList
fromGValue gv :: GValue
gv = do
Ptr UnixFDList
ptr <- GValue -> IO (Ptr UnixFDList)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr UnixFDList)
(ManagedPtr UnixFDList -> UnixFDList)
-> Ptr UnixFDList -> IO UnixFDList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr UnixFDList -> UnixFDList
UnixFDList Ptr UnixFDList
ptr
class (GObject o, O.IsDescendantOf UnixFDList o) => IsUnixFDList o
instance (GObject o, O.IsDescendantOf UnixFDList o) => IsUnixFDList o
instance O.HasParentTypes UnixFDList
type instance O.ParentTypes UnixFDList = '[GObject.Object.Object]
toUnixFDList :: (MonadIO m, IsUnixFDList o) => o -> m UnixFDList
toUnixFDList :: o -> m UnixFDList
toUnixFDList = IO UnixFDList -> m UnixFDList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixFDList -> m UnixFDList)
-> (o -> IO UnixFDList) -> o -> m UnixFDList
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr UnixFDList -> UnixFDList) -> o -> IO UnixFDList
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr UnixFDList -> UnixFDList
UnixFDList
noUnixFDList :: Maybe UnixFDList
noUnixFDList :: Maybe UnixFDList
noUnixFDList = Maybe UnixFDList
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveUnixFDListMethod (t :: Symbol) (o :: *) :: * where
ResolveUnixFDListMethod "append" o = UnixFDListAppendMethodInfo
ResolveUnixFDListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveUnixFDListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveUnixFDListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveUnixFDListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveUnixFDListMethod "get" o = UnixFDListGetMethodInfo
ResolveUnixFDListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveUnixFDListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveUnixFDListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveUnixFDListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveUnixFDListMethod "peekFds" o = UnixFDListPeekFdsMethodInfo
ResolveUnixFDListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveUnixFDListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveUnixFDListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveUnixFDListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveUnixFDListMethod "stealFds" o = UnixFDListStealFdsMethodInfo
ResolveUnixFDListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveUnixFDListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveUnixFDListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveUnixFDListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveUnixFDListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveUnixFDListMethod "getLength" o = UnixFDListGetLengthMethodInfo
ResolveUnixFDListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveUnixFDListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveUnixFDListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveUnixFDListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveUnixFDListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveUnixFDListMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveUnixFDListMethod t UnixFDList, O.MethodInfo info UnixFDList p) => OL.IsLabel t (UnixFDList -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList UnixFDList
type instance O.AttributeList UnixFDList = UnixFDListAttributeList
type UnixFDListAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList UnixFDList = UnixFDListSignalList
type UnixFDListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_unix_fd_list_new" g_unix_fd_list_new ::
IO (Ptr UnixFDList)
unixFDListNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m UnixFDList
unixFDListNew :: m UnixFDList
unixFDListNew = IO UnixFDList -> m UnixFDList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixFDList -> m UnixFDList) -> IO UnixFDList -> m UnixFDList
forall a b. (a -> b) -> a -> b
$ do
Ptr UnixFDList
result <- IO (Ptr UnixFDList)
g_unix_fd_list_new
Text -> Ptr UnixFDList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixFDListNew" Ptr UnixFDList
result
UnixFDList
result' <- ((ManagedPtr UnixFDList -> UnixFDList)
-> Ptr UnixFDList -> IO UnixFDList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr UnixFDList -> UnixFDList
UnixFDList) Ptr UnixFDList
result
UnixFDList -> IO UnixFDList
forall (m :: * -> *) a. Monad m => a -> m a
return UnixFDList
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_unix_fd_list_new_from_array" g_unix_fd_list_new_from_array ::
Ptr Int32 ->
Int32 ->
IO (Ptr UnixFDList)
unixFDListNewFromArray ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Int32]
-> m UnixFDList
unixFDListNewFromArray :: [Int32] -> m UnixFDList
unixFDListNewFromArray fds :: [Int32]
fds = IO UnixFDList -> m UnixFDList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixFDList -> m UnixFDList) -> IO UnixFDList -> m UnixFDList
forall a b. (a -> b) -> a -> b
$ do
let nFds :: Int32
nFds = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Int32] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Int32]
fds
Ptr Int32
fds' <- [Int32] -> IO (Ptr Int32)
forall a. Storable a => [a] -> IO (Ptr a)
packStorableArray [Int32]
fds
Ptr UnixFDList
result <- Ptr Int32 -> Int32 -> IO (Ptr UnixFDList)
g_unix_fd_list_new_from_array Ptr Int32
fds' Int32
nFds
Text -> Ptr UnixFDList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixFDListNewFromArray" Ptr UnixFDList
result
UnixFDList
result' <- ((ManagedPtr UnixFDList -> UnixFDList)
-> Ptr UnixFDList -> IO UnixFDList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr UnixFDList -> UnixFDList
UnixFDList) Ptr UnixFDList
result
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
fds'
UnixFDList -> IO UnixFDList
forall (m :: * -> *) a. Monad m => a -> m a
return UnixFDList
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_unix_fd_list_append" g_unix_fd_list_append ::
Ptr UnixFDList ->
Int32 ->
Ptr (Ptr GError) ->
IO Int32
unixFDListAppend ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixFDList a) =>
a
-> Int32
-> m Int32
unixFDListAppend :: a -> Int32 -> m Int32
unixFDListAppend list :: a
list fd :: Int32
fd = 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
$ do
Ptr UnixFDList
list' <- a -> IO (Ptr UnixFDList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
Int32
result <- (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int32) -> IO Int32)
-> (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ Ptr UnixFDList -> Int32 -> Ptr (Ptr GError) -> IO Int32
g_unix_fd_list_append Ptr UnixFDList
list' Int32
fd
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixFDListAppendMethodInfo
instance (signature ~ (Int32 -> m Int32), MonadIO m, IsUnixFDList a) => O.MethodInfo UnixFDListAppendMethodInfo a signature where
overloadedMethod = unixFDListAppend
#endif
foreign import ccall "g_unix_fd_list_get" g_unix_fd_list_get ::
Ptr UnixFDList ->
Int32 ->
Ptr (Ptr GError) ->
IO Int32
unixFDListGet ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixFDList a) =>
a
-> Int32
-> m Int32
unixFDListGet :: a -> Int32 -> m Int32
unixFDListGet list :: a
list index_ :: Int32
index_ = 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
$ do
Ptr UnixFDList
list' <- a -> IO (Ptr UnixFDList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
Int32
result <- (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int32) -> IO Int32)
-> (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ Ptr UnixFDList -> Int32 -> Ptr (Ptr GError) -> IO Int32
g_unix_fd_list_get Ptr UnixFDList
list' Int32
index_
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixFDListGetMethodInfo
instance (signature ~ (Int32 -> m Int32), MonadIO m, IsUnixFDList a) => O.MethodInfo UnixFDListGetMethodInfo a signature where
overloadedMethod = unixFDListGet
#endif
foreign import ccall "g_unix_fd_list_get_length" g_unix_fd_list_get_length ::
Ptr UnixFDList ->
IO Int32
unixFDListGetLength ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixFDList a) =>
a
-> m Int32
unixFDListGetLength :: a -> m Int32
unixFDListGetLength list :: a
list = 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
$ do
Ptr UnixFDList
list' <- a -> IO (Ptr UnixFDList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Int32
result <- Ptr UnixFDList -> IO Int32
g_unix_fd_list_get_length Ptr UnixFDList
list'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data UnixFDListGetLengthMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsUnixFDList a) => O.MethodInfo UnixFDListGetLengthMethodInfo a signature where
overloadedMethod = unixFDListGetLength
#endif
foreign import ccall "g_unix_fd_list_peek_fds" g_unix_fd_list_peek_fds ::
Ptr UnixFDList ->
Ptr Int32 ->
IO (Ptr Int32)
unixFDListPeekFds ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixFDList a) =>
a
-> m [Int32]
unixFDListPeekFds :: a -> m [Int32]
unixFDListPeekFds list :: a
list = 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
$ do
Ptr UnixFDList
list' <- a -> IO (Ptr UnixFDList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Ptr Int32
length_ <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Int32
result <- Ptr UnixFDList -> Ptr Int32 -> IO (Ptr Int32)
g_unix_fd_list_peek_fds Ptr UnixFDList
list' Ptr Int32
length_
Int32
length_' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
length_
Text -> Ptr Int32 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixFDListPeekFds" Ptr Int32
result
[Int32]
result' <- (Int32 -> Ptr Int32 -> IO [Int32]
forall a b. (Integral a, Storable b) => a -> Ptr b -> IO [b]
unpackStorableArrayWithLength Int32
length_') Ptr Int32
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
length_
[Int32] -> IO [Int32]
forall (m :: * -> *) a. Monad m => a -> m a
return [Int32]
result'
#if defined(ENABLE_OVERLOADING)
data UnixFDListPeekFdsMethodInfo
instance (signature ~ (m [Int32]), MonadIO m, IsUnixFDList a) => O.MethodInfo UnixFDListPeekFdsMethodInfo a signature where
overloadedMethod = unixFDListPeekFds
#endif
foreign import ccall "g_unix_fd_list_steal_fds" g_unix_fd_list_steal_fds ::
Ptr UnixFDList ->
Ptr Int32 ->
IO (Ptr Int32)
unixFDListStealFds ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixFDList a) =>
a
-> m [Int32]
unixFDListStealFds :: a -> m [Int32]
unixFDListStealFds list :: a
list = 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
$ do
Ptr UnixFDList
list' <- a -> IO (Ptr UnixFDList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Ptr Int32
length_ <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Int32
result <- Ptr UnixFDList -> Ptr Int32 -> IO (Ptr Int32)
g_unix_fd_list_steal_fds Ptr UnixFDList
list' Ptr Int32
length_
Int32
length_' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
length_
Text -> Ptr Int32 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixFDListStealFds" Ptr Int32
result
[Int32]
result' <- (Int32 -> Ptr Int32 -> IO [Int32]
forall a b. (Integral a, Storable b) => a -> Ptr b -> IO [b]
unpackStorableArrayWithLength Int32
length_') Ptr Int32
result
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
length_
[Int32] -> IO [Int32]
forall (m :: * -> *) a. Monad m => a -> m a
return [Int32]
result'
#if defined(ENABLE_OVERLOADING)
data UnixFDListStealFdsMethodInfo
instance (signature ~ (m [Int32]), MonadIO m, IsUnixFDList a) => O.MethodInfo UnixFDListStealFdsMethodInfo a signature where
overloadedMethod = unixFDListStealFds
#endif