#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.TcpConnection
(
TcpConnection(..) ,
IsTcpConnection ,
toTcpConnection ,
noTcpConnection ,
#if ENABLE_OVERLOADING
TcpConnectionGetGracefulDisconnectMethodInfo,
#endif
tcpConnectionGetGracefulDisconnect ,
#if ENABLE_OVERLOADING
TcpConnectionSetGracefulDisconnectMethodInfo,
#endif
tcpConnectionSetGracefulDisconnect ,
#if ENABLE_OVERLOADING
TcpConnectionGracefulDisconnectPropertyInfo,
#endif
constructTcpConnectionGracefulDisconnect,
getTcpConnectionGracefulDisconnect ,
setTcpConnectionGracefulDisconnect ,
#if ENABLE_OVERLOADING
tcpConnectionGracefulDisconnect ,
#endif
) 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.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
newtype TcpConnection = TcpConnection (ManagedPtr TcpConnection)
foreign import ccall "g_tcp_connection_get_type"
c_g_tcp_connection_get_type :: IO GType
instance GObject TcpConnection where
gobjectType = c_g_tcp_connection_get_type
class (GObject o, O.IsDescendantOf TcpConnection o) => IsTcpConnection o
instance (GObject o, O.IsDescendantOf TcpConnection o) => IsTcpConnection o
instance O.HasParentTypes TcpConnection
type instance O.ParentTypes TcpConnection = '[Gio.SocketConnection.SocketConnection, Gio.IOStream.IOStream, GObject.Object.Object]
toTcpConnection :: (MonadIO m, IsTcpConnection o) => o -> m TcpConnection
toTcpConnection = liftIO . unsafeCastTo TcpConnection
noTcpConnection :: Maybe TcpConnection
noTcpConnection = Nothing
#if ENABLE_OVERLOADING
type family ResolveTcpConnectionMethod (t :: Symbol) (o :: *) :: * where
ResolveTcpConnectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveTcpConnectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveTcpConnectionMethod "clearPending" o = Gio.IOStream.IOStreamClearPendingMethodInfo
ResolveTcpConnectionMethod "close" o = Gio.IOStream.IOStreamCloseMethodInfo
ResolveTcpConnectionMethod "closeAsync" o = Gio.IOStream.IOStreamCloseAsyncMethodInfo
ResolveTcpConnectionMethod "closeFinish" o = Gio.IOStream.IOStreamCloseFinishMethodInfo
ResolveTcpConnectionMethod "connect" o = Gio.SocketConnection.SocketConnectionConnectMethodInfo
ResolveTcpConnectionMethod "connectAsync" o = Gio.SocketConnection.SocketConnectionConnectAsyncMethodInfo
ResolveTcpConnectionMethod "connectFinish" o = Gio.SocketConnection.SocketConnectionConnectFinishMethodInfo
ResolveTcpConnectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveTcpConnectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveTcpConnectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveTcpConnectionMethod "hasPending" o = Gio.IOStream.IOStreamHasPendingMethodInfo
ResolveTcpConnectionMethod "isClosed" o = Gio.IOStream.IOStreamIsClosedMethodInfo
ResolveTcpConnectionMethod "isConnected" o = Gio.SocketConnection.SocketConnectionIsConnectedMethodInfo
ResolveTcpConnectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveTcpConnectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveTcpConnectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveTcpConnectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveTcpConnectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveTcpConnectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveTcpConnectionMethod "spliceAsync" o = Gio.IOStream.IOStreamSpliceAsyncMethodInfo
ResolveTcpConnectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveTcpConnectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveTcpConnectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveTcpConnectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveTcpConnectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveTcpConnectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveTcpConnectionMethod "getGracefulDisconnect" o = TcpConnectionGetGracefulDisconnectMethodInfo
ResolveTcpConnectionMethod "getInputStream" o = Gio.IOStream.IOStreamGetInputStreamMethodInfo
ResolveTcpConnectionMethod "getLocalAddress" o = Gio.SocketConnection.SocketConnectionGetLocalAddressMethodInfo
ResolveTcpConnectionMethod "getOutputStream" o = Gio.IOStream.IOStreamGetOutputStreamMethodInfo
ResolveTcpConnectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveTcpConnectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveTcpConnectionMethod "getRemoteAddress" o = Gio.SocketConnection.SocketConnectionGetRemoteAddressMethodInfo
ResolveTcpConnectionMethod "getSocket" o = Gio.SocketConnection.SocketConnectionGetSocketMethodInfo
ResolveTcpConnectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveTcpConnectionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveTcpConnectionMethod "setGracefulDisconnect" o = TcpConnectionSetGracefulDisconnectMethodInfo
ResolveTcpConnectionMethod "setPending" o = Gio.IOStream.IOStreamSetPendingMethodInfo
ResolveTcpConnectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveTcpConnectionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTcpConnectionMethod t TcpConnection, O.MethodInfo info TcpConnection p) => OL.IsLabel t (TcpConnection -> 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
getTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> m Bool
getTcpConnectionGracefulDisconnect obj = liftIO $ B.Properties.getObjectPropertyBool obj "graceful-disconnect"
setTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> Bool -> m ()
setTcpConnectionGracefulDisconnect obj val = liftIO $ B.Properties.setObjectPropertyBool obj "graceful-disconnect" val
constructTcpConnectionGracefulDisconnect :: (IsTcpConnection o) => Bool -> IO (GValueConstruct o)
constructTcpConnectionGracefulDisconnect val = B.Properties.constructObjectPropertyBool "graceful-disconnect" val
#if ENABLE_OVERLOADING
data TcpConnectionGracefulDisconnectPropertyInfo
instance AttrInfo TcpConnectionGracefulDisconnectPropertyInfo where
type AttrAllowedOps TcpConnectionGracefulDisconnectPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint TcpConnectionGracefulDisconnectPropertyInfo = (~) Bool
type AttrBaseTypeConstraint TcpConnectionGracefulDisconnectPropertyInfo = IsTcpConnection
type AttrGetType TcpConnectionGracefulDisconnectPropertyInfo = Bool
type AttrLabel TcpConnectionGracefulDisconnectPropertyInfo = "graceful-disconnect"
type AttrOrigin TcpConnectionGracefulDisconnectPropertyInfo = TcpConnection
attrGet _ = getTcpConnectionGracefulDisconnect
attrSet _ = setTcpConnectionGracefulDisconnect
attrConstruct _ = constructTcpConnectionGracefulDisconnect
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList TcpConnection
type instance O.AttributeList TcpConnection = TcpConnectionAttributeList
type TcpConnectionAttributeList = ('[ '("closed", Gio.IOStream.IOStreamClosedPropertyInfo), '("gracefulDisconnect", TcpConnectionGracefulDisconnectPropertyInfo), '("inputStream", Gio.IOStream.IOStreamInputStreamPropertyInfo), '("outputStream", Gio.IOStream.IOStreamOutputStreamPropertyInfo), '("socket", Gio.SocketConnection.SocketConnectionSocketPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
tcpConnectionGracefulDisconnect :: AttrLabelProxy "gracefulDisconnect"
tcpConnectionGracefulDisconnect = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList TcpConnection = TcpConnectionSignalList
type TcpConnectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_tcp_connection_get_graceful_disconnect" g_tcp_connection_get_graceful_disconnect ::
Ptr TcpConnection ->
IO CInt
tcpConnectionGetGracefulDisconnect ::
(B.CallStack.HasCallStack, MonadIO m, IsTcpConnection a) =>
a
-> m Bool
tcpConnectionGetGracefulDisconnect connection = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
result <- g_tcp_connection_get_graceful_disconnect connection'
let result' = (/= 0) result
touchManagedPtr connection
return result'
#if ENABLE_OVERLOADING
data TcpConnectionGetGracefulDisconnectMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTcpConnection a) => O.MethodInfo TcpConnectionGetGracefulDisconnectMethodInfo a signature where
overloadedMethod _ = tcpConnectionGetGracefulDisconnect
#endif
foreign import ccall "g_tcp_connection_set_graceful_disconnect" g_tcp_connection_set_graceful_disconnect ::
Ptr TcpConnection ->
CInt ->
IO ()
tcpConnectionSetGracefulDisconnect ::
(B.CallStack.HasCallStack, MonadIO m, IsTcpConnection a) =>
a
-> Bool
-> m ()
tcpConnectionSetGracefulDisconnect connection gracefulDisconnect = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
let gracefulDisconnect' = (fromIntegral . fromEnum) gracefulDisconnect
g_tcp_connection_set_graceful_disconnect connection' gracefulDisconnect'
touchManagedPtr connection
return ()
#if ENABLE_OVERLOADING
data TcpConnectionSetGracefulDisconnectMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsTcpConnection a) => O.MethodInfo TcpConnectionSetGracefulDisconnectMethodInfo a signature where
overloadedMethod _ = tcpConnectionSetGracefulDisconnect
#endif