#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.SocketService
(
SocketService(..) ,
IsSocketService ,
toSocketService ,
noSocketService ,
#if ENABLE_OVERLOADING
SocketServiceIsActiveMethodInfo ,
#endif
socketServiceIsActive ,
socketServiceNew ,
#if ENABLE_OVERLOADING
SocketServiceStartMethodInfo ,
#endif
socketServiceStart ,
#if ENABLE_OVERLOADING
SocketServiceStopMethodInfo ,
#endif
socketServiceStop ,
#if ENABLE_OVERLOADING
SocketServiceActivePropertyInfo ,
#endif
constructSocketServiceActive ,
getSocketServiceActive ,
setSocketServiceActive ,
#if ENABLE_OVERLOADING
socketServiceActive ,
#endif
C_SocketServiceIncomingCallback ,
SocketServiceIncomingCallback ,
#if ENABLE_OVERLOADING
SocketServiceIncomingSignalInfo ,
#endif
afterSocketServiceIncoming ,
genClosure_SocketServiceIncoming ,
mk_SocketServiceIncomingCallback ,
noSocketServiceIncomingCallback ,
onSocketServiceIncoming ,
wrap_SocketServiceIncomingCallback ,
) 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.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
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketListener as Gio.SocketListener
newtype SocketService = SocketService (ManagedPtr SocketService)
foreign import ccall "g_socket_service_get_type"
c_g_socket_service_get_type :: IO GType
instance GObject SocketService where
gobjectType = c_g_socket_service_get_type
class (GObject o, O.IsDescendantOf SocketService o) => IsSocketService o
instance (GObject o, O.IsDescendantOf SocketService o) => IsSocketService o
instance O.HasParentTypes SocketService
type instance O.ParentTypes SocketService = '[Gio.SocketListener.SocketListener, GObject.Object.Object]
toSocketService :: (MonadIO m, IsSocketService o) => o -> m SocketService
toSocketService = liftIO . unsafeCastTo SocketService
noSocketService :: Maybe SocketService
noSocketService = Nothing
#if ENABLE_OVERLOADING
type family ResolveSocketServiceMethod (t :: Symbol) (o :: *) :: * where
ResolveSocketServiceMethod "accept" o = Gio.SocketListener.SocketListenerAcceptMethodInfo
ResolveSocketServiceMethod "acceptAsync" o = Gio.SocketListener.SocketListenerAcceptAsyncMethodInfo
ResolveSocketServiceMethod "acceptFinish" o = Gio.SocketListener.SocketListenerAcceptFinishMethodInfo
ResolveSocketServiceMethod "acceptSocket" o = Gio.SocketListener.SocketListenerAcceptSocketMethodInfo
ResolveSocketServiceMethod "acceptSocketAsync" o = Gio.SocketListener.SocketListenerAcceptSocketAsyncMethodInfo
ResolveSocketServiceMethod "acceptSocketFinish" o = Gio.SocketListener.SocketListenerAcceptSocketFinishMethodInfo
ResolveSocketServiceMethod "addAddress" o = Gio.SocketListener.SocketListenerAddAddressMethodInfo
ResolveSocketServiceMethod "addAnyInetPort" o = Gio.SocketListener.SocketListenerAddAnyInetPortMethodInfo
ResolveSocketServiceMethod "addInetPort" o = Gio.SocketListener.SocketListenerAddInetPortMethodInfo
ResolveSocketServiceMethod "addSocket" o = Gio.SocketListener.SocketListenerAddSocketMethodInfo
ResolveSocketServiceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSocketServiceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSocketServiceMethod "close" o = Gio.SocketListener.SocketListenerCloseMethodInfo
ResolveSocketServiceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSocketServiceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSocketServiceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSocketServiceMethod "isActive" o = SocketServiceIsActiveMethodInfo
ResolveSocketServiceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSocketServiceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSocketServiceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSocketServiceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSocketServiceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSocketServiceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSocketServiceMethod "start" o = SocketServiceStartMethodInfo
ResolveSocketServiceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSocketServiceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSocketServiceMethod "stop" o = SocketServiceStopMethodInfo
ResolveSocketServiceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSocketServiceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSocketServiceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSocketServiceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSocketServiceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSocketServiceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSocketServiceMethod "setBacklog" o = Gio.SocketListener.SocketListenerSetBacklogMethodInfo
ResolveSocketServiceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSocketServiceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSocketServiceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSocketServiceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSocketServiceMethod t SocketService, O.MethodInfo info SocketService p) => OL.IsLabel t (SocketService -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
type SocketServiceIncomingCallback =
Gio.SocketConnection.SocketConnection
-> Maybe GObject.Object.Object
-> IO Bool
noSocketServiceIncomingCallback :: Maybe SocketServiceIncomingCallback
noSocketServiceIncomingCallback = Nothing
type C_SocketServiceIncomingCallback =
Ptr () ->
Ptr Gio.SocketConnection.SocketConnection ->
Ptr GObject.Object.Object ->
Ptr () ->
IO CInt
foreign import ccall "wrapper"
mk_SocketServiceIncomingCallback :: C_SocketServiceIncomingCallback -> IO (FunPtr C_SocketServiceIncomingCallback)
genClosure_SocketServiceIncoming :: MonadIO m => SocketServiceIncomingCallback -> m (GClosure C_SocketServiceIncomingCallback)
genClosure_SocketServiceIncoming cb = liftIO $ do
let cb' = wrap_SocketServiceIncomingCallback cb
mk_SocketServiceIncomingCallback cb' >>= B.GClosure.newGClosure
wrap_SocketServiceIncomingCallback ::
SocketServiceIncomingCallback ->
C_SocketServiceIncomingCallback
wrap_SocketServiceIncomingCallback _cb _ connection sourceObject _ = do
connection' <- (newObject Gio.SocketConnection.SocketConnection) connection
maybeSourceObject <-
if sourceObject == nullPtr
then return Nothing
else do
sourceObject' <- (newObject GObject.Object.Object) sourceObject
return $ Just sourceObject'
result <- _cb connection' maybeSourceObject
let result' = (fromIntegral . fromEnum) result
return result'
onSocketServiceIncoming :: (IsSocketService a, MonadIO m) => a -> SocketServiceIncomingCallback -> m SignalHandlerId
onSocketServiceIncoming obj cb = liftIO $ do
let cb' = wrap_SocketServiceIncomingCallback cb
cb'' <- mk_SocketServiceIncomingCallback cb'
connectSignalFunPtr obj "incoming" cb'' SignalConnectBefore
afterSocketServiceIncoming :: (IsSocketService a, MonadIO m) => a -> SocketServiceIncomingCallback -> m SignalHandlerId
afterSocketServiceIncoming obj cb = liftIO $ do
let cb' = wrap_SocketServiceIncomingCallback cb
cb'' <- mk_SocketServiceIncomingCallback cb'
connectSignalFunPtr obj "incoming" cb'' SignalConnectAfter
getSocketServiceActive :: (MonadIO m, IsSocketService o) => o -> m Bool
getSocketServiceActive obj = liftIO $ B.Properties.getObjectPropertyBool obj "active"
setSocketServiceActive :: (MonadIO m, IsSocketService o) => o -> Bool -> m ()
setSocketServiceActive obj val = liftIO $ B.Properties.setObjectPropertyBool obj "active" val
constructSocketServiceActive :: (IsSocketService o) => Bool -> IO (GValueConstruct o)
constructSocketServiceActive val = B.Properties.constructObjectPropertyBool "active" val
#if ENABLE_OVERLOADING
data SocketServiceActivePropertyInfo
instance AttrInfo SocketServiceActivePropertyInfo where
type AttrAllowedOps SocketServiceActivePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint SocketServiceActivePropertyInfo = (~) Bool
type AttrBaseTypeConstraint SocketServiceActivePropertyInfo = IsSocketService
type AttrGetType SocketServiceActivePropertyInfo = Bool
type AttrLabel SocketServiceActivePropertyInfo = "active"
type AttrOrigin SocketServiceActivePropertyInfo = SocketService
attrGet _ = getSocketServiceActive
attrSet _ = setSocketServiceActive
attrConstruct _ = constructSocketServiceActive
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList SocketService
type instance O.AttributeList SocketService = SocketServiceAttributeList
type SocketServiceAttributeList = ('[ '("active", SocketServiceActivePropertyInfo), '("listenBacklog", Gio.SocketListener.SocketListenerListenBacklogPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
socketServiceActive :: AttrLabelProxy "active"
socketServiceActive = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data SocketServiceIncomingSignalInfo
instance SignalInfo SocketServiceIncomingSignalInfo where
type HaskellCallbackType SocketServiceIncomingSignalInfo = SocketServiceIncomingCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_SocketServiceIncomingCallback cb
cb'' <- mk_SocketServiceIncomingCallback cb'
connectSignalFunPtr obj "incoming" cb'' connectMode
type instance O.SignalList SocketService = SocketServiceSignalList
type SocketServiceSignalList = ('[ '("event", Gio.SocketListener.SocketListenerEventSignalInfo), '("incoming", SocketServiceIncomingSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_socket_service_new" g_socket_service_new ::
IO (Ptr SocketService)
socketServiceNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m SocketService
socketServiceNew = liftIO $ do
result <- g_socket_service_new
checkUnexpectedReturnNULL "socketServiceNew" result
result' <- (wrapObject SocketService) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_socket_service_is_active" g_socket_service_is_active ::
Ptr SocketService ->
IO CInt
socketServiceIsActive ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketService a) =>
a
-> m Bool
socketServiceIsActive service = liftIO $ do
service' <- unsafeManagedPtrCastPtr service
result <- g_socket_service_is_active service'
let result' = (/= 0) result
touchManagedPtr service
return result'
#if ENABLE_OVERLOADING
data SocketServiceIsActiveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocketService a) => O.MethodInfo SocketServiceIsActiveMethodInfo a signature where
overloadedMethod _ = socketServiceIsActive
#endif
foreign import ccall "g_socket_service_start" g_socket_service_start ::
Ptr SocketService ->
IO ()
socketServiceStart ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketService a) =>
a
-> m ()
socketServiceStart service = liftIO $ do
service' <- unsafeManagedPtrCastPtr service
g_socket_service_start service'
touchManagedPtr service
return ()
#if ENABLE_OVERLOADING
data SocketServiceStartMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocketService a) => O.MethodInfo SocketServiceStartMethodInfo a signature where
overloadedMethod _ = socketServiceStart
#endif
foreign import ccall "g_socket_service_stop" g_socket_service_stop ::
Ptr SocketService ->
IO ()
socketServiceStop ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketService a) =>
a
-> m ()
socketServiceStop service = liftIO $ do
service' <- unsafeManagedPtrCastPtr service
g_socket_service_stop service'
touchManagedPtr service
return ()
#if ENABLE_OVERLOADING
data SocketServiceStopMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocketService a) => O.MethodInfo SocketServiceStopMethodInfo a signature where
overloadedMethod _ = socketServiceStop
#endif