gi-gio-0.2.46.12: GI/Gio/Objects/SocketAddressEnumerator.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.SocketAddressEnumerator
(
-- * Exported types
SocketAddressEnumerator(..) ,
SocketAddressEnumeratorK ,
toSocketAddressEnumerator ,
noSocketAddressEnumerator ,
-- * Methods
-- ** socketAddressEnumeratorNext
socketAddressEnumeratorNext ,
-- ** socketAddressEnumeratorNextAsync
socketAddressEnumeratorNextAsync ,
-- ** socketAddressEnumeratorNextFinish
socketAddressEnumeratorNextFinish ,
) 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 SocketAddressEnumerator = SocketAddressEnumerator (ForeignPtr SocketAddressEnumerator)
foreign import ccall "g_socket_address_enumerator_get_type"
c_g_socket_address_enumerator_get_type :: IO GType
type instance ParentTypes SocketAddressEnumerator = SocketAddressEnumeratorParentTypes
type SocketAddressEnumeratorParentTypes = '[GObject.Object]
instance GObject SocketAddressEnumerator where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_socket_address_enumerator_get_type
class GObject o => SocketAddressEnumeratorK o
instance (GObject o, IsDescendantOf SocketAddressEnumerator o) => SocketAddressEnumeratorK o
toSocketAddressEnumerator :: SocketAddressEnumeratorK o => o -> IO SocketAddressEnumerator
toSocketAddressEnumerator = unsafeCastTo SocketAddressEnumerator
noSocketAddressEnumerator :: Maybe SocketAddressEnumerator
noSocketAddressEnumerator = Nothing
type instance AttributeList SocketAddressEnumerator = SocketAddressEnumeratorAttributeList
type SocketAddressEnumeratorAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList SocketAddressEnumerator = SocketAddressEnumeratorSignalList
type SocketAddressEnumeratorSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method SocketAddressEnumerator::next
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "SocketAddress"
-- throws : True
-- Skip return : False
foreign import ccall "g_socket_address_enumerator_next" g_socket_address_enumerator_next ::
Ptr SocketAddressEnumerator -> -- _obj : TInterface "Gio" "SocketAddressEnumerator"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
Ptr (Ptr GError) -> -- error
IO (Ptr SocketAddress)
socketAddressEnumeratorNext ::
(MonadIO m, SocketAddressEnumeratorK a, CancellableK b) =>
a -> -- _obj
Maybe (b) -> -- cancellable
m SocketAddress
socketAddressEnumeratorNext _obj cancellable = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_address_enumerator_next _obj' maybeCancellable
checkUnexpectedReturnNULL "g_socket_address_enumerator_next" result
result' <- (wrapObject SocketAddress) result
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
-- method SocketAddressEnumerator::next_async
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_socket_address_enumerator_next_async" g_socket_address_enumerator_next_async ::
Ptr SocketAddressEnumerator -> -- _obj : TInterface "Gio" "SocketAddressEnumerator"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
socketAddressEnumeratorNextAsync ::
(MonadIO m, SocketAddressEnumeratorK a, CancellableK b) =>
a -> -- _obj
Maybe (b) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
socketAddressEnumeratorNextAsync _obj cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_socket_address_enumerator_next_async _obj' maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
return ()
-- method SocketAddressEnumerator::next_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddressEnumerator", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "SocketAddress"
-- throws : True
-- Skip return : False
foreign import ccall "g_socket_address_enumerator_next_finish" g_socket_address_enumerator_next_finish ::
Ptr SocketAddressEnumerator -> -- _obj : TInterface "Gio" "SocketAddressEnumerator"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO (Ptr SocketAddress)
socketAddressEnumeratorNextFinish ::
(MonadIO m, SocketAddressEnumeratorK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m SocketAddress
socketAddressEnumeratorNextFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_socket_address_enumerator_next_finish _obj' result_'
checkUnexpectedReturnNULL "g_socket_address_enumerator_next_finish" result
result' <- (wrapObject SocketAddress) result
touchManagedPtr _obj
touchManagedPtr result_
return result'
) (do
return ()
)