{- | 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.SocketAddress ( -- * Exported types SocketAddress(..) , SocketAddressK , toSocketAddress , noSocketAddress , -- * Methods -- ** socketAddressGetFamily socketAddressGetFamily , -- ** socketAddressGetNativeSize socketAddressGetNativeSize , -- ** socketAddressNewFromNative socketAddressNewFromNative , -- ** socketAddressToNative socketAddressToNative , -- * Properties -- ** Family SocketAddressFamilyPropertyInfo , getSocketAddressFamily , ) 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 SocketAddress = SocketAddress (ForeignPtr SocketAddress) foreign import ccall "g_socket_address_get_type" c_g_socket_address_get_type :: IO GType type instance ParentTypes SocketAddress = SocketAddressParentTypes type SocketAddressParentTypes = '[GObject.Object, SocketConnectable] instance GObject SocketAddress where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_socket_address_get_type class GObject o => SocketAddressK o instance (GObject o, IsDescendantOf SocketAddress o) => SocketAddressK o toSocketAddress :: SocketAddressK o => o -> IO SocketAddress toSocketAddress = unsafeCastTo SocketAddress noSocketAddress :: Maybe SocketAddress noSocketAddress = Nothing -- VVV Prop "family" -- Type: TInterface "Gio" "SocketFamily" -- Flags: [PropertyReadable] getSocketAddressFamily :: (MonadIO m, SocketAddressK o) => o -> m SocketFamily getSocketAddressFamily obj = liftIO $ getObjectPropertyEnum obj "family" data SocketAddressFamilyPropertyInfo instance AttrInfo SocketAddressFamilyPropertyInfo where type AttrAllowedOps SocketAddressFamilyPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint SocketAddressFamilyPropertyInfo = (~) () type AttrBaseTypeConstraint SocketAddressFamilyPropertyInfo = SocketAddressK type AttrGetType SocketAddressFamilyPropertyInfo = SocketFamily type AttrLabel SocketAddressFamilyPropertyInfo = "SocketAddress::family" attrGet _ = getSocketAddressFamily attrSet _ = undefined attrConstruct _ = undefined type instance AttributeList SocketAddress = SocketAddressAttributeList type SocketAddressAttributeList = ('[ '("family", SocketAddressFamilyPropertyInfo)] :: [(Symbol, *)]) type instance SignalList SocketAddress = SocketAddressSignalList type SocketAddressSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method SocketAddress::new_from_native -- method type : Constructor -- Args : [Arg {argName = "native", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "native", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SocketAddress" -- throws : False -- Skip return : False foreign import ccall "g_socket_address_new_from_native" g_socket_address_new_from_native :: Ptr () -> -- native : TBasicType TVoid Word64 -> -- len : TBasicType TUInt64 IO (Ptr SocketAddress) socketAddressNewFromNative :: (MonadIO m) => Ptr () -> -- native Word64 -> -- len m SocketAddress socketAddressNewFromNative native len = liftIO $ do result <- g_socket_address_new_from_native native len checkUnexpectedReturnNULL "g_socket_address_new_from_native" result result' <- (wrapObject SocketAddress) result return result' -- method SocketAddress::get_family -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SocketFamily" -- throws : False -- Skip return : False foreign import ccall "g_socket_address_get_family" g_socket_address_get_family :: Ptr SocketAddress -> -- _obj : TInterface "Gio" "SocketAddress" IO CUInt socketAddressGetFamily :: (MonadIO m, SocketAddressK a) => a -> -- _obj m SocketFamily socketAddressGetFamily _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_socket_address_get_family _obj' let result' = (toEnum . fromIntegral) result touchManagedPtr _obj return result' -- method SocketAddress::get_native_size -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt64 -- throws : False -- Skip return : False foreign import ccall "g_socket_address_get_native_size" g_socket_address_get_native_size :: Ptr SocketAddress -> -- _obj : TInterface "Gio" "SocketAddress" IO Int64 socketAddressGetNativeSize :: (MonadIO m, SocketAddressK a) => a -> -- _obj m Int64 socketAddressGetNativeSize _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_socket_address_get_native_size _obj' touchManagedPtr _obj return result -- method SocketAddress::to_native -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dest", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destlen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SocketAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dest", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destlen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_socket_address_to_native" g_socket_address_to_native :: Ptr SocketAddress -> -- _obj : TInterface "Gio" "SocketAddress" Ptr () -> -- dest : TBasicType TVoid Word64 -> -- destlen : TBasicType TUInt64 Ptr (Ptr GError) -> -- error IO CInt socketAddressToNative :: (MonadIO m, SocketAddressK a) => a -> -- _obj Ptr () -> -- dest Word64 -> -- destlen m () socketAddressToNative _obj dest destlen = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do _ <- propagateGError $ g_socket_address_to_native _obj' dest destlen touchManagedPtr _obj return () ) (do return () )