#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.SocketAddress
(
SocketAddress(..) ,
IsSocketAddress ,
toSocketAddress ,
noSocketAddress ,
#if ENABLE_OVERLOADING
SocketAddressGetFamilyMethodInfo ,
#endif
socketAddressGetFamily ,
#if ENABLE_OVERLOADING
SocketAddressGetNativeSizeMethodInfo ,
#endif
socketAddressGetNativeSize ,
socketAddressNewFromNative ,
#if ENABLE_OVERLOADING
SocketAddressToNativeMethodInfo ,
#endif
socketAddressToNative ,
#if ENABLE_OVERLOADING
SocketAddressFamilyPropertyInfo ,
#endif
getSocketAddressFamily ,
#if ENABLE_OVERLOADING
socketAddressFamily ,
#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.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
newtype SocketAddress = SocketAddress (ManagedPtr SocketAddress)
foreign import ccall "g_socket_address_get_type"
c_g_socket_address_get_type :: IO GType
instance GObject SocketAddress where
gobjectType = c_g_socket_address_get_type
class (GObject o, O.IsDescendantOf SocketAddress o) => IsSocketAddress o
instance (GObject o, O.IsDescendantOf SocketAddress o) => IsSocketAddress o
instance O.HasParentTypes SocketAddress
type instance O.ParentTypes SocketAddress = '[GObject.Object.Object, Gio.SocketConnectable.SocketConnectable]
toSocketAddress :: (MonadIO m, IsSocketAddress o) => o -> m SocketAddress
toSocketAddress = liftIO . unsafeCastTo SocketAddress
noSocketAddress :: Maybe SocketAddress
noSocketAddress = Nothing
#if ENABLE_OVERLOADING
type family ResolveSocketAddressMethod (t :: Symbol) (o :: *) :: * where
ResolveSocketAddressMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSocketAddressMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSocketAddressMethod "enumerate" o = Gio.SocketConnectable.SocketConnectableEnumerateMethodInfo
ResolveSocketAddressMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSocketAddressMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSocketAddressMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSocketAddressMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSocketAddressMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSocketAddressMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSocketAddressMethod "proxyEnumerate" o = Gio.SocketConnectable.SocketConnectableProxyEnumerateMethodInfo
ResolveSocketAddressMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSocketAddressMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSocketAddressMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSocketAddressMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSocketAddressMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSocketAddressMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSocketAddressMethod "toNative" o = SocketAddressToNativeMethodInfo
ResolveSocketAddressMethod "toString" o = Gio.SocketConnectable.SocketConnectableToStringMethodInfo
ResolveSocketAddressMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSocketAddressMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSocketAddressMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSocketAddressMethod "getFamily" o = SocketAddressGetFamilyMethodInfo
ResolveSocketAddressMethod "getNativeSize" o = SocketAddressGetNativeSizeMethodInfo
ResolveSocketAddressMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSocketAddressMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSocketAddressMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSocketAddressMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSocketAddressMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSocketAddressMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSocketAddressMethod t SocketAddress, O.MethodInfo info SocketAddress p) => OL.IsLabel t (SocketAddress -> 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
getSocketAddressFamily :: (MonadIO m, IsSocketAddress o) => o -> m Gio.Enums.SocketFamily
getSocketAddressFamily obj = liftIO $ B.Properties.getObjectPropertyEnum obj "family"
#if ENABLE_OVERLOADING
data SocketAddressFamilyPropertyInfo
instance AttrInfo SocketAddressFamilyPropertyInfo where
type AttrAllowedOps SocketAddressFamilyPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint SocketAddressFamilyPropertyInfo = (~) ()
type AttrBaseTypeConstraint SocketAddressFamilyPropertyInfo = IsSocketAddress
type AttrGetType SocketAddressFamilyPropertyInfo = Gio.Enums.SocketFamily
type AttrLabel SocketAddressFamilyPropertyInfo = "family"
type AttrOrigin SocketAddressFamilyPropertyInfo = SocketAddress
attrGet _ = getSocketAddressFamily
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList SocketAddress
type instance O.AttributeList SocketAddress = SocketAddressAttributeList
type SocketAddressAttributeList = ('[ '("family", SocketAddressFamilyPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
socketAddressFamily :: AttrLabelProxy "family"
socketAddressFamily = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList SocketAddress = SocketAddressSignalList
type SocketAddressSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_socket_address_new_from_native" g_socket_address_new_from_native ::
Ptr () ->
Word64 ->
IO (Ptr SocketAddress)
socketAddressNewFromNative ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> Word64
-> m SocketAddress
socketAddressNewFromNative native len = liftIO $ do
result <- g_socket_address_new_from_native native len
checkUnexpectedReturnNULL "socketAddressNewFromNative" result
result' <- (wrapObject SocketAddress) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_socket_address_get_family" g_socket_address_get_family ::
Ptr SocketAddress ->
IO CUInt
socketAddressGetFamily ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketAddress a) =>
a
-> m Gio.Enums.SocketFamily
socketAddressGetFamily address = liftIO $ do
address' <- unsafeManagedPtrCastPtr address
result <- g_socket_address_get_family address'
let result' = (toEnum . fromIntegral) result
touchManagedPtr address
return result'
#if ENABLE_OVERLOADING
data SocketAddressGetFamilyMethodInfo
instance (signature ~ (m Gio.Enums.SocketFamily), MonadIO m, IsSocketAddress a) => O.MethodInfo SocketAddressGetFamilyMethodInfo a signature where
overloadedMethod _ = socketAddressGetFamily
#endif
foreign import ccall "g_socket_address_get_native_size" g_socket_address_get_native_size ::
Ptr SocketAddress ->
IO Int64
socketAddressGetNativeSize ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketAddress a) =>
a
-> m Int64
socketAddressGetNativeSize address = liftIO $ do
address' <- unsafeManagedPtrCastPtr address
result <- g_socket_address_get_native_size address'
touchManagedPtr address
return result
#if ENABLE_OVERLOADING
data SocketAddressGetNativeSizeMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsSocketAddress a) => O.MethodInfo SocketAddressGetNativeSizeMethodInfo a signature where
overloadedMethod _ = socketAddressGetNativeSize
#endif
foreign import ccall "g_socket_address_to_native" g_socket_address_to_native ::
Ptr SocketAddress ->
Ptr () ->
Word64 ->
Ptr (Ptr GError) ->
IO CInt
socketAddressToNative ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketAddress a) =>
a
-> Ptr ()
-> Word64
-> m ()
socketAddressToNative address dest destlen = liftIO $ do
address' <- unsafeManagedPtrCastPtr address
onException (do
_ <- propagateGError $ g_socket_address_to_native address' dest destlen
touchManagedPtr address
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data SocketAddressToNativeMethodInfo
instance (signature ~ (Ptr () -> Word64 -> m ()), MonadIO m, IsSocketAddress a) => O.MethodInfo SocketAddressToNativeMethodInfo a signature where
overloadedMethod _ = socketAddressToNative
#endif