gi-gio-0.2.46.12: GI/Gio/Objects/InetAddressMask.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.InetAddressMask
(
-- * Exported types
InetAddressMask(..) ,
InetAddressMaskK ,
toInetAddressMask ,
noInetAddressMask ,
-- * Methods
-- ** inetAddressMaskEqual
inetAddressMaskEqual ,
-- ** inetAddressMaskGetAddress
inetAddressMaskGetAddress ,
-- ** inetAddressMaskGetFamily
inetAddressMaskGetFamily ,
-- ** inetAddressMaskGetLength
inetAddressMaskGetLength ,
-- ** inetAddressMaskMatches
inetAddressMaskMatches ,
-- ** inetAddressMaskNew
inetAddressMaskNew ,
-- ** inetAddressMaskNewFromString
inetAddressMaskNewFromString ,
-- ** inetAddressMaskToString
inetAddressMaskToString ,
-- * Properties
-- ** Address
InetAddressMaskAddressPropertyInfo ,
constructInetAddressMaskAddress ,
getInetAddressMaskAddress ,
setInetAddressMaskAddress ,
-- ** Family
InetAddressMaskFamilyPropertyInfo ,
getInetAddressMaskFamily ,
-- ** Length
InetAddressMaskLengthPropertyInfo ,
constructInetAddressMaskLength ,
getInetAddressMaskLength ,
setInetAddressMaskLength ,
) 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 InetAddressMask = InetAddressMask (ForeignPtr InetAddressMask)
foreign import ccall "g_inet_address_mask_get_type"
c_g_inet_address_mask_get_type :: IO GType
type instance ParentTypes InetAddressMask = InetAddressMaskParentTypes
type InetAddressMaskParentTypes = '[GObject.Object, Initable]
instance GObject InetAddressMask where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_inet_address_mask_get_type
class GObject o => InetAddressMaskK o
instance (GObject o, IsDescendantOf InetAddressMask o) => InetAddressMaskK o
toInetAddressMask :: InetAddressMaskK o => o -> IO InetAddressMask
toInetAddressMask = unsafeCastTo InetAddressMask
noInetAddressMask :: Maybe InetAddressMask
noInetAddressMask = Nothing
-- VVV Prop "address"
-- Type: TInterface "Gio" "InetAddress"
-- Flags: [PropertyReadable,PropertyWritable]
getInetAddressMaskAddress :: (MonadIO m, InetAddressMaskK o) => o -> m InetAddress
getInetAddressMaskAddress obj = liftIO $ getObjectPropertyObject obj "address" InetAddress
setInetAddressMaskAddress :: (MonadIO m, InetAddressMaskK o, InetAddressK a) => o -> a -> m ()
setInetAddressMaskAddress obj val = liftIO $ setObjectPropertyObject obj "address" val
constructInetAddressMaskAddress :: (InetAddressK a) => a -> IO ([Char], GValue)
constructInetAddressMaskAddress val = constructObjectPropertyObject "address" val
data InetAddressMaskAddressPropertyInfo
instance AttrInfo InetAddressMaskAddressPropertyInfo where
type AttrAllowedOps InetAddressMaskAddressPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint InetAddressMaskAddressPropertyInfo = InetAddressK
type AttrBaseTypeConstraint InetAddressMaskAddressPropertyInfo = InetAddressMaskK
type AttrGetType InetAddressMaskAddressPropertyInfo = InetAddress
type AttrLabel InetAddressMaskAddressPropertyInfo = "InetAddressMask::address"
attrGet _ = getInetAddressMaskAddress
attrSet _ = setInetAddressMaskAddress
attrConstruct _ = constructInetAddressMaskAddress
-- VVV Prop "family"
-- Type: TInterface "Gio" "SocketFamily"
-- Flags: [PropertyReadable]
getInetAddressMaskFamily :: (MonadIO m, InetAddressMaskK o) => o -> m SocketFamily
getInetAddressMaskFamily obj = liftIO $ getObjectPropertyEnum obj "family"
data InetAddressMaskFamilyPropertyInfo
instance AttrInfo InetAddressMaskFamilyPropertyInfo where
type AttrAllowedOps InetAddressMaskFamilyPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint InetAddressMaskFamilyPropertyInfo = (~) ()
type AttrBaseTypeConstraint InetAddressMaskFamilyPropertyInfo = InetAddressMaskK
type AttrGetType InetAddressMaskFamilyPropertyInfo = SocketFamily
type AttrLabel InetAddressMaskFamilyPropertyInfo = "InetAddressMask::family"
attrGet _ = getInetAddressMaskFamily
attrSet _ = undefined
attrConstruct _ = undefined
-- VVV Prop "length"
-- Type: TBasicType TUInt32
-- Flags: [PropertyReadable,PropertyWritable]
getInetAddressMaskLength :: (MonadIO m, InetAddressMaskK o) => o -> m Word32
getInetAddressMaskLength obj = liftIO $ getObjectPropertyCUInt obj "length"
setInetAddressMaskLength :: (MonadIO m, InetAddressMaskK o) => o -> Word32 -> m ()
setInetAddressMaskLength obj val = liftIO $ setObjectPropertyCUInt obj "length" val
constructInetAddressMaskLength :: Word32 -> IO ([Char], GValue)
constructInetAddressMaskLength val = constructObjectPropertyCUInt "length" val
data InetAddressMaskLengthPropertyInfo
instance AttrInfo InetAddressMaskLengthPropertyInfo where
type AttrAllowedOps InetAddressMaskLengthPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint InetAddressMaskLengthPropertyInfo = (~) Word32
type AttrBaseTypeConstraint InetAddressMaskLengthPropertyInfo = InetAddressMaskK
type AttrGetType InetAddressMaskLengthPropertyInfo = Word32
type AttrLabel InetAddressMaskLengthPropertyInfo = "InetAddressMask::length"
attrGet _ = getInetAddressMaskLength
attrSet _ = setInetAddressMaskLength
attrConstruct _ = constructInetAddressMaskLength
type instance AttributeList InetAddressMask = InetAddressMaskAttributeList
type InetAddressMaskAttributeList = ('[ '("address", InetAddressMaskAddressPropertyInfo), '("family", InetAddressMaskFamilyPropertyInfo), '("length", InetAddressMaskLengthPropertyInfo)] :: [(Symbol, *)])
type instance SignalList InetAddressMask = InetAddressMaskSignalList
type InetAddressMaskSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method InetAddressMask::new
-- method type : Constructor
-- Args : [Arg {argName = "addr", argType = TInterface "Gio" "InetAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "addr", argType = TInterface "Gio" "InetAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "InetAddressMask"
-- throws : True
-- Skip return : False
foreign import ccall "g_inet_address_mask_new" g_inet_address_mask_new ::
Ptr InetAddress -> -- addr : TInterface "Gio" "InetAddress"
Word32 -> -- length : TBasicType TUInt32
Ptr (Ptr GError) -> -- error
IO (Ptr InetAddressMask)
inetAddressMaskNew ::
(MonadIO m, InetAddressK a) =>
a -> -- addr
Word32 -> -- length
m InetAddressMask
inetAddressMaskNew addr length_ = liftIO $ do
let addr' = unsafeManagedPtrCastPtr addr
onException (do
result <- propagateGError $ g_inet_address_mask_new addr' length_
checkUnexpectedReturnNULL "g_inet_address_mask_new" result
result' <- (wrapObject InetAddressMask) result
touchManagedPtr addr
return result'
) (do
return ()
)
-- method InetAddressMask::new_from_string
-- method type : Constructor
-- Args : [Arg {argName = "mask_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "mask_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "InetAddressMask"
-- throws : True
-- Skip return : False
foreign import ccall "g_inet_address_mask_new_from_string" g_inet_address_mask_new_from_string ::
CString -> -- mask_string : TBasicType TUTF8
Ptr (Ptr GError) -> -- error
IO (Ptr InetAddressMask)
inetAddressMaskNewFromString ::
(MonadIO m) =>
T.Text -> -- mask_string
m InetAddressMask
inetAddressMaskNewFromString mask_string = liftIO $ do
mask_string' <- textToCString mask_string
onException (do
result <- propagateGError $ g_inet_address_mask_new_from_string mask_string'
checkUnexpectedReturnNULL "g_inet_address_mask_new_from_string" result
result' <- (wrapObject InetAddressMask) result
freeMem mask_string'
return result'
) (do
freeMem mask_string'
)
-- method InetAddressMask::equal
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mask2", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mask2", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_inet_address_mask_equal" g_inet_address_mask_equal ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
Ptr InetAddressMask -> -- mask2 : TInterface "Gio" "InetAddressMask"
IO CInt
inetAddressMaskEqual ::
(MonadIO m, InetAddressMaskK a, InetAddressMaskK b) =>
a -> -- _obj
b -> -- mask2
m Bool
inetAddressMaskEqual _obj mask2 = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let mask2' = unsafeManagedPtrCastPtr mask2
result <- g_inet_address_mask_equal _obj' mask2'
let result' = (/= 0) result
touchManagedPtr _obj
touchManagedPtr mask2
return result'
-- method InetAddressMask::get_address
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "InetAddress"
-- throws : False
-- Skip return : False
foreign import ccall "g_inet_address_mask_get_address" g_inet_address_mask_get_address ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
IO (Ptr InetAddress)
inetAddressMaskGetAddress ::
(MonadIO m, InetAddressMaskK a) =>
a -> -- _obj
m InetAddress
inetAddressMaskGetAddress _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_inet_address_mask_get_address _obj'
checkUnexpectedReturnNULL "g_inet_address_mask_get_address" result
result' <- (newObject InetAddress) result
touchManagedPtr _obj
return result'
-- method InetAddressMask::get_family
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", 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_inet_address_mask_get_family" g_inet_address_mask_get_family ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
IO CUInt
inetAddressMaskGetFamily ::
(MonadIO m, InetAddressMaskK a) =>
a -> -- _obj
m SocketFamily
inetAddressMaskGetFamily _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_inet_address_mask_get_family _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method InetAddressMask::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_inet_address_mask_get_length" g_inet_address_mask_get_length ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
IO Word32
inetAddressMaskGetLength ::
(MonadIO m, InetAddressMaskK a) =>
a -> -- _obj
m Word32
inetAddressMaskGetLength _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_inet_address_mask_get_length _obj'
touchManagedPtr _obj
return result
-- method InetAddressMask::matches
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "address", argType = TInterface "Gio" "InetAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "address", argType = TInterface "Gio" "InetAddress", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_inet_address_mask_matches" g_inet_address_mask_matches ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
Ptr InetAddress -> -- address : TInterface "Gio" "InetAddress"
IO CInt
inetAddressMaskMatches ::
(MonadIO m, InetAddressMaskK a, InetAddressK b) =>
a -> -- _obj
b -> -- address
m Bool
inetAddressMaskMatches _obj address = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let address' = unsafeManagedPtrCastPtr address
result <- g_inet_address_mask_matches _obj' address'
let result' = (/= 0) result
touchManagedPtr _obj
touchManagedPtr address
return result'
-- method InetAddressMask::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "InetAddressMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_inet_address_mask_to_string" g_inet_address_mask_to_string ::
Ptr InetAddressMask -> -- _obj : TInterface "Gio" "InetAddressMask"
IO CString
inetAddressMaskToString ::
(MonadIO m, InetAddressMaskK a) =>
a -> -- _obj
m T.Text
inetAddressMaskToString _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_inet_address_mask_to_string _obj'
checkUnexpectedReturnNULL "g_inet_address_mask_to_string" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'